Beginner · Interactive lesson

API Keys

An API key is a long opaque string you generate for a client. They send it on every request; you look it up in a database to find the caller. Simple, ubiquitous, and easy to misuse.

Step 1 of 4

How it works

ClientX-API-Key headerServerLookupRate-limit + respond
1GET /v1/orders HTTP/1.1
2Host: api.stripe.com
3X-API-Key: sk_live_51H...

Alternatives include a bearer header (Authorization: Bearer sk_...) or query string (?api_key=...). Headers are strongly preferred — query strings end up in logs.

Up next
JSON Web Tokens (JWT)
Continue →