API
An application programming interface (API) tells software how to use another component: what it can ask for, what information it must provide, and what it can expect in return.
Also known as: Application Programming Interface
What an API is
Think of an API as the part of a software component that other code is meant to use. A shipping service might expose a way to look up a shipment without giving callers access to its database. The service can change how it stores tracking events without requiring callers to change, as long as it keeps the same promises about what the lookup returns.
An API does not need a server or a network connection. Python's sorted() function is part of an API too: callers know what input the function accepts and that it returns a new sorted list. They don't need to know which sorting algorithm it uses.
What an HTTP API promises
For an HTTP API, the contract typically covers the request method and path, inputs such as query parameters or a request body, and the shape and meaning of responses. It also tells callers how to authenticate when required and which errors they should handle. An OpenAPI description can capture much of this contract in a machine-readable format for documentation and tooling.
Example: look up a shipment
A storefront could send this request to its shipping service:
GET /shipments/42 HTTP/1.1
Host: shipping.example
Here GET asks to retrieve data, and 42 identifies the shipment. The service might return 200 OK with {"id":42,"state":"in_transit"} as the JSON body. The HTTP status tells the storefront that the lookup succeeded; the state field tells it where the shipment is in the delivery process. If the shipment does not exist, the contract might specify 404 Not Found instead.
Where APIs fit
A frontend calls a backend API to load account data, backend services call one another to complete a workflow, and vendors expose APIs so customers can integrate payments or messaging. Not every HTTP API is RESTful: REST is an architectural style, while HTTP is a protocol and JSON is a data format. An SDK is different again: it may include a client library that lets you call an API through language-native functions rather than building HTTP requests yourself.
How it comes up in interviews
An interviewer may ask you to design an API for a small feature. Walk through one call from the client's point of view: what it sends, what comes back, how it handles failure, and how the server decides whether the caller has access. If asked to change an existing API, identify what clients already depend on. Keeping a path and a success code unchanged won't help a client that expects a response field you've removed.