What is an API?

Tech By 2 min read

Quick answer

An API (application programming interface) is a set of rules that lets one piece of software request data or actions from another. When a weather app shows today’s forecast, it’s usually asking a weather service’s API for the data, then displaying the answer.

The restaurant analogy

Think of a restaurant. You (an app) want food (data), and the kitchen (another system) can make it. You don’t walk into the kitchen; you give your order to a waiter, who takes it to the kitchen and brings back your dish. The API is the waiter: a defined way to ask for something and get a response, without needing to know how the kitchen works.

Everyday examples

You do thisBehind the scenes
Check the weather on your phoneThe app calls a weather service’s API
Click “Sign in with Google”The site uses Google’s login API
Pay online with a cardThe shop sends the payment through a payment provider’s API
See a map on a restaurant’s websiteThe page uses a maps API
Ask an AI assistant inside another appThe app sends your request to the AI provider’s API

How web APIs work

Most modern APIs run over the web:

  1. An app sends a request to a web address called an endpoint, for example asking for the weather in Paris.
  2. The request often includes an API key, a password-like code that identifies the app.
  3. The server sends back a response, usually in a format called JSON, which looks like this: {"city": "Paris", "temp_c": 14}.
  4. The app turns that data into something you can see.

A common style for web APIs is REST, which uses ordinary web actions like GET (fetch data) and POST (send data).

Why APIs matter

  • No need to rebuild everything. A small app can add maps, payments or translation by connecting to existing services.
  • Security. The API only exposes what the provider chooses, not its whole system.
  • Automation. APIs let programs work together without a person copying data between them.

Want to start using APIs yourself? Here’s how to learn coding online for free, and how AI tools use them.

Still curious?

Jump to a random question from the archive.

Surprise me

Keep exploring