API
Also known as: Application programming interface
Defined set of rules and interfaces through which one piece of software can request services or data from another without knowing its internals.
An application programming interface (API) is a contract between pieces of software. It specifies what requests one program can make of another, what inputs those requests take and what results or errors come back, while hiding how the work is done. The term covers many layers: the functions a library exposes to the programs that use it, the system calls an operating system offers to applications and web APIs that let a weather app fetch forecasts from a remote server over HTTP.
Web APIs became a defining feature of internet software in the 2000s. Styles include REST, built on resource URLs and HTTP methods; GraphQL, in which clients describe exactly the data they want; and remote procedure call systems such as gRPC. Specifications such as OpenAPI describe these interfaces in machine-readable form so that documentation and client code can be generated. Companies publish APIs so that others can build on their services, often with authentication keys, usage limits and pricing tiers.
APIs are how software is composed at scale: a single app may combine maps, payments, messaging and AI services from different providers through their interfaces. A stable API lets implementations change behind it without breaking users, which is why altering a published interface is treated seriously and is often signaled through semantic versioning. APIs also raise questions of control. A provider can change its terms or shut an API down, stranding the software that depends on it, and in Google v. Oracle (2021) the US Supreme Court held that Google's reuse of Java API declarations in Android was fair use.
Key points
- An API defines the requests one program can make of another, along with their inputs, outputs and errors.
- APIs exist at every level, from library functions and operating system calls to web services.
- REST, GraphQL and gRPC are common styles for web APIs, which are often described with the OpenAPI specification.
- Stable, well-documented APIs let systems evolve independently, while abrupt changes can break dependent software.
Related entries
REST API
Web interface that follows the REST architectural style, exposing resources at URLs that clients manipulate with stateless HTTP requests.
GraphQL
Query language and runtime for APIs that lets clients request exactly the data they need from a server in a single, strongly typed query.
Software Development Kit
Bundle of tools, libraries, documentation and samples that developers use to build software for a particular platform, device or service.
Software Library
Collection of prewritten, reusable code, such as functions and classes, that programs call on to perform common tasks without reimplementing them.
Webhook
HTTP callback in which one system automatically sends data to another the moment a specific event occurs, instead of waiting to be asked.
OpenAPI Initiative
Linux Foundation consortium that maintains the OpenAPI Specification, a vendor-neutral standard for describing HTTP APIs in machine-readable form.
HTTP
Stateless request-response protocol that web browsers, servers and other clients use to request and transfer resources such as web pages and data.
Semantic Versioning
Versioning convention that encodes compatibility in MAJOR.MINOR.PATCH numbers, signaling breaking changes, added features and bug fixes.
Featured in guides
Referenced by
Other entries that discuss or point to API.