API
An API (application programming interface) is a set of rules and endpoints through which one program can request data or actions from another without knowing how it works inside. APIs connect websites, mobile apps, payment systems and cloud services.
Definition
An API is a contract between two pieces of software. The provider publishes what can be requested, in what format and what comes back; the caller follows those rules without seeing the internal code or database. In MDN’s wording, it lets other software, rather than a human user, interact with an application.
A common analogy is a restaurant menu: it lists what can be ordered, guests stay out of the kitchen, and the dish arrives in the agreed form. If the chef changes, the menu stays the same — likewise, a provider can rewrite its internals without changing the API.
Browsers, operating systems and libraries all have APIs, but in everyday use the word usually means a web API: a service that programs call over HTTP.
How a request works
A web API works on a request–response model. The client sends a request to an endpoint, a URL such as https://api.example.com/v1/orders/1042. The request includes an HTTP method (GET to read, POST to create, PUT or PATCH to update, DELETE to remove), headers with metadata such as the access key and expected format, and sometimes a body. The server replies with a status code (200 for success, 404 if the resource does not exist) and usually a JSON body.
curl https://api.example.com/v1/orders/1042 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
{
"id": 1042,
"status": "paid",
"amount": 15000,
"currency": "KZT",
"created_at": "2026-11-27T10:15:00Z"
}
Endpoints are documented, often in OpenAPI — an open standard for describing HTTP APIs, hosted by the Linux Foundation, from which tools generate docs, client code and tests.
Common types
- REST — the most widespread style on the web, described by Roy Fielding in his 2000 doctoral dissertation. Data is exposed as resources with their own URLs, and each request carries all the information needed to understand it.
- GraphQL — a query language with a single endpoint, where the client specifies exactly which fields it needs.
- gRPC — a remote procedure call framework that sends binary Protocol Buffers messages over HTTP/2, often between internal services.
- WebSocket — a persistent two-way connection for real-time data such as chats and market prices.
- Webhooks — the reverse direction: when an event occurs, such as a successful payment, the provider sends an HTTP request to the client’s URL.
- SOAP — an older XML-based protocol with strict rules; according to IBM, it remains common in finance and healthcare.
Keys, OAuth and rate limits
An API key is a secret string that identifies the calling application and lets the provider track usage; it is sent in a header and must never appear in frontend code or a public repository. When an app acts on behalf of a user, for example to read their calendar, OAuth 2.0 (RFC 6749, 2012) is used: the user grants limited access, and the app receives a token instead of the password.
Rate limits cap the number of requests per period of time. Above the limit, the server typically returns 429 Too Many Requests, sometimes with a Retry-After header that says how long to wait.
API vs SDK vs library
- An API is the interface itself: the rules and endpoints. A web API can be called from any language that can send an HTTP request.
- A library is ready-made code added to a project and called directly inside the same program.
- An SDK (software development kit) is a broader toolset for a specific platform or language: libraries, documentation, examples, sometimes debuggers. Many providers publish SDKs that wrap HTTP calls in functions such as
client.orders.get(1042), so requests need not be built by hand.
Why companies publish APIs
An API turns a product into a building block for others: payment providers let online stores accept cards, mapping services let apps display maps, and AI companies sell model access billed by usage. IBM distinguishes public APIs open to any developer, partner APIs limited to contracted partners, and private APIs that connect a company’s internal systems. For the provider, an API is a distribution channel and sometimes a revenue source; for the client, it saves building complex features from scratch.
Sources
- API - Glossary — MDN Web Docs (accessed 28 November 2026)
- What Is an API (Application Programming Interface)? — IBM (accessed 28 November 2026)
- What is an API? - Application Programming Interfaces Explained — Amazon Web Services (accessed 28 November 2026)
- SDK vs API - Difference Between Developer Tools — Amazon Web Services (accessed 28 November 2026)
- Architectural Styles and the Design of Network-based Software Architectures, Chapter 5: Representational State Transfer (REST) — Roy Thomas Fielding, University of California, Irvine (accessed 28 November 2026)
- RFC 6749: The OAuth 2.0 Authorization Framework — IETF (accessed 28 November 2026)
- 429 Too Many Requests - HTTP — MDN Web Docs (accessed 28 November 2026)
- What is OpenAPI? — OpenAPI Initiative (accessed 28 November 2026)