Say we’re planning a weekend in Sydney. We add the trip to an app, tap Saturday, and a weather forecast appears beside our itinerary. It feels like one app knew both things, even though the people who built the trip planner probably don’t run a weather service on the side.

A window cut through a thick stone wall. One room holds a map on a table and a rucksack; the other holds a brass instrument with a round dial beside a glass tube on a shelf.

The planner and the weather service are separate systems, and somebody has designed a narrow crossing between them. Following the forecast across that crossing and back is a useful way into making sense of APIs, because the whole idea lives in the handoff.

That crossing has a name. It’s an application programming interface, or API. It gives one piece of software an agreed way to ask another for information or an action. Picture a deliberately limited opening between two systems, with both sides clear about what can cross and how it should be expressed.

Caller Trip planner
Asks for Sydney on Saturday
Boundary Weather API Checks what was asked and who is asking
Back to caller Answer or problem
Sends back a forecast or explains what went wrong
The API gives the two systems one agreed place to meet without exposing everything behind it.

Where the two systems meet

The weather company doesn’t give the trip planner free access to its systems. That would be like cutting a doorway into the office and hoping every visitor only opens the right cupboard. A service window is a better shape. There’s a known place to ask, a limited set of things on offer, and an agreed way to pass the request across.

For this trip, the weather API might let another app ask for a forecast by giving a place and a date. It may also offer current conditions and weather warnings, while keeping its forecasting models, raw observations and administrative controls on the other side of the boundary.

That list of supported requests is part of the API’s contract. It tells the trip planner where it can ask, which requests the service understands, what details each one needs and what may come back. Documentation records the agreement for the people building on either side.

One request for our trip might be written as GET /forecasts?city=Sydney&day=Saturday. It looks like one solid line of code, but every piece has a fairly ordinary job.

The whole /forecasts?city=Sydney&day=Saturday part is the request target. It says where this request is headed. Inside it, /forecasts is the path to the forecast endpoint, the service window set aside for this job. The details after the question mark are query parameters, which narrow the request to Sydney and Saturday. GET is the method, the standard HTTP word for retrieving information.

The request may also carry headers, such as a credential or the data format the planner can read. Some requests include a body with the information the service needs to work on. Our forecast can fit its details in the address. A hotel booking needs more room, so its body might hold the dates, guests and room choice together.

The two systems can be built by different companies and in different programming languages, because neither side needs to understand everything inside the other. They only need to honour the part of the agreement that crosses the window.

Then we need a verb

Once the request has somewhere to go, it needs to say what it wants done there. That’s the job of the method. GET is one of the capital-letter names we keep meeting in error messages, product discussions and search results.

These names belong to HTTP, the protocol used by the web and by many APIs. APIs can use other protocols too, so GET and its companions are common API vocabulary, but they aren’t the whole idea of an API.

Our Sydney weekend gives each of the five familiar methods a job.

  • GET says “show us what’s here”. It reads something, such as Saturday’s forecast or an existing reservation. GET is meant to leave that thing unchanged, even though the service may still record that somebody asked.
  • POST says “here are some details for you to handle”. The planner might POST the details of a new hotel booking. Creating something is a common result, though POST can ask for other kinds of work too.
  • PUT says “make the whole thing at this address look like this”. If the planner stores our complete itinerary at one known address, a PUT can create it or replace the saved version in full.
  • PATCH says “change this part of what’s already there”. We might PATCH the itinerary to add a late-arrival note and leave the train, hotel and restaurant details alone.
  • DELETE says “remove what this address currently points to”. It doesn’t promise the data will be physically erased. The service might delete, archive or deactivate it, so the API’s contract still decides what DELETE means at that endpoint.
GET Check the forecast Retrieve what's available now
POST Request a booking Send details to be processed
PUT Replace the whole itinerary Send the complete new version
PATCH Add an arrival note Send only the change to make
DELETE Remove the itinerary Ask the service to remove it
The method tells the service what the planner wants to do. The endpoint and the API's agreement decide what it can do there.

There are other methods. HEAD asks for the same response information as GET without the body, and OPTIONS asks what kinds of communication an endpoint allows. We don’t need the whole set. Once the first five stop looking like arbitrary capital letters, most everyday API conversations get much easier.

Before the window hands anything over

Some APIs are open to anyone. Others give access to private information, cost money or allow changes that affect a real person. Before those services hand anything over, they need to know who’s asking and what that person is allowed to do.

For a forecast, the trip planner might send an API key that identifies its account with the weather service. If the request involved our private calendar, the connection might use OAuth, so we could give the planner limited permission to read particular information without handing over our calendar password.

This is where two similar words come in. Authentication checks who’s making the request. Authorisation checks what that caller is allowed to do. The weather service can recognise the trip planner perfectly well and still refuse something the planner doesn’t have permission to request.

The distinction matters because an API can offer actions as well as information. A booking service might let the planner read a reservation, change it, cancel it or issue a refund, and those actions shouldn’t automatically carry the same permission. The method says what kind of action is requested. The credential and the service’s rules decide whether this caller may request it.

Then something has to come back

The weather service receives our GET request, checks it and sends a response. Its status code gives the short version of what happened. Its body may carry the forecast or explain the problem. Response headers can add details, such as the body’s format or how long the planner may keep a saved copy before asking again.

If the request works, the body may contain a date, a temperature range, a description and a rain probability. The data often comes back as JSON, a text format that organises information into named fields. The planner doesn’t receive the polished card we see. It may receive a field called rain_probability with the value 0.62, and then choose to show a rain icon and “62% chance of rain” beside our Saturday plans.

The gap between that raw response and the weather card is easy to miss, because the finished screen looks so coherent. The weather service owns the forecast it returns. The trip planner owns how that forecast is explained, where it appears and what we can do next. A technically correct response can still make a confusing product if the app labels it badly, uses the wrong unit or hides an important warning.

Those three digits are the shortest version of the story

The reply needs a quick signal the planner can read before anything else. A status code does that job, and the fuller account belongs in the body.

Status codes arrive as three digits. The first digit places the response in a family, which gives the planner a broad idea of what happened even when it doesn’t recognise the exact code.

  • 1xx means the exchange is still in progress. Most of these stay below the surface of an ordinary app.
  • 2xx means the service received, understood and accepted the request. A 202 means the request has been accepted for processing, but the outcome isn’t known yet. The work may still be queued, running, or heading for failure.
  • 3xx means another step is needed, often because the target has moved or a stored copy can be used.
  • 4xx means the service couldn’t fulfil the request because of the request itself, its credentials, the thing being requested, or a rule such as a rate limit. These are often called “client errors”, but that doesn’t automatically make them the person’s fault.
  • 5xx means the service had a problem while handling a request that looked valid.

The exact number gives a more useful next step, so here are the ones that come up most often.

When it works

  • 200 OK can carry the forecast we asked for.
  • 201 Created can confirm that a POST or PUT produced a new reservation or itinerary.
  • 202 Accepted says the request has been accepted for processing but hasn’t finished.
  • 204 No Content says the request succeeded without a response body. That could follow a successful note update when the planner doesn’t need the note sent back.

When the request gets in the way

  • 400 Bad Request says the service found a problem with the request and couldn’t or wouldn’t process it.
  • 401 Unauthorized has a misleading everyday name. In HTTP it means the request lacks valid authentication credentials for that target.
  • 403 Forbidden means the service understood the request and refuses to fulfil it. A recognised account can still lack permission to cancel the reservation.
  • 404 Not Found means nothing exists at that address, or the service won’t reveal whether something does.
  • 405 Method Not Allowed means the method is understood but unavailable at this target. Trying to DELETE a forecast endpoint could produce this.
  • 409 Conflict means the request clashes with what’s already there. The room or itinerary may have changed since the planner last read it.
  • 429 Too Many Requests means the caller has exceeded a request limit for some period. The response may say how long to wait.

When the service has the problem

  • 500 Internal Server Error says something unexpected went wrong inside the service.
  • 502 Bad Gateway says the service was passing the request along and got an invalid response from another service further down the chain.
  • 503 Service Unavailable says the service can’t handle requests right now, often because it’s overloaded or under maintenance.
  • 504 Gateway Timeout says the service was passing the request along and didn’t hear back from the next service in time.

That gives a starting map, and we don’t need to learn it by heart. APIs can define other codes, and the same code can carry different details in its body. A useful response pairs the number with enough explanation for the planner to work out what happens next.

If we ask for a forecast beyond the service’s range, a 4xx response could explain the limit. The planner can show that message, instead of an empty box or a raw number when all we wanted to know was whether to pack a jacket.

A rejected request can still show the API working as designed. The weather service recognised that it couldn’t fulfil this request, and it returned enough for the planner to choose a path. The planner can still handle that explanation badly, which is one reason the exceptions so often become the job.

What if the booking worked but the answer got lost?

A response that says what went wrong is the clearest kind of failure. A timeout is harder. The planner stops waiting before any answer arrives, which tells us the reply didn’t come in time. It doesn’t tell us whether the booking service created the reservation before the connection failed.

Repeating our weather GET is usually sensible, because GET is defined as a safe request. It asks to read the forecast again. Repeating the same hotel POST could create a second reservation if the first one actually worked. Some APIs accept an idempotency key, a unique value that lets the service recognise a retry and keep it attached to the same intended booking.

That concern has a name, idempotency. A method is idempotent when sending the same request several times has the same intended effect as sending it once. GET and the other safe methods work this way. PUT and DELETE are also idempotent by their intended meaning. POST and PATCH aren’t automatically idempotent, although an API can design particular operations to handle repeats safely.

So after a timeout, the trip planner may retry a safe request, check whether the reservation now exists, reuse an idempotency key, or ask us before sending another action. “Try again” is a product decision about the method, the consequence and how much the app knows about the first attempt.

The crossing has to stay familiar

The weather company can improve its forecasting models without asking every trip planner to rebuild its app. The planner can redesign the itinerary without asking the weather company to change its response. Both sides can keep working independently, as long as the crossing still follows the agreement.

Problems begin when one side changes the crossing itself. If the weather service removes the rain field, renames it or changes its meaning, the planner may no longer know how to read the answer. If the booking service adds a required field to a POST, an older planner will keep sending requests that can no longer be processed.

Many APIs use versions or other compatibility rules, so the old agreement stays available while callers move to the new one. A change that feels tiny to the provider can break every product still relying on the earlier contract. That’s why changes to endpoints, fields and behaviour need care.

The boundary also makes the dependency easier to see. If the weather service is unavailable, slow or wrong, part of the trip planner is unavailable, slow or wrong. The app may look like one product to us, while its reliability depends on services the planner doesn’t control.

Sometimes the other side speaks first

Our forecast follows a common pattern. The planner asks and the weather service answers. Other exchanges begin differently, which is where two neighbouring ideas help.

A payment may take time to settle. The shop could keep asking whether its status has changed, which is called polling. With a webhook, the shop gives the payment service an address, and the payment service sends an update there when the event happens. The main difference is who starts the exchange.

MCP solves a different problem for AI applications. In an MCP setup, an AI agent can work through tools its host has made available. MCP gives the host a consistent way to discover and request those tools from an MCP server, and the server may then call an ordinary API to reach a calendar, a booking system or another service.

The model chooses from the tools it has been given. The host and MCP client carry that request to the server, so the model doesn’t need to learn every external API or call one directly. MCP isn’t the only way to connect an agent to an API, but it gives the connection a shared structure. It standardises the conversation between the AI application and the MCP server, while an ordinary API defines the server’s connection to the service behind it.

The questions become much more ordinary

Once an API is a boundary with an agreement around it, the useful questions are fairly ordinary.

  • What information or action has the other system made available?
  • Which endpoint and method match the job?
  • Which parameters, headers or body details does the request need?
  • Whose identity and permission travel with it?
  • Which status codes and response details tell the caller what happened?
  • Can this request be repeated safely if the response never arrives?
  • Who notices when the agreement changes or one provider starts failing?
  • What will the person using the product see when only one part of the chain is unavailable?

We don’t need to write code to take part in those decisions. The answers shape what a product can promise, which organisations it depends on, and what happens when a request fails.

Back in the trip planner, the result is still one small weather card beside one Saturday in Sydney. It looks simple because the app has hidden the handoff well. We can now see the journey inside it. An endpoint gave the request somewhere to go, GET said what the planner wanted, parameters narrowed the question, permission travelled with it, and a status code and a body carried the result home.

The same path can carry a hotel booking, a calendar event or a payment, with different methods and much larger consequences attached. An API is the agreement that lets those separate systems meet. Understanding the journey across that boundary is what lets us ask whether the handoff will still make sense when the request changes, the response fails, or one side stops behaving as expected.