Definition
An application programming interface, or API, is a documented interface through which one software component requests data or behavior from another. The contract identifies available operations, inputs, outputs, errors, and interaction rules while allowing the implementation behind the interface to change independently.
An API can be a function or library interface inside one process, an operating-system interface, or a network service. HTTP endpoints are common, but HTTP is a transport, not the definition. REST, RPC, GraphQL, and event-driven APIs express different interaction styles.
What agents need from an API
Human developers often compensate for ambiguous documentation with experience and judgment. Agents amplify ambiguity. An agent-ready API should expose precise schemas, authentication and authorization requirements, side effects, idempotency behavior, rate limits, error semantics, examples, and safe retry rules. Describing an endpoint as callable does not establish that the caller may use it or that repeated calls are harmless.
Distinguish it from nearby terms
An API is the general interface contract. A protocol defines rules that multiple participants follow across an interaction. MCP and A2A specify particular protocol roles and objects, usually implemented over existing transports and APIs. A tool is a capability surfaced for model use and may wrap one or more APIs.
Check your understanding
An agent times out after submitting a bank transfer and retries the same request. What API property determines whether money moves twice? Idempotency. The interface must document a safe retry mechanism and return enough state to reconcile uncertainty.