What is an API? How APIs work, explained simply

What is an API? An application programming interface is a set of rules that lets a piece of software ask another for data or for an action and get a predictable answer back. Your weather app, a "Pay with PayPal" button and an AI assistant that reads your calendar all depend on APIs.

Last updated November 19, 2026

Dark title card reading "What is an API?" under the label Cloud Guide

The short version

  • API stands for application programming interface. People use an app through its screen and buttons. Other programs use it through its API.
  • Most web APIs work by request and response: a client sends a request to a URL called an endpoint, and a server sends data back.
  • REST APIs are the most common kind on the web. They use standard HTTP methods such as GET, POST, PUT and DELETE.
  • An API key identifies the app making a request. Treat it like a password and never post it publicly.

What does API stand for?

API stands for application programming interface. AWS explains 2 of the words this way: an "application" is any software with a distinct function, and the "interface" is a contract of service between 2 applications that defines how they communicate using requests and responses.

The key word is contract. Mozilla's MDN Web Docs describes an API as a set of features and rules inside a program that lets other software interact with it, "as opposed to a human user interface." A person uses an app by tapping buttons. Another program uses the same app through its API.

IBM adds that an API exposes only the data and functions needed for a specific job and keeps the rest of the system hidden. The program on the other side doesn't need to know how the service is built inside. It only needs to know which requests it can send and what it will get back.

What is an API in simple terms?

Think of the weather app on your phone. It doesn't measure the weather itself. AWS uses this exact example: a weather bureau's system holds the daily data, and the app on your phone "talks" to that system through an API and shows you the forecast.

IBM gives a shopping example. When you choose "Pay with PayPal" on a store's website, clicking the button starts an API call to the payment service, which sends back a response. You only see the payment confirmation, and IBM notes the whole exchange is invisible to the buyer.

Not every API is a remote service. MDN points out that web browsers have their own built-in APIs that websites can use. The Geolocation API retrieves location information from your device, and the getUserMedia API grabs audio and video from your webcam, for example to broadcast it in a conference call.

How do APIs work?

Most explanations use 2 roles. The app that sends the request is the client, and the app that sends the response is the server. In the weather example, the phone app is the client and the bureau's system is the server.

For a web API, a typical exchange looks like this:

  1. The client builds a request. IBM says a request goes to the API's address and includes a request verb, headers and sometimes a request body. Together they say what is being asked for and how.
  2. It sends the request to an endpoint. AWS describes endpoints as the server URLs and other specific digital locations where information is sent and received.
  3. The server processes it. AWS says the server uses the client's input to start internal functions.
  4. The server sends a response. AWS notes that a REST API's response is plain data, without the graphical layout of a web page.

The response also carries an HTTP status code, which MDN says indicates whether a request was successfully completed. MDN groups HTTP status codes into 5 classes, from informational responses (100–199) to server errors (500–599). A few come up constantly when you work with APIs:

CodeNameWhat it means
200OKThe request succeeded.
201CreatedThe request succeeded and created something new, typically after a POST.
400Bad RequestThe server won't process the request because of what it sees as a client error, such as malformed syntax.
401UnauthorizedThe client has to authenticate first. MDN notes it really means "unauthenticated."
403ForbiddenThe server knows who the client is, but the client doesn't have access rights.
404Not FoundThe server can't find the resource. In an API, the endpoint may be valid while the item doesn't exist.
429Too Many RequestsThe client sent too many requests in a given time and hit a rate limit.
500Internal Server ErrorSomething went wrong on the server that it doesn't know how to handle.

What is a REST API?

AWS calls REST APIs "the most popular and flexible APIs found on the web today." REST stands for Representational State Transfer. MDN describes it as a group of software architecture design constraints, and says beginners can assume a REST API means "an HTTP service that can be called using standard web libraries and tools."

REST APIs use standard HTTP methods. AWS says the REST APIs built with its API Gateway implement these 5, and MDN defines them:

AWS says the main feature of REST is statelessness, which means the server doesn't save client data between requests.

Types of APIs

APIs are usually grouped in 2 ways: by how they're built and by who can use them.

By design, AWS lists 4 approaches. REST is the most common. SOAP APIs exchange messages in XML and, according to AWS, were more popular in the past. RPC (remote procedure call) APIs let the client run a function on the server and get the output back. WebSocket APIs support 2-way communication, so the server can send messages to connected clients. IBM adds GraphQL, a query language Facebook developed in 2012 that lets clients ask for exactly the data they need, and webhooks, where the server notifies the client when a specified event happens instead of waiting to be asked.

By access, AWS describes these groups:

What is an API key?

An API key is a long string of characters that identifies the app making a request. AWS says API keys identify the application and check that it has the access rights for that call, and that they are "not as secure as tokens." Authentication tokens, by contrast, check that a user is who they claim to be.

Providers also use keys to track usage. Google Cloud says its standard API keys associate a request with a project "for billing and quota purposes." That is why a leaked key matters. Google warns that publicly exposing API keys "can lead to unexpected charges on your account or unauthorized access to your data."

Google's API key documentation recommends these steps:

The same habits apply to keys for AI services. Apps built on a large language model often reach it through the provider's API, and Google's API key guidance specifically covers keys for its Gemini API.

What is an API gateway?

IBM describes an API gateway as a software layer that gives clients a single entry point to multiple backend services, handling jobs such as routing, authentication, rate limiting and monitoring.

Gateways are also sold as cloud services. AWS calls its API Gateway a fully managed service and describes it as a service for "creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale." AWS also says API Gateway and AWS Lambda together form the app-facing part of its serverless infrastructure.

API vs MCP

AI tools have added a new term next to APIs. The Model Context Protocol (MCP) is, in its project's words, "an open-source standard for connecting AI applications to external systems." It lets assistants such as Claude and ChatGPT reach data sources, tools and workflows, and its documentation compares MCP to a USB-C port for AI applications.

MCP doesn't replace APIs. An API is the general idea of a contract between 2 programs. MCP is a specific, shared standard for connecting an AI agent or assistant to tools and data. The MCP project says that because so many clients support it, developers can "build once and integrate everywhere."

Frequently asked questions

What is an API call?

An API call is a single request from a client to an API, such as asking a weather service for today's forecast. The server answers each call with a response that includes a status code and, usually, the requested data.

What is an API endpoint?

An endpoint is the specific address, usually a URL, where an API receives a request. A single API can have many endpoints for different kinds of data. AWS notes that endpoints matter for security, since they can make a system vulnerable to attack, and for performance, since high-traffic endpoints can cause bottlenecks.

Is an API key the same as a password?

Not quite. An API key mainly identifies the app or project making a request, while a password or token proves who a user is. You should still protect a key like a password, since Google warns that an exposed key can lead to unexpected charges or unauthorized access to your data.

Do I need to know how to code to use an API?

You use APIs every day without coding, through the apps on your phone and the sites you visit. To call an API directly, AWS describes the usual steps: get an API key by creating an account with the provider, set up an HTTP API client and follow the API's documentation to structure your requests.

What is API rate limiting?

Rate limiting caps how many calls a single client can make in a set period. IBM says it helps keep systems stable and available and also helps block denial-of-service and credential-stuffing attacks. Go over the limit and you'll typically get a 429 Too Many Requests response.

More in Cloud

Sources