Quick answer

An API, or application programming interface, is a defined way for software components to communicate. It specifies the requests a component accepts and the responses or behavior callers can expect.

Original example

Ask a weather service for a forecast

A weather app can send a documented API request containing a location. The service returns structured forecast data, which the app formats for the screen without needing direct access to the service's internal database.

APIs are contracts between software

An API defines available operations, required inputs, returned data, errors, and often authentication rules. Web APIs commonly exchange data over HTTP, but APIs also exist inside operating systems and software libraries.

An API exposes selected capabilities, not necessarily the implementation behind them. Providers can version or restrict an API, so callers must follow its documentation.

Common misunderstandings

  • An API is not automatically a public web service; many APIs are private or local.
  • Using an API does not mean a caller can access every part of the underlying system.

Related answers

Sources

  • API - MDN Web Docs, accessed 2026-10-30

This is an unreviewed preview draft. Corrections can be sent after the owner configures a verified contact address.