What Is an API? A Plain-English Explanation
You hear the word API everywhere in tech, but explanations are often full of jargon. Here is what an API actually is, using everyday examples.
The restaurant analogy
Think of a restaurant. You do not walk into the kitchen to cook your meal. You read the menu, tell the waiter what you want, and the waiter brings back your food. The kitchen could change its stove or its staff, and you would not notice, as long as the menu and the waiter stay the same.
An API (Application Programming Interface) is the menu and the waiter for software. It is a defined way for one program to ask another program for something and get a predictable answer back.
Examples you already use
- Weather apps ask a weather service's API for the forecast at your location.
- "Log in with Google" buttons use Google's API to confirm who you are.
- Online shops use a payment provider's API to charge your card without storing your card details themselves.
- Maps on websites are loaded through a mapping service's API.
How a web API request works
Most modern APIs work over the web. A program sends a request to an address (a URL), often with some details, like a city name. The server replies with data, usually in a format called JSON, which looks like a neat list of names and values. The program then reads that data and shows it to you in a friendly way.
Why APIs matter
APIs let developers build on top of what already exists. Instead of creating a payment system, a map and a login system from scratch, a small team can connect to existing services and focus on what makes their product unique.
Keys and limits
Many APIs require an API key, a kind of password that identifies who is making requests. Providers often limit how many requests you can make, to keep their service fair and stable. Keep your keys private, just like passwords.
Next time you hear "API", just think: a menu of things one program can ask another program to do.