0% completed
How API Design Shows Up in Interviews
On This Page
- The Four Formats
- Format One: The Dedicated API Design Round
Your opening
The failure specific to this format
- Format Two: API Design Inside a System Design Round
Your opening
Reuse the architecture without exposing it
The failure specific to this format
- Format Three: The API Critique Round
Your opening
Critique in the right order
The failure specific to this format
- Format Four: Interface Design Inside a Coding Round
Your opening
The failure specific to this format
- Which Companies Use Which Formats?
- A Real Contract in Ten Minutes
Minute 0 to 1: Name the caller and job
Minute 1 to 2: Name the resource and operations
Minute 2 to 7: Design creation completely
Minute 7 to 9: Address the hard parts
Minute 9 to 10: State the trade-off
Why two operations beat ten names
Key Takeaways
You may never receive an interview invitation titled API Design.
API design may be part of a system design interview, a product architecture discussion, an API review, or a coding exercise. Prepare for the decisions you need to make, not just the interview title. You are being asked to design a contract when you hear questions such as:
- "What would the client-facing API look like?"
- "Which operations would you expose?"
- "Review this API and tell me what you would change."
- "Design the interface first, and then implement one method."
All four test the same ability: can you decide what one program should promise to another?
Different formats allow different amounts of time and require different outputs. Adjust the scope of your answer. A detailed 60-minute answer will not fit into a 10-minute discussion.
1. The Four Formats
The diagram below gives example time allocations for preparation. These are not fixed company schedules. In some formats, API design is only part of a longer interview. Confirm the available time with the interviewer.
Two formats may allow only a short design discussion. For practice, allow 10 to 15 minutes for API design within a 45- to 60-minute system design or coding interview. Do not assume the entire session is available for API design.
The six-step method introduced in Lesson 1 and explained in Lesson 5 supports all four formats. Adjust the detail in each step and focus on the most important risks.
The four sections that follow add two things the diagram cannot show: the sentence you actually say to open, and the mistake specific to each format.
2. Format One: The Dedicated API Design Round
The entire session is about the contract. The question is broad, such as "Design a public API for a file-conversion service." The interviewer gives a short product description and then waits, expecting you to build structure out of an incomplete question.
A related interview may be called product architecture or product design. Ask whether you should also cover a data model and the client's sequence of API calls.
A dedicated round gives you time to use the complete six-step method, but not to describe every operation in equal detail. Keep requirements gathering focused so that you also have time for errors, compatibility, and design choices.
Your opening
Do not begin with GET, POST, or a database table. Begin with the caller:
"Before I define the operations, I want to identify the consumers and the two or three jobs the API must make easy. Is this for public developers, selected partners, internal services, or our own application?"
That sentence establishes that the caller drives the design, narrows the scope, and lets the interviewer reveal the intended direction. Then state your plan:
"I'll model the resources, list the core operations, design the most important write operation in detail, and then cover retries, authentication, and evolution."
This plan helps the interviewer follow your answer. It also gives you a clear order for the discussion, which can make explaining the design easier.
The failure specific to this format
Because the session is long, candidates fill it with breadth: every endpoint they can imagine, plus REST, GraphQL, and gRPC. Then no time is left to define a single request or a single error.
3. Format Two: API Design Inside a System Design Round
API design may be included within a system design interview. After discussing services, databases, queues, and scaling, the interviewer may ask:
"What does the API exposed to the client look like?"
The question tests whether the architecture you designed can be expressed as a usable product contract. The words endpoint and API are obvious signals. A request to trace one user action step by step is the same signal, without either word.
Your opening
Do not restart the interview by redrawing the architecture. Use the decisions already made as constraints:
"I'll focus on the contract between the mobile client and the service. The main flow is creating an order, so I'll list the few operations needed for that flow and then define order creation completely."
If the caller is unclear, ask one narrow question:
"Should I design this for the first-party mobile client or for public restaurant partners?"
When your organization owns the client, it can coordinate many changes with the server team. However, old mobile versions and other delayed updates still need support. External partner APIs also need clear compatibility rules, errors, limits, and setup instructions.
Reuse the architecture without exposing it
Internal design decisions should influence the API's behavior without requiring clients to understand internal component names or storage details.
Suppose your design uses a queue because video processing takes several minutes. The API should reflect asynchronous work through a job resource and a status operation. It should not expose the queue's name or require the caller to understand worker partitions. The contract communicates observable behavior; internal component names remain internal.
The failure specific to this format
A common mistake is to list only create, read, update, and delete operations, often called CRUD. This does not explain the product's behavior. User tasks such as publishing, reserving, cancelling, or approving need clear rules, even when they are represented using resource creation or updates.
4. Format Three: The API Critique Round
The contract already exists. Your job is to evaluate it, explain the consequences of its problems, and propose improvements. That is harder than designing a clean API from nothing, because this one already has callers.
You may receive a specification, documentation page, or code sample:
POST /api/doUserThing Content-Type: application/json { "action": "get", "userId": 42 }
{ "success": false, "message": "User not found" }
The failure is returned with status 200 OK. The operation is vague, the action field may choose between several unrelated behaviors, and the message is not stable enough for code to depend on. A strong critique still does not begin by rewriting everything.
Your opening
Before proposing changes, ask who calls this API today and whether you are allowed to make a breaking change. Then clarify the intended job: is the caller retrieving one user, searching for users, or performing several actions through one operation?
Those two questions prevent a common failure: proposing a better replacement that the company cannot deploy. If breaking changes are not allowed, you might add an operation, introduce a version, or improve the response additively. The same flaw can need a different repair, depending on what compatibility allows.
Critique in the right order
Review from highest impact to lowest:
- Caller and job: is the intended task possible without unnecessary work?
- Semantics: is it clear what the operation does and guarantees?
- Failures: can programs distinguish validation, authorization, absence, conflict, throttling, and server failure?
- Consistency: do names, shapes, pagination, and errors follow predictable patterns?
- Evolution: can fields and behavior change without breaking callers?
- Surface polish: are names and documentation clear?
This order keeps the critique connected to consequences. "I dislike this name" is an opinion. "This operation performs five unrelated actions, so permissions, retries, and errors change according to a string field" is a design argument.
Alongside the problems, give a revised design for the most important ones and a migration approach for current callers.
The failure specific to this format
Weak candidates search for violations of memorized rules: every noun plural, every update a PUT, no actions in URLs. Rules help consistency, but they are not the scorecard. Returning 200 OK for every outcome breaks retry logic and monitoring; singular against plural paths rarely matters. Treating both as equal shows you are checking style rather than caller impact.
5. Format Four: Interface Design Inside a Coding Round
API design does not always involve HTTP. The API may be a class, library, or typed interface used by another programmer, and you are asked to define it and then implement one part. You might hear "Design an interface for an in-memory cache, then implement put."
The interface is still a published contract: callers depend on method names, types, errors, and edge-case behavior. Do not spend the whole session designing. Leave time to write and explain working code.
interface Cache<K, V> { Optional<V> get(K key) void put(K key, V value, Duration ttl) boolean delete(K key) }
The signatures look simple, but the contract is still open. Does put replace an existing value, and does replacement reset the expiration? What does a non-positive ttl mean? Does get remove an expired entry or only behave as if it is absent? Is the cache safe for concurrent callers?
Your opening
State the observable behavior before choosing the data structure:
"Before I implement
put, I want to define replacement and expiration semantics because callers and tests will depend on them."
Then make a small set of explicit assumptions:
"I'll allow replacement, replacement will reset the TTL, a non-positive TTL will be rejected, and the first version will not promise thread safety unless that is required."
The interface leads; the data structure follows.
The failure specific to this format
Weak candidates immediately build a hash map, tree, or queue, then discover halfway through that they do not know what a duplicate, timeout, or missing value should do. This is the coding-round version of exposing the database schema as an HTTP API: the implementation is allowed to choose the contract. Strong candidates reverse that direction.
6. Which Companies Use Which Formats?
Interview formats vary by company and team. The diagram suggests areas to prepare for based on the kind of product. It is a preparation guide, not a prediction of a company's interview process.
Ask your recruiter which format and topics to expect. Phrases such as product architecture, API modeling, interface design, or developer experience may indicate that API design skills are relevant.
7. A Real Contract in Ten Minutes
A short segment is not permission to list vague operation names. It is a reason to reduce scope.
You have designed the architecture for a notification service. Ten minutes remain, and the interviewer asks:
"What API do application teams use to send notifications?"
Minute 0 to 1: Name the caller and job
"The caller is another internal product service. Its main jobs are to request one notification and check whether it was delivered. I'll focus on those two jobs."
Minute 1 to 2: Name the resource and operations
The main resource is a Notification, with two operations: POST /v1/notifications to create one and GET /v1/notifications/{notification_id} to read its state. Cancellation, bulk sends, and template management can be discussed if the interviewer asks.
Minute 2 to 7: Design creation completely
POST /v1/notifications Content-Type: application/json Idempotency-Key: 64d9b7a2-3b1c-4d62-9f44-a49e1e816610
{ "recipient_id": "usr_123", "template_id": "order_shipped", "channel": "push", "variables": { "order_id": "ord_456" }, "send_at": "<RFC 3339 UTC timestamp>" }
send_at is optional; if omitted, the notification is queued immediately.
HTTP/1.1 201 Created Location: /v1/notifications/ntf_789
{ "id": "ntf_789", "status": "queued", "created_at": "<RFC 3339 UTC timestamp>", "send_at": "<RFC 3339 UTC timestamp>" }
The server created the resource, so 201 Created is right even though delivery is asynchronous. The queued status tells the caller that creation is complete but delivery is not.
Name the main failures rather than saying "return an error":
| Status | Stable error code | Meaning |
|---|---|---|
400 Bad Request | invalid_template_variables | The variables cannot render the selected template. |
400 Bad Request | idempotency_key_reused | The caller reused the key with a different body. |
429 Too Many Requests | rate_limit_exceeded | The caller exceeded its creation rate. |
Every failure uses the same machine-readable structure with a stable code and a human-readable message. Include a field when the error concerns a particular field. Chapter 2 explains this structure in detail.
Minute 7 to 9: Address the hard parts
Delivery is asynchronous, so GET /v1/notifications/{id} returns queued, sending, delivered, or failed.
A request may time out after the server has accepted it. Within the documented key-retention period, the caller can retry with the same Idempotency-Key and body to receive the original result without creating another notification. The server must enforce this rule, including for concurrent retries. Rate-limit responses include a Retry-After header.
Minute 9 to 10: State the trade-off
"I chose a template-based API instead of accepting an arbitrary title and body. Templates make localization, branding, and validation consistent, but they give application teams less freedom. If ad hoc messages are a requirement, I would add them as a separately permissioned operation rather than weakening the default contract."
That statement exposes a real decision, its benefit, and its cost.
Why two operations beat ten names
An answer that lists create, read, update, delete, list, send, schedule, cancel, retry, and report operations is still incomplete. It does not explain the required inputs, the response, whether delivery happens immediately, or how errors are reported. These details demonstrate the design decisions.
A few operations designed completely show more than many operation names.
Design one important operation in detail first. If time remains, cover additional operations. This helps ensure that your answer includes at least one complete example.
Key Takeaways
- API design appears in four formats: a dedicated round, a segment inside system design, an API critique, and interface design inside a coding round.
- API design may occupy only 10 to 15 minutes of a longer session. Confirm the available time.
- Begin a dedicated round with consumers and jobs; in a system design segment, reuse the architecture and select one caller flow.
- In a critique round, ask who already uses the API and whether breaking changes are allowed before proposing a replacement.
- In a coding round, define observable interface behavior before choosing data structures.
- A ten-minute segment can still include a real request, response, failure model, retry decision, and trade-off, which is more informative than a list of endpoint names.
You can now identify an API design question even when the interview has a different title. The next lesson explains five skills that help you demonstrate a strong design, with examples of weak and strong answers.
Reading Progress
0%
On This Page
- The Four Formats
- Format One: The Dedicated API Design Round
Your opening
The failure specific to this format
- Format Two: API Design Inside a System Design Round
Your opening
Reuse the architecture without exposing it
The failure specific to this format
- Format Three: The API Critique Round
Your opening
Critique in the right order
The failure specific to this format
- Format Four: Interface Design Inside a Coding Round
Your opening
The failure specific to this format
- Which Companies Use Which Formats?
- A Real Contract in Ten Minutes
Minute 0 to 1: Name the caller and job
Minute 1 to 2: Name the resource and operations
Minute 2 to 7: Design creation completely
Minute 7 to 9: Address the hard parts
Minute 9 to 10: State the trade-off
Why two operations beat ten names
Key Takeaways