API · Application Programming Interface
/ ay-pee-EYE /
An API is an agreed-upon way for two programs to talk to each other. It's a contract: 'here are the requests you're allowed to make, and here's exactly what you'll get back.' You don't need to know how the other program works inside — you just need to know what to ask for and what shape the answer comes in.
The classic picture is a restaurant menu. You don't walk into the kitchen and cook; you read the menu, point at item #4, and a plate comes out. The menu is the API: a fixed list of things you can ask for, hiding all the chopping and frying behind it. The kitchen can rearrange itself completely and your order still works, as long as the menu stays the same.
This is why APIs are everywhere. When a weather app shows you tomorrow's forecast, it didn't measure the sky — it asked a weather service's API and got back a tidy answer. APIs let programs borrow each other's abilities without ever sharing their messy insides.
$ curl https://api.example.com/weather?city=Taipei
{ "city": "Taipei", "tempC": 28, "sky": "clear" }You ask the API a question; it hands back a tidy, predictable answer.
API is the whole menu; an endpoint is one item on it.