What is an api? It is a set of rules one program uses to ask another program for something, without needing to know how that other program is built inside. The weather app on your phone does not calculate tomorrow’s temperature. It asks a server, in a precisely formatted sentence, and the server answers with numbers.
That is the whole concept. The complexity lives in the details of the sentence.
The Restaurant Version
You sit at a table and order from a menu. You do not walk into the kitchen, open the refrigerator, and cook. The menu defines what you may ask for, the waiter carries the request, and the kitchen decides how to fulfill it.
The menu is the API. The waiter is the network. The kitchen is the server, and it can be rewritten completely as long as the menu still lists the same dishes.
Request and Response
Most web APIs speak HTTP, the same protocol your browser uses. A request has four parts: a method, a URL, headers, and sometimes a body. A response has a status code and a body, usually JSON.
| Method | Meaning | Typical use |
|---|---|---|
| GET | Read something | Fetch a user profile |
| POST | Create something | Submit a new order |
| PUT / PATCH | Replace or update | Change an address |
| DELETE | Remove something | Cancel a booking |
Status codes tell you what happened in three digits. 200 means success, 201 means created, 400 means your request was malformed, 401 means you are not authenticated, 404 means the resource is not there, and 500 means the server broke on its own.
A response body might look like a small nested list of names and values. That format, JSON, won because it is readable by humans and trivial for machines to parse.
Endpoints, Keys, and Rate Limits
An endpoint is a specific URL that accepts a specific kind of request. One service might expose endpoints for users, orders, and payments, each with its own rules.
Authentication usually rides in a header as an API key or a token. The key identifies who is asking and what they are allowed to do. This is why leaked keys are dangerous: anyone holding one can spend your quota, and sometimes your money.
Rate limits cap how many requests you may send per minute or per day. They exist to keep one client from starving everyone else, and they are the reason a script that works fine in testing suddenly returns 429 errors in production.
REST, GraphQL, and Webhooks
- REST organizes everything around resources and URLs. Simple, cacheable, and by far the most common style.
- GraphQL lets the client specify exactly which fields it wants in one request, which avoids fetching a large object to read one number.
- Webhooks reverse the direction: you give the service a URL, and it calls you when something happens. No polling required.
None of these is automatically better. A small team shipping a simple product should probably start with plain REST and a handful of endpoints.
Why Apps Break When an API Changes
An API is a promise, and promises get broken. A field gets renamed, a value changes type from number to string, or an endpoint is retired. Code that depended on the old shape fails, often silently, because the response still arrives and still parses.
Good providers version their APIs and deprecate old endpoints on a published schedule. Good clients validate responses instead of assuming them. Most outages blamed on “the cloud” are really one of these two disciplines being skipped.
APIs You Use Without Noticing
When a website shows a map, it is calling a mapping API. When you pay, a payment API moves the money. When you log in with another account, an identity API confirms who you are. When a chatbot answers, it is calling a model API and paying per token.
Understanding what is an api changes how you read a technical failure. “The site is down” often means one dependency in a chain of five stopped answering, and everything upstream is working perfectly.
Keep Exploring
- What is an algorithm? — the procedure being called
- How do search engines work? — a giant system built from APIs
- What is cloud computing? — where those servers actually live




1 thought on “What Is an API? The Contract Behind Every App You Use”