Designing the API in Five Minutes

Topics Covered

Why the API Comes Early

From requirements to calls

What interviewers learn from the API

What the API is not

Choosing a style

How long to spend

The API and the data model together

Saying it out loud

A short example exchange

An example of the step going wrong

The API as a contract with the interviewer

What Each Call Needs

Action and resource

Who is calling

Key inputs

Key outputs

Status and errors

Media and large payloads

Versioning and compatibility

Common mistakes

A compact notation

When the interviewer asks for more

Calls for actions that touch several resources

Reads that combine data

Filtering and sorting parameters

The Decisions Interviewers Care About

Pagination

Idempotency

Synchronous or asynchronous

Real time delivery

Rate limiting

Choosing which to mention

How these connect to the rest of the design

A sample exchange on pagination and idempotency

Combining the decisions

Examples Across Problem Types

A social feed

A chat application

A booking or ticketing system

A data pipeline or metrics system

A public developer API

Patterns across the examples

Reading the interviewer's interest

A note on internal APIs

Avoiding the over designed API

A URL shortener

A file storage and sync service

A collaborative document editor

What the examples have in common

Keeping the API Step Tight

A three part routine

When to skip or shorten

When to expand

Recovering from a drift

Handing over to the data model

Handing over to the high level design

Common feedback from interviewers

Practising the step

What a strong API step sounds like

The API as a running reference

Questions to ask yourself before leaving the step

How the API changes with level

A final check on scope

After requirements and a quick estimate, most strong candidates sketch the API before drawing boxes. It takes about five minutes in a forty five minute round, and it does more work than its size suggests. The API turns the functional requirements into a precise list of operations. It fixes what each operation takes and returns, which tells you what the data model must store and what the services must compute. It also surfaces questions that would otherwise appear late and awkwardly: who is the caller, what happens when a request is retried, how a long list is paged.

This lesson covers how to derive the API from requirements, what details to include and what to leave out, the handful of design choices interviewers care about, and how to keep the whole step short.

From requirements to calls

The functional requirements you agreed are the source of the API. Each core requirement becomes one call, sometimes two. Upload a photo becomes a call that creates a photo. View the feed becomes a call that returns a page of feed items. Follow a user becomes a call that creates a follow relationship. If you find yourself writing a call that does not trace back to a requirement, it can usually wait until later in the interview, or until the interviewer asks for it.

Each core requirement becomes one call.

This tracing has a useful side effect. It checks the requirements. If a requirement does not produce a clear call, it may be too vague, and you can tighten it now. Users can see popular content is not yet a call. Users can request the top twenty trending posts in their region for the last hour is. Writing the API forces that precision.

What interviewers learn from the API

An API sketch tells the interviewer several things at once. It shows that you think about the system from the client's point of view, which is where every requirement starts. It shows whether you understand the difference between reading and writing operations, and which ones need special care. It shows whether you know the standard techniques, cursor pagination, idempotency keys, asynchronous jobs, and apply them where they matter. And it shows whether you can be concise: a good API sketch is five or six lines, not a page.

What the API is not

The API in a design interview is not a full specification. You do not need every field, every error code, every header or a formal schema. You do not need to debate whether a path should be plural or singular, or whether to use PUT or PATCH for an update. Interviewers rarely care, and the time is better spent elsewhere. The API is a contract sketch: enough to make the operations concrete and to drive the data model. If the interviewer wants more detail on one call, they will ask, and that call often becomes a small deep dive.

Choosing a style

Most candidates write the API as REST style calls, a method and a path, because they are compact and widely understood. That is a sensible default. For internal service to service calls, a remote procedure call style such as gRPC is common and fine to mention. For clients that need flexible queries across many related objects, a query language such as GraphQL can be appropriate. For real time features, you also need a push channel such as WebSockets or server sent events. The choice of style rarely matters much in the interview. What matters is that the operations are clear. If you have no strong reason to choose otherwise, use REST style and move on. If you do choose something else, give the reason in one sentence: the mobile client needs to fetch posts, authors and comment counts in one round trip, so a GraphQL style query fits.

How long to spend

Five minutes is a good target for the API in a forty five minute round, often less. Write the three to five core calls, note one or two cross cutting decisions such as pagination and idempotency, and move on. If the problem is itself about an API, such as a rate limiter, a public developer platform or a payments interface, spend more, because the interface is the core of the design. If the problem is mostly about data flow, such as a metrics pipeline, the API can be a single line for ingestion and a single line for queries.

The API and the data model together

The API and the data model are two views of the same decisions. Each call reads or writes some entities, so writing the calls tells you which entities exist and which fields they need. Many candidates write the two side by side or in quick succession. The order matters less than the connection. A call that returns a feed of posts with author names and like counts tells you that the data model must provide those fields efficiently, which might mean storing the author name with the post or maintaining a counter. Noticing that connection early saves rework later.

Saying it out loud

As you write each call, say what it does in a sentence and what is notable about it. POST photos creates a photo; the client uploads the bytes directly to storage with a presigned URL, so this call only carries metadata. GET feed returns twenty items at a time with a cursor, because the feed changes while the user scrolls. These short sentences make the API easy to follow and put your design reasoning on record. They also give the interviewer natural places to ask a follow up question.

A short example exchange

Interview Dialogue

CandidateI will sketch the API before the boxes. Three calls cover the core requirements. POST photos with a caption, which returns a photo ID and an upload URL. GET feed with a cursor, which returns twenty items. POST follow for a user ID.
InterviewerClick to reveal answer
CandidateFrom the auth token. The server never trusts a user ID in the body for the caller, only for the target, such as who to follow.
InterviewerClick to reveal answer
Show all answers

In under a minute, the candidate traced calls to requirements, handled media separately and answered a security question cleanly. That is the level of detail the step needs.

An example of the step going wrong

A weaker candidate, given the same photo sharing prompt, skips the API and starts drawing a load balancer, a photo service and a database. Ten minutes later, the interviewer asks how the feed is paged and how uploads reach storage. The candidate improvises: the client sends the photo to the photo service, which saves it. Now the bandwidth estimate from earlier contradicts the design, because terabytes a day would flow through the application servers. The feed question leads to offset pagination, and the interviewer asks what happens when new posts arrive while a user scrolls. Each answer is a small repair. None is a disaster, but together they make the design feel improvised rather than reasoned. Five minutes of API at the start would have surfaced all of these questions when they were cheap to answer.

The API as a contract with the interviewer

There is one more benefit to writing the API early. It gives you and the interviewer a shared, precise statement of what the system does. Once it is on the board, disagreements become specific. Instead of a vague exchange about whether the system supports editing, you can point at the calls and ask whether an edit call belongs in scope. Instead of a debate about consistency in general, you can ask what GET feed should return immediately after POST photos succeeds. Precise questions get precise answers, and the interview moves faster for it.

A few minutes of precision here pays for itself many times over in the rest of the session, because every later step builds on the same short list of operations.

Trace every call to a requirement

Write one call per core requirement and say which requirement it serves. Calls that do not trace to an agreed requirement can wait. This keeps the API short and checks that the requirements are concrete enough to build.

A good API sketch gives each call just enough detail to be unambiguous: the action and resource, who the caller is, the key inputs, and the key outputs. This section goes through each part and the common mistakes in each.

Action and resource

The method and path together say what the call does to which resource. POST /photos creates a photo. GET /photos/:id reads one. GET /users/:id/photos lists one user's photos. DELETE /photos/:id removes one. Keep the paths about resources, not about actions. POST /photos is clearer than POST /createPhoto, though interviewers will not mark you down for either. For actions that do not map cleanly onto a resource, such as follow or like, either model the relationship as a resource, POST /users/:id/followers, or use a short action path, POST /users/:id/follow. Both are fine. Pick one and be consistent.

A good call names the resource, the caller and what comes back.

Who is calling

Almost every call is made by an authenticated user, and the identity comes from an authentication token, such as a bearer token in a header, not from a parameter the client sets. This matters. If the caller's user ID were in the request body, any client could act as any user by changing it. Say this once: all calls are authenticated, and the caller comes from the token. Then you can leave it out of each individual call. Parameters that name other users, such as who to follow or whose profile to view, are of course still in the request.

Some calls are made by other services rather than users, such as a payment provider calling a webhook. Those need their own authentication, for example a signature on the request. If such a call appears in your design, mention how it is verified.

Key inputs

List the inputs that matter for the design, not every field. For creating a post, the text and any media references. For a search, the query, filters and pagination. For a payment, the amount, currency, payment method and an idempotency key. If an input has an important constraint, such as a maximum length or allowed values, mention it only if it affects the design. A two hundred and eighty character limit on posts affects storage estimates; a maximum username length does not.

Key outputs

The response should return what the client needs next. A create call usually returns the ID of the new resource and its status. A list call returns a page of items and a cursor for the next page. A call that starts slow work returns a job ID and a status. Think about what the client will do with the response. If the client will immediately show the new post in the feed, the response should include the fields needed to render it, so the client does not need a second call.

Status and errors

You do not need to list every error code. Mention errors only where they shape the design. A conflict response when a seat is already taken in a booking system matters, because it tells the client to choose another seat. A rate limit response with a retry after header matters in a public API. A generic bad request for invalid input does not need to be mentioned at all.

Media and large payloads

Large binary payloads, such as photos, videos and file uploads, should rarely pass through your application servers. The usual pattern is that the client asks the API for an upload URL, the API returns a presigned URL to object storage, the client uploads the bytes directly to storage, and then the client tells the API the upload is complete, or storage notifies the API. This keeps large transfers off the application tier, which is a decision your bandwidth estimate probably already justified. In the API sketch, show it as two calls or one call that returns an upload URL. Mentioning it is a small but clear signal of experience.

Versioning and compatibility

For public APIs or mobile clients that update slowly, versioning matters, because old clients keep calling old shapes for months. A short note is enough: the path includes a version, and fields are only added, never removed or renamed, so older clients keep working. For internal APIs between services you own, this is less important. Mention versioning only if the problem involves external developers or long lived clients.

Common mistakes

The first common mistake is putting the caller's identity in the body. The second is designing calls that return everything: GET /users/:id returning the user's entire history of posts, followers and messages. Responses should be bounded, with lists paginated. The third is forgetting the response entirely, writing POST /orders with no indication of what comes back. The fourth is too much detail: spending five minutes on field names and types while the architecture is not yet drawn. The fifth is inventing calls that no requirement needs, such as admin and analytics calls in a prompt that never mentioned them.

A compact notation

A compact way to write each call on the board is one line: method, path, key inputs in parentheses, and an arrow to key outputs. POST /orders (items, address, Idempotency-Key) arrow order_id, status. GET /feed (cursor, limit) arrow items, next_cursor. This notation is fast to write and easy to read, and it leaves enough room on the board for the rest of the design. Some candidates write full JSON bodies; that takes longer and adds little in most interviews.

When the interviewer asks for more

Sometimes the interviewer wants more detail on one call, usually because it is central to the problem. In a payments design, they might ask exactly what the charge call takes and returns, and how it behaves on retries. Treat that as a signal that this call is worth a deeper look, and go into it carefully: fields, idempotency, error cases, and what is stored when. That deeper look is a deep dive, and it will often save time later, because the data model and the failure handling follow from it directly.

Calls for actions that touch several resources

Some operations touch several resources at once: placing an order reserves stock, charges a card and notifies a restaurant. Resist the urge to expose each step as a separate client call that the client must sequence. The client should make one call, place this order, and the server should coordinate the steps. Exposing the internal steps to the client makes the client responsible for failure handling it cannot do well, such as undoing a charge when stock runs out. Keep the public API at the level of user intentions, and handle the coordination inside the system, where you can make it reliable.

Reads that combine data

Similarly, a read that the client needs as a single screen should usually be a single call. A post detail page might show the post, its author, the like count and the first comments. Requiring four calls from a mobile client on a slow network adds latency. A single call that returns what the screen needs, assembled on the server, is usually better. This does not mean returning everything. It means returning what the screen needs, bounded and paginated where it can grow. Mentioning that a call is shaped by the screen it serves is a small sign that you think about the client experience, which interviewers at product focused companies notice.

Filtering and sorting parameters

List calls often take filters and a sort order: photos by a user, orders in the last week, restaurants within five kilometres sorted by rating. Include the filters the requirements need and no more. Each filter you include implies an index or a precomputed view in the data model, so a long list of optional filters is a promise to support many access patterns efficiently. If the requirements only need a user's photos newest first, say so, and leave arbitrary sorting for later. Interviewers often probe this point, because it connects the API directly to the cost of the storage layer.

Never trust the caller ID in the body

The caller's identity comes from the authentication token. If the API accepts a user ID in the request body for the caller, any client can act as any user. Say once that all calls are authenticated and the caller comes from the token.

Most of the API is routine. A few decisions are not, and they are what interviewers listen for. This section covers the five that come up most often: pagination, idempotency, synchronous versus asynchronous calls, real time delivery and rate limiting.

Pagination

Any call that returns a list that can grow needs pagination. There are two common styles. Offset pagination asks for items twenty one to forty, using an offset and a limit. It is simple, and it lets a client jump to page five. But it has two problems. When new items arrive at the top of the list while the user is scrolling, the offset shifts, so the user sees duplicates or misses items. And for large offsets, the database must skip over many rows, which gets slow.

Cursor pagination stays correct while new items arrive.

Cursor pagination instead returns an opaque cursor with each page, encoding where the page ended, for example the timestamp and ID of the last item. The next request asks for items after that cursor. New items at the top do not affect it, and the database can seek directly to the position using an index. For feeds, timelines, chat history and most user facing lists, cursor pagination is the right default. Say so briefly: the feed uses cursor pagination, because it changes while the user scrolls. Offset pagination is still fine for small, stable lists such as an admin table.

Idempotency

A network request can fail in a way that leaves the client unsure whether it succeeded. The request reached the server and was processed, but the response was lost. If the client retries, a non idempotent operation such as charge this card or create this order might happen twice. For many operations that is a serious bug.

Retries are safe when the server remembers the key.

The standard fix is an idempotency key. The client generates a unique key for each logical operation and sends it with the request. The server records the key with the result. If a request arrives with a key it has seen, it returns the stored result instead of doing the work again. Mention idempotency keys for any write a client might retry where duplication matters: payments, orders, bookings, messages. Reads and naturally idempotent writes, such as setting a field to a value, do not need them.

Interviewers often follow up by asking how long keys are kept and where. A reasonable answer is that keys are stored with the result for a window such as twenty four hours, in the same database transaction as the write if possible, so the write and the key are recorded together.

Synchronous or asynchronous

Some operations take too long to complete within a request: transcoding a video, generating a report, sending a large batch of notifications, running a complex analysis. For these, the call should accept the request, start the work in the background and return immediately with a job ID and a status such as pending. The client then checks the status later, or is notified when the work completes.

Slow work returns a job, not a result.

This pattern keeps request latency low and decouples the API from slow work, which can then be queued, retried and scaled independently. In the API sketch, show it with a status code that means accepted, a job ID in the response and a way to learn the result, either a status call or a notification. Recognising which operations should be asynchronous is a clear signal of design judgment.

Real time delivery

If a requirement says users see something as soon as it happens, a new chat message, a ride's location, a collaborator's edit, the API needs a way for the server to push updates. There are three common options. Short polling, where the client asks every few seconds, is simple but wasteful and adds delay. Long polling, where the request waits until there is new data or a timeout, reduces waste and delay. A persistent connection, such as a WebSocket or server sent events, lets the server push immediately.

Choose how the server tells the client something changed.

For chat, collaboration and live tracking, a persistent connection is the usual choice. For notifications that can arrive within a minute, polling or mobile push notifications may be enough. Say which you choose and why, tied to the latency requirement. Persistent connections also have design consequences: connection servers hold state, need to be scaled differently and need a way to route a message to the server holding a given user's connection. That often becomes a deep dive.

Rate limiting

Public APIs, and many internal ones, need rate limits to protect the system from abuse and from runaway clients. In the API sketch, a short note is enough: calls are rate limited per user, and exceeding the limit returns a too many requests response with a retry after header. If the problem is a public developer platform or an abuse sensitive feature such as login or messaging, rate limiting may deserve more attention. Otherwise, a sentence shows you have thought of it.

Choosing which to mention

Not every problem needs all five. A photo sharing app needs cursor pagination and direct uploads, probably idempotent post creation and perhaps asynchronous processing for thumbnails. A chat app needs a persistent connection, idempotent message sends and cursor pagination for history. A payments system needs idempotency above everything. A URL shortener needs very little: create a link, redirect, perhaps rate limiting. Mention the decisions that matter for this problem, and skip the rest.

How these connect to the rest of the design

Each of these decisions has consequences beyond the API. Cursor pagination needs an index on the sort key. Idempotency keys need storage and a retention policy. Asynchronous jobs need a queue and workers. Real time delivery needs connection servers and a routing layer. Rate limiting needs a fast shared counter. Mentioning a decision in the API and then following it into the architecture is exactly the kind of coherence interviewers look for.

A sample exchange on pagination and idempotency

Interview Dialogue

InterviewerClick to reveal answer
CandidateThe feed changes while the user scrolls. With page numbers, a new post at the top shifts everything down, so page two repeats the last item of page one. A cursor encodes the last item seen, so the next page starts exactly after it, and the database can seek to it with an index on time and ID.
InterviewerClick to reveal answer
CandidateI would use a client generated post ID. On a flaky mobile network, the client may resend, and we do not want two identical posts. If the server sees the same ID again, it returns the existing post.
Show all answers

Both answers are short, tied to a concrete failure and lead naturally to the data model. That is the shape interviewers want for each of these decisions.

Combining the decisions

These decisions often appear together in one call. A message send in a chat app is idempotent through a client message ID, returns quickly, and triggers a push over the recipient's open connection. A video upload uses a presigned URL, returns a job, and notifies the client when transcoding finishes. Describing how the decisions combine for the most important call is a compact way to show you understand all of them.

API judgment by level

Mid level candidates write clear calls with pagination. Senior candidates add idempotency where retries could duplicate work, choose asynchronous jobs for slow operations and pick a real time transport from the latency requirement. Staff candidates also discuss versioning for long lived clients, abuse controls and how the API will evolve as the product grows.

The same few principles apply to every API, but what matters most varies with the problem. This section sketches the API for four common prompt types and points out the decision that matters most in each.

A social feed

Core calls: create a post, read the feed, follow a user, like a post. POST /posts (text, media_ids) arrow post_id. GET /feed (cursor) arrow items, next_cursor. POST /users/:id/follow. POST /posts/:id/likes.

The decisions that matter are cursor pagination for the feed and direct uploads for media. Likes are naturally idempotent if they are modelled as a set, so a retry does not double count, which is worth one sentence: a like is a membership, not a counter increment, so repeating it changes nothing. That one sentence also hints at how the data model should store likes.

A chat application

Core calls: send a message, fetch conversation history, receive new messages in real time. POST /conversations/:id/messages (text, client_message_id) arrow message_id, timestamp. GET /conversations/:id/messages (before_cursor) arrow messages. A WebSocket connection that receives new messages, typing indicators and read receipts.

The decisions that matter are the real time transport and idempotent sends. The client generates a client message ID so that a resend after a network drop does not create a duplicate message, and the server returns the stored message if it sees the same ID again. History uses a cursor that pages backwards in time. Saying that the WebSocket is for delivery, while sends go over a normal request so they can be acknowledged and retried, is a mature distinction.

A booking or ticketing system

Core calls: search availability, hold a seat, confirm a booking, cancel. GET /events/:id/seats arrow seats with status. POST /events/:id/holds (seat_ids) arrow hold_id, expires_at. POST /bookings (hold_id, payment_method, Idempotency-Key) arrow booking_id, status. DELETE /bookings/:id.

The decisions that matter are the hold with an expiry and idempotent confirmation. The hold reserves seats for a few minutes while the user pays, and returns a conflict if a seat is already held. Confirmation must be idempotent because it involves payment. Splitting hold and confirm into separate calls is the key insight. It turns a long, risky operation into two short ones, with a clear failure mode for each.

A data pipeline or metrics system

Core calls: ingest events and query aggregates. POST /events (batch of events) arrow accepted. GET /metrics (name, filters, start, end, granularity) arrow series.

The decisions that matter are batching and asynchronous acceptance. Ingestion accepts batches of events rather than one at a time, returns as soon as events are durably queued rather than after they are processed, and may drop or sample under extreme load if the requirements allow it. Queries specify a time range and granularity, which tells the data model to keep pre aggregated rollups. Here the API is short, but each choice has large consequences for throughput.

A public developer API

If the prompt is to design an API for external developers, such as a payments or messaging platform, the API itself is the product, and you should spend more time on it. Beyond the core calls, discuss authentication with API keys or OAuth, rate limits and quotas per customer, idempotency for every write, versioning so old integrations keep working, webhooks to notify developers of events, with signatures so they can verify them and retries with backoff when their endpoint is down, and clear error responses. In this kind of problem, these topics are the design, not side notes.

Patterns across the examples

A few patterns repeat. Lists that grow use cursors. Writes that involve money, inventory or messages use idempotency keys or client generated IDs. Large media goes directly to object storage. Slow work returns a job. Real time delivery uses a persistent connection or mobile push. Calls that reserve scarce resources split into a hold with an expiry and a confirmation. If you recognise which of these patterns a prompt needs, the API almost writes itself in a couple of minutes.

Reading the interviewer's interest

Watch which call the interviewer asks about. If they ask how the confirm booking call handles a payment failure, they are interested in correctness and failure handling, and that is likely to be a deep dive. If they ask how the feed call stays fast, they are interested in caching and fan out. If they ask about the WebSocket, they are interested in connection management. The API is often where the interviewer first signals which part of the problem they care about most, so listen carefully during this step and plan the rest of the session around what you hear.

A note on internal APIs

In larger designs, services call each other as well as being called by clients. You usually do not need to sketch internal APIs in detail. It is enough to say which service calls which and whether the call is synchronous or through a queue. If one internal call is critical, such as the payment service calling an external provider, it may deserve the same care as a public call, with timeouts, retries and idempotency. Mention that when you reach the relevant part of the high level design rather than during the API step.

Avoiding the over designed API

A final caution applies to all of these examples. It is easy to add calls for every possible feature, edit, delete, report, share, archive, admin, until the API is a page long. Each call is cheap to write, but together they consume time and attention that the architecture needs. Stick to the calls the agreed requirements demand and mention the rest in a sentence: there would also be edit and delete calls, which follow the same pattern. That single sentence shows awareness without the cost.

A URL shortener

Core calls: create a short link and follow one. POST /links (long_url, optional custom_alias, optional expiry) arrow short_code. GET /:short_code arrow a redirect to the long URL.

The decisions here are small but worth a sentence each. The redirect should be a temporary redirect if you want to count clicks, because browsers cache permanent redirects and later visits never reach your servers. Custom aliases need a uniqueness check and return a conflict if taken. Creating links should be rate limited per user to stop abuse. The redirect path is the hot path, read at a hundred times the rate of creation, so it is where caching belongs. The whole API takes thirty seconds, and the time saved goes to the code generation scheme and the cache.

A file storage and sync service

Core calls: upload a file, download a file, list changes since a point in time, share a file. The decisions that matter are chunked uploads, so a large file can resume after a dropped connection, and a changes call with a cursor, so each device can ask what has changed since it last synced. POST /files/:id/chunks with a chunk index and hash lets the client upload only missing chunks. GET /changes (cursor) arrow changes, next_cursor gives each device an efficient sync loop. These two choices shape the whole design, because they decide how files are stored as chunks and how a change log is kept per user. Naming them in the API step means the data model and the deep dive both follow naturally.

A collaborative document editor

Core calls: open a document, send edits, receive other people's edits, and list version history. GET /documents/:id returns the current content and a version number. Edits flow over a WebSocket as small operations tagged with the version they were based on, and the server broadcasts transformed or merged operations to the other editors. GET /documents/:id/versions (cursor) lists history. The decisions that matter are the persistent connection and the versioned operations, because together they determine how concurrent edits are ordered and merged, which is almost always the deep dive in this problem. A later lesson works through this design in full.

What the examples have in common

In every one of these examples, the API took two or three minutes, and in every one a single decision stood out as the thing the rest of the design depended on. Finding that decision is the real skill of this step.

Split scarce resources into hold and confirm

When a call reserves something scarce, such as a seat, a room or stock, split it into a hold that expires after a few minutes and a confirmation that takes payment. Each step is short, conflicts are reported early and an abandoned checkout releases the resource automatically.

The API step is short, which makes it easy to get wrong in two opposite ways: skipping it entirely or letting it swallow ten minutes. This section covers how to keep it tight, how to recover if it drifts, and how it hands over to the next step.

A three part routine

A reliable routine has three parts. First, write one line per core requirement in compact notation: method, path, key inputs, key outputs. Second, add one or two lines for cross cutting decisions: all calls authenticated with the caller from the token; lists use cursor pagination; writes that matter carry idempotency keys; slow work returns a job. Third, say which call you expect to be the hardest, because it often previews the deep dive. That whole routine takes three to five minutes.

Five lines on the board are enough.

When to skip or shorten

Some interviewers prefer to go straight to the architecture. If the interviewer says skip the API, or signals impatience, compress the step to a single sentence listing the operations and move on. The operations still need to be clear, but they can be stated rather than written. You can return to a specific call later if it becomes important. Similarly, for problems where the interface is trivial, such as a URL shortener with two calls, the API takes thirty seconds.

When to expand

Expand the API step when the interface is the core of the problem: a public developer platform, a payments API, a rate limiter, a notification service with many channels. In these problems, the interviewer is often more interested in the contract than the internals. Spending ten minutes on authentication, idempotency, error semantics, webhooks and versioning is then the right call, and you should say so: since the API is the product here, I will spend a bit longer on it.

Recovering from a drift

If you notice that the API step has run long, perhaps you got drawn into field names or a debate about REST conventions, stop and summarise. Let me pull back. These are the four calls, the feed uses cursor pagination and orders are idempotent. I will move to the data model now. A quick summary closes the step cleanly and shows that you are managing time, which is itself evidence the interviewer records.

Handing over to the data model

The API hands over directly to the data model. Look at each call and ask what entities it reads and writes, which fields it needs and how it will look them up. GET /feed with a cursor needs feed items sorted by time for a user. POST /follow needs a follow relationship that can be queried in both directions, who I follow and who follows me. POST /bookings needs bookings linked to holds and payments. Saying those needs out loud as you move on gives the data model step a running start.

Handing over to the high level design

The API also tells you which services you need. Calls that share data and scaling characteristics usually belong together; calls with very different load or very different failure modes may belong apart. The feed read path is read heavy and latency sensitive, while posting is write light, so they might be separate services or at least separate paths. The WebSocket connections need their own tier. These observations make the high level design feel like a natural consequence of the API rather than a fresh start.

Common feedback from interviewers

Interviewers who mark candidates down on the API usually cite one of a few things. The API was missing, so the design had no clear operations. The API was too long, crowding out the architecture. Writes involving money or inventory had no protection against retries. A changing list used offset pagination without considering the problems. Large media passed through application servers without comment. Each of these is easy to avoid with the routine above, which is why a short, deliberate API step is such good value.

Practising the step

Practise the API step on its own. Take ten prompts and write the API for each in under three minutes, then check it against the patterns in this lesson: cursors for growing lists, idempotency for important writes, direct uploads for media, jobs for slow work, a push channel for real time features, hold and confirm for scarce resources. After a few rounds, you will recognise which patterns a prompt needs almost immediately, and the step will become one of the fastest and most reliable parts of your interview.

What a strong API step sounds like

Interview Dialogue

CandidateFour calls. POST orders with items, address and an idempotency key, returning an order ID and status. GET orders by ID for status. GET restaurants near a location with a cursor. And a server sent events stream for live order updates, since the requirement is to see the courier move.
InterviewerClick to reveal answer
CandidateUpdates only flow from server to client here, so server sent events are simpler and work over normal HTTP. If we later needed chat with the courier, I would move to WebSockets.
InterviewerClick to reveal answer
CandidateThe hardest call is placing the order, because it touches payment and the restaurant. I expect we will want to look at that in the deep dive. Moving on to the data.
Show all answers

That is under two minutes. It covers the calls, the cross cutting decisions, a reasoned transport choice and a preview of the deep dive, then moves on.

The API as a running reference

Finally, keep the API on the board for the whole interview. When you draw the high level design, point at the calls as you trace each request through the services. When you discuss failure handling, point at the idempotency key. When the interviewer adds a requirement, add a line to the API first, then follow it through the design. The API is the most concrete description of what the system does, and returning to it keeps the rest of the design anchored.

Questions to ask yourself before leaving the step

Before moving on, run through a short list. Does every core requirement have a call? Does every growing list have a cursor? Does every write that involves money, inventory or messages have an idempotency key or client generated ID? Does any call do slow work synchronously? Does any requirement need the server to push? Does any large payload pass through the application tier? Each answer takes a second, and together they catch nearly every API mistake interviewers commonly flag.

How the API changes with level

At mid level, a clear set of calls with pagination is a solid result. At senior level, interviewers expect the cross cutting decisions to appear without prompting and to be tied to requirements: idempotency because the client retries on mobile networks, a push channel because messages must arrive within a second. At staff level, the conversation may widen to how the API will evolve: which fields are stable, how old clients keep working, how partners are onboarded and rate limited, and what the API commits the company to supporting for years. You do not need to cover all of that in every interview, but knowing which level of discussion the role expects helps you choose where to spend the extra minute.

A final check on scope

The last thing to check is that the API matches the scope you agreed, no more and no less. If you agreed that editing posts is out of scope, there should be no edit call. If you agreed that users can search by hashtag, there should be a search call. The API is the most concrete statement of scope in the whole interview, so a mismatch between it and the agreed requirements is easy for an interviewer to spot and slightly undermines both. A quick glance back at the requirements list before moving on catches these mismatches in seconds.

Preview the hardest call

End the API step by saying which call you expect to be the hardest and why, such as placing an order because it touches payment and inventory. It shows you understand where the difficulty lies and gives the interviewer an easy way to steer the deep dive.