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.
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.
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.
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.