What an API is.
A restaurant menu: you order from a set list, and the kitchen handles the rest.
When two pieces of software need to work together, they need an agreed way to ask each other for things. An API (application programming interface) is that agreement: the menu of requests one program promises to accept, and what it will send back.
Like ordering at a restaurant, you do not walk into the kitchen. You pick from the menu, and the kitchen does whatever it does to fulfil the order.
- Can I just… go in?1
You want something from another program — but you cannot just walk into its kitchen.
- 2
It hands you a menu instead: the fixed list of requests it agrees to accept.
- Weather for London, please.3
You place a specific, allowed order — that is a request.
- 4
The door checks it: well-formed? are you allowed? (often via an API key).
- 5
Behind the wall the kitchen does whatever it does — you never see how.
- Exactly what I asked for.6
Back comes a tidy, structured plate (usually JSON) your code can read.
Why hiding the kitchen is the point
You do not need to know how the weather service stores forecasts or what language it runs. You only need the menu — the requests it accepts and the format it replies in. As long as the menu stays stable, the kitchen can be completely rebuilt without breaking you.
This separation is what lets enormous systems be built by separate teams and companies who never coordinate beyond agreeing on the menu.
Why everything has one
APIs are the glue of modern software. Your app talks to payment providers, maps, login systems, and AI models through their APIs, each a menu you order from. It is also how the parts of one big system talk to each other, so teams can ship independently as long as they honour the agreed interface.