APIs
After today, you can explain an API as a contract, read an entry in API docs, and spot a change that would break the apps relying on it.
Dip your toes 1 min
An API, short for application programming interface, is the agreed set of requests a company’s servers will answer for other programs. When you open Uber, the rider app asks the servers for your trip. They send back facts like the driver’s name and the minutes until pickup. The driver’s app and outside businesses ask the same servers for facts about the same trip. That makes it a contract: the servers can change anything behind it, but changing the API itself can break every app that relies on it. Rename the field that holds the minutes until pickup, and every rider app that hasn’t updated could show a blank where the countdown was.
The full lesson 10 min
Why this exists
Open Uber and request a ride. A car crawls toward you on the map, the arrival time ticks down, and the driver’s name and license plate appear. At the same moment, the driver’s phone shows your pickup pin in a different app. Somewhere else, a business might be booking a ride for a guest who has never installed Uber at all. Three programs, built by different teams, all need the same facts about the same trip.
None of them reaches into Uber’s databases to get those facts, for the reasons Day 6 gave. Instead, the backend publishes a fixed contract: the questions it will answer and the actions it will take. Every app asks through that contract, and only through it.
That contract is what lets dozens of teams work on one product without stepping on each other. The rider app team can redesign every screen without asking permission. The backend team can move to a new database without the apps noticing. Neither needs to know how the other side works, as long as both keep to the contract.
What it is
An API, short for application programming interface, is a defined set of requests one program accepts from others. It also defines the responses it promises in return. Engineers call it a contract.
The backend promises: send me this, in this shape, and I’ll send back that, in that shape. Every app that uses it promises to ask only in the agreed way. As long as both sides keep the promise, each can change everything else freely.
An API is made of endpoints. An endpoint is one address in the API that does one job. It’s written as an HTTP method plus a path. Day 9 covered methods and paths as parts of any request. An endpoint is the backend team’s decision about which combinations mean something.
Here’s a simplified, made-up trips API, shaped like Uber’s. GET /v1/trips/8f3a21 asks for one trip. POST /v1/trips asks for a new trip. DELETE /v1/trips/8f3a21 cancels one. Docs write the changing part as :id, a placeholder for any trip’s ID.
The rider app knows the four endpoints and nothing else. It doesn’t know which database holds trips or which language the backend is written in. That ignorance is the point. Each side depends only on the list in the middle.
Most web APIs follow a style called REST, which organizes endpoints around things, like trips and drivers, and uses the HTTP methods as verbs. There’s more here about REST and its alternatives, like GraphQL; you don’t need it yet.
Most web APIs send their data as JSON, short for JavaScript Object Notation. JSON is plain text made of named fields and their values, grouped with curly braces. A response for one trip from that made-up API might look like this:
{
"id": "8f3a21",
"status": "driver_arriving",
"eta_minutes": 4,
"driver": { "first_name": "Ana", "photo_url": null },
"vehicle": { "make": "Toyota", "plate": "7KDR412" }
}
Each line is a fact the screen can use. The arrival time, eta_minutes, is a plain number rather than a ready-made phrase. The API sends facts, and each app decides how to word and draw them. So the rider app can show four minutes as a countdown, while a booking page elsewhere shows a clock time. The photo field, photo_url, is null, an empty value, because this driver never uploaded a photo.
Teams describe their endpoints in API reference docs. Uber publishes some for outside companies: its Guest Rides API lets a business request rides for people who don’t have an Uber account.
Reference pages look alike from company to company, because they all answer the same four questions. What do I call? What do I send? What comes back? What can go wrong?
You can read an entry like this without reading code. Start with the method and path, which tell you whether the endpoint reads something or changes it. Then read the parameters, the inputs the endpoint needs.
The response matters most to a designer, because it lists every field this endpoint returns. A field that can be null can arrive blank, and each one is a state your design has to cover. The errors section lists what can fail, each with its status code from Day 9.
You’ll also hear “API” used more broadly. Browsers offer APIs to JavaScript, like one for asking where the device is. Phone operating systems offer APIs to apps, like one for the camera. In a product meeting, though, “the API” almost always means the web API your backend offers to your own apps.
How it shows up in your work
Design reviews come first. When you add a line to a screen, someone has to find where that fact comes from. If the field is already in the response, showing it is frontend work, often small. If it isn’t, the backend has to add it, and that means changing the contract.
“Is that in the API?” is one of the most useful questions you can ask while a design is still rough. It turns a vague sense of cost into a specific one.
Handoffs are where the contract earns its keep. Frontend and backend work often runs in parallel. The two sides agree on the contract first. Then the frontend builds against a mock, a stand-in backend that returns sample responses in the agreed shape.
Mock data tends to be tidy, like Day 5’s staging data: short names, every photo present, one stop per trip. Real responses aren’t tidy. Ask to see sample responses with a very long name, a missing photo, and a trip with three stops, and design for those.
Once both sides finish, the frontend points at the real API instead of the mock. If the contract held, the swap is small. If either side quietly changed it, this is where the surprise lands.
The contract also settles bug threads. When a screen shows the wrong thing, engineers often check the API response before anything else. If the response is right, the bug is in the app. If the response is wrong, the bug is in the backend.
Browsers show every response in their developer tools, so this check takes seconds. Asking “was the response right?” in a bug thread gets the bug to the right team faster.
The one thing people get wrong
It’s tempting to file the API under the backend team’s private business, something that changes whenever the backend changes. It’s the opposite. The backend can rebuild everything behind the API without telling anyone. The API itself is shared, and every app that calls it depends on it, including apps the backend team doesn’t control.
Say Uber’s backend renamed eta_minutes to eta to tidy things up. A new rider app, written for the change, would work. Older copies of the rider app, still on phones that haven’t updated, would look for eta_minutes, find nothing, and show a blank. The driver app would break the same way. A partner’s system, built by another company on its own schedule, would break too.
A change like this is a breaking change: one that makes existing apps stop working. Removing a field, renaming one, or changing its type are all breaking changes. So is making an optional input required. Design systems have the same problem. In a design system, a component’s properties are the designer’s own API, and removing or reworking one touches every file that uses it.
Adding a field is usually safe, because older apps ignore fields they don’t recognize. A new value in an existing field is different, and designs often cause it. A new trip status, say, can blank or crash older apps that don’t know it. The difference between adding and removing shapes how teams evolve APIs. They add new fields freely and remove old ones slowly, often months later, after checking that nothing still reads them.
Phone apps stretch that wait. A team can’t force every user to install an update, so old versions keep calling the API long after a release. When a break can’t be avoided, teams use API versioning: running an old and a new version of the API side by side. Often the version sits in the path, like the v1 in Uber’s /v1/guests/trips. Stripe, the payments company, names its API versions by date, and each customer’s account stays on its chosen version until that customer’s team upgrades.
Versioning costs real effort, because the backend team now keeps two contracts working. That cost is why a field rename that looks cosmetic in a design review can turn into a migration plan with a deadline. It’s also why a backend engineer’s first question about your redesign is often about what else reads the data.
When a team does plan to retire a field or a version, it announces a deprecation first. Deprecated means still working, but scheduled to go away, usually with a date. Partners get emails and warnings in the docs. Mobile teams watch how many people still run old app versions before they switch anything off. If you see “deprecated” in a ticket or a changelog, read it as a countdown that someone is managing.
Ask an engineer this
“Which other apps or partners call the endpoint behind this screen, and how would we change it without breaking them?”
Ask when a redesign changes what data a screen shows, before the work gets estimated. The engineer should be able to name the endpoint and every app that calls it, like a partner or an older app version. Then check whether your change only adds fields, which is usually cheap, or removes and renames them, which isn’t. If they say only the web app uses it, ask how they know. A team that tracks who calls each endpoint can answer in seconds, and that speed shows how safely it can change things.
Terms from today
- API
- Short for application programming interface: a defined set of requests one program accepts from other programs, and the responses it promises to send back.
- Endpoint
- One address in an API, written as a method plus a path, that does one specific job, like fetching a single trip.
- JSON
- Short for JavaScript Object Notation: a plain-text format of named fields and values that most web APIs use to send data.
- Breaking change
- A change to an API that makes existing apps relying on it stop working, like renaming or removing a field.
- API versioning
- Running an old and a new version of an API side by side, so existing apps keep working while new ones move to the changed version.