Skip to content
BENIBIX Learn

API Key

Development🔑 AuthSessions and Tokens

Also known as API Keys, Secret Key, x-api-key

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

Think of it like

Think of it like a members' card for a club. It shows which member is at the door.

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.

Definition

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 code

http
GET /v1/forecast?city=Leeds HTTP/1.1
X-API-Key: 3f9a2c71d8e04b6a
The key in a header tells the service whose account to charge.

Common mistake

Committing an API key to a public Git repo. Bots scan for them within minutes and run up the bill.

Key takeaways

  1. 1
    Says who is calling. An app or account.
  2. 2
    Used to bill and limit. Quota and rate limits.
  3. 3
    Lasts until revoked. So guard it well.

Compare

Learn it properly