Skip to content

What is an API?

An API (Application Programming Interface) is an agreed way for one program to ask another for data or to do something. A weather app has no weather stations of its own - it asks a weather service's API for the forecast and shows you the answer.

In short

  • An API is a "service window" through which programs exchange data by agreed rules.
  • Most APIs work over the Internet: a program sends a request to an address and gets a response, usually in JSON.
  • Access usually needs a key, and that key must be guarded like a password.

The waiter in a restaurant

In a restaurant you do not walk into the kitchen and cook. You pick a dish from the menu, tell the waiter, and they come back with a plate. You do not know how the kitchen is organised, how many cooks there are or where the fridge is - and you do not need to.

An API is that waiter. The menu is the documentation: a list of what you can ask for and in what form. The kitchen is someone else's system, which no outsider has (or should have) direct access to. That way both sides can rearrange their back room freely, as long as the menu stays the same.

What a conversation through an API looks like

Most web APIs use the same protocol as websites: HTTP. A program sends a request to a specific address, for example:

GET https://api.example.com/weather?city=London

and gets data back, usually in JSON:

{
  "city": "London",
  "temperature": 7,
  "summary": "light rain"
}

Not a pretty page with pictures - just plain data that the app dresses up in its own design. An API built on addresses and ordinary HTTP requests like this is often called a REST API.

Where you meet APIs every day

  • "Sign in with Google" - the site asks Google's API who you are, without ever seeing your password.
  • Paying in an online shop - the shop sends the amount to the payment provider's API, which answers "paid" or "declined".
  • Shipping - the shop books a courier and gets the tracking number through the courier's API.
  • Maps, weather, exchange rates - all data from other companies' APIs.
  • AI inside apps - the AI assistant in your note-taking app is usually a series of requests to an LLM provider's API.

Keys, tokens and limits

An API provider wants to know who is asking - to bill for usage, enforce limits and cut off abuse. So requests carry an API key or a token. In practice it is a password: whoever has your key uses the API on your bill. Never paste it into a public repository, an email or an AI chat.

Tokens in the JWT format can be inspected - inside is plain JSON saying who is logged in and when the token expires. You can see for yourself with a JWT decoder that runs in your browser and sends the token nowhere.

Most APIs also have rate limits, say 100 requests a minute. Go over and you get an error instead of data - that is normal behaviour, not an outage.

When it matters to you

  • You connect tools together, e.g. a shop with accounting or a form with a CRM - services like Zapier or Make do exactly that, through APIs.
  • You are choosing software for a business - ask whether it has an API. Without one, your data stays locked inside a single program.
  • You are learning to code - working with someone else's API is one of the first real-world tasks. JSON responses are much easier to read once formatted.

JSON, server, REST, API key, JWT, AI agent.

Advertisement