Skip to content
BENIBIX Learn

API Key vs Access Token

People think an API key and an access token are the same thing, and they are not. An API key names your app, and it lasts until someone turns it off. An access token is short-lived, and it often acts for one user who logged in. Both go in a header, and both must stay secret.

Development🔑 Auth

API Key

A long secret string. It tells an API which app or account is calling.

An API key is a long secret string that tells an API which app or account is calling. You get it from the service's dashboard and send it with each request. The service uses it to know who to bill, how many calls to allow and when to block. Unlike a login, a key usually does not expire on its own. Anyone who copies it can spend your quota and your money.

Example
Jack signs up for a weather API and gets a key. His app sends it with each call, and the service counts his 1,000 free calls a day.
Why it matters
It is the easiest way to call a paid API. It is also the easiest secret to leak by mistake.
Full entry
Development🔑 Auth

Access Token

A string an app sends with each request to prove it may use an API.

An access token is a string an app sends with each request to prove it may use an API. You get it after logging in, and it stands in for your password from then on. Most access tokens expire quickly, often within an hour. The server checks the token on every request before it answers. Anyone who holds a valid token can use it, so it must be kept secret.

Example
Lucy's phone app logs her in and gets an access token. For the next hour, every request carries that token instead of her password.
Why it matters
Apps never have to store or resend your password. A short-lived token limits the harm if it leaks.
Full entry

In one line

API Key
A long secret string. It tells an API which app or account is calling.
Access Token
A string an app sends with each request to prove it may use an API.