How the web works · Concept

API

A defined way for one piece of software to ask another for data or actions, such as an app asking a payment service to charge a card.

Requests and responses · updated

How it works

An API is a contract: send a request in this shape and you get a response in that shape. On the web it usually means an HTTP API, where an app calls URLs (endpoints) such as /orders/42 and receives JSON. The provider documents what each endpoint does and issues keys or tokens, so it knows who is calling and can limit or bill them.

The term is broader than the web. Browsers offer APIs to JavaScript (the DOM, fetch, geolocation), operating systems offer them to apps, and libraries offer functions. Web APIs come in several styles: REST (resources and HTTP verbs), GraphQL (one endpoint where the client picks the fields), gRPC (fast binary calls between services) and webhooks, where the provider calls you when something happens.

More in How the web works

Requests and responses

All 20 How the web works terms

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.