What is an API key?

An API key is a secret credential string that identifies and authorizes an application or server to call a remote API on your behalf. Because anyone possessing an active key can access data or trigger billable actions, API keys belong strictly on backend servers in a secrets manager—never in browser or mobile client code.

By Sacha Arbonel, Founder and CTOLast updated
  • Also called
  • Secret key
  • Server key

Why does API key matter?

Leaked API keys are one of the fastest ways attackers drain model budgets or exfiltrate customer data. Scoping keys to minimal permissions and separating development from production limits blast radius when a credential is exposed.

An API key identifies and authorizes your application. Anyone who has it can act as you, so it belongs on your server, in an environment variable or secrets manager, never in code that runs in a browser or a mobile app.

If a key leaks, revoke it and issue a new one. Separate keys for development and production limit the damage.

Key characteristics of API key

  • Stored exclusively in server-side environment variables or a dedicated secrets manager.
  • Scoped to the minimum permissions and environment (development vs. production) required.
  • Rotatable and revocable immediately without redeploying unrelated services.
  • Excluded from source control, client bundles, error logs, and agent prompts.

Example in practice

How Norilu handles API key

Frequently asked questions

Can I call an AI agent API directly from frontend JavaScript with an API key?
No. Anything shipped to a browser can be extracted in seconds. Always call the agent API from your own backend server after verifying the signed-in user.
What should I do immediately if an API key is committed to Git?
Revoke the exposed key immediately, issue a fresh replacement key, audit recent API usage for unauthorized calls, and then scrub the secret from repository history.

Go deeper