On this page

Which group is this question in?

API basics interviewers still ask

API gateway interview questions

API design interview questions

REST, SOAP, GraphQL, and gRPC

API security and authentication

API integration questions

API testing questions

How to answer an API design question

Common mistakes

Frequently asked questions

How to prepare

Related Reading

API Interview Questions and Answers: REST, API Gateway, and Design

Image
Arslan Ahmad
The API questions interviewers actually ask, grouped by round: HTTP and REST basics, API gateway and microservices, live design questions, and integration.
Image

Which group is this question in?

API basics interviewers still ask

API gateway interview questions

API design interview questions

REST, SOAP, GraphQL, and gRPC

API security and authentication

API integration questions

API testing questions

How to answer an API design question

Common mistakes

Frequently asked questions

How to prepare

Related Reading

API interview questions fall into four groups. There are the basics of HTTP and REST. There are questions about the API gateway and microservices. There are design questions, where you build an API on the spot. And there are integration questions about calling someone else's API. Most loops ask from two or three of those groups, not all four.

This guide covers all four, with the answer an interviewer is listening for rather than a textbook definition.

Which group is this question in?

GroupSounds likeWhat is being graded
Basics"What is REST?" "When do you use PUT versus PATCH?"Do you know HTTP well enough to be trusted with a service
API gateway"What does a gateway do?" "Gateway or load balancer?"Do you know what belongs at the edge
Design"Design the API for a payment system."Can you model resources and defend trade offs
Integration"How do you handle a flaky third party API?"Have you shipped against someone else's contract

Name the group out loud before you answer. It tells the interviewer you understood the question.

API basics interviewers still ask

What is an API?

An API is a contract between two pieces of software. One side offers a set of operations, and the other side calls them without knowing how they are implemented. That last part is the point. The provider can rewrite everything behind the contract, and callers keep working.

What is a REST API?

REST is a style for building web APIs over HTTP. Resources get URLs, HTTP methods act on them, and each request carries everything the server needs to handle it. That last property is called statelessness. It is what lets you put ten identical servers behind a load balancer.

When do you use POST, PUT, and PATCH?

POST creates a resource and is not idempotent, so calling it twice makes two things. PUT replaces a resource completely and is idempotent, so calling it twice leaves the same state. PATCH updates part of a resource, and is usually not idempotent.

Idempotent means a repeated call leaves the same result as a single call. Interviewers use this word constantly, so define it before you use it.

What do the status codes mean in practice?

  • 200 succeeded, 201 created something new, 204 succeeded with no body.
  • 400 the request was malformed.
  • 401 you are not authenticated.
  • 403 you are authenticated but not allowed.
  • 404 not found.
  • 409 a conflict, such as a duplicate.
  • 429 too many requests.
  • 500 we broke.

The 401 versus 403 distinction gets asked a lot. 401 means we do not know who you are. 403 means we know, and the answer is still no.

Image

API gateway interview questions

The gateway questions are the most common in system design loops, because a gateway is where most cross cutting concerns live.

What is an API gateway?

A gateway is a single entry point in front of many backend services. A client makes one call to the gateway, and the gateway routes it to the service that can answer it.

What does a gateway actually do?

  • Routing. It maps a path or a host to a backend service.
  • Authentication. It checks the caller once, so every service does not repeat it.
  • Rate limiting. It caps how often a client can call, and returns 429 when they go over.
  • Aggregation. It can call several services and merge the results into one response.
  • Protocol translation. It can accept REST from a browser and speak gRPC to the backend.
  • Observability. It is the one place that sees every request, so it is where you attach a request id.

How is a gateway different from a load balancer?

A load balancer spreads traffic across identical copies of one service. It works at the connection or request level and does not care what the request means.

A gateway understands the request. It reads the path, the method, and the headers, and decides which different service should handle it. It also does auth, rate limiting, and aggregation, which a load balancer never does.

Most real systems use both. The load balancer sits in front of the gateway instances.

How is a gateway different from a reverse proxy?

A reverse proxy forwards requests to a backend and can cache, terminate TLS, and compress. A gateway is a reverse proxy with API specific features on top: per route auth, rate limits, request shaping, and aggregation.

What are the downsides of a gateway?

It is a single point of failure, so it needs to be replicated. It adds a network hop, so it adds latency. It can become a shared bottleneck if teams keep pushing business logic into it. That last one is the answer interviewers want, because it is the failure they have seen.

What is the backend for frontend pattern?

Instead of one gateway serving every client, you run one per client type. The mobile gateway returns compact payloads. The web gateway returns richer ones. Each is owned by the team that owns that client, so nobody negotiates a shared response shape.

API design interview questions

Design the API for a payment system.

Start with the resources, not the endpoints. Payments, refunds, customers, and payment methods. Then the operations on each.

POST   /v1/payments              Charge a customer
GET    /v1/payments/{id}         Read one payment
POST   /v1/payments/{id}/refund  Refund it
POST   /v1/customers             Create a customer

Then raise the three things that make it a payment API rather than a CRUD API. Retries must not double charge, so accept an idempotency key. Some payments are slow, so decide between returning 202 with a webhook and blocking for the result. Errors need machine readable codes, because a client has to branch on insufficient_funds.

How do you version an API?

Version only when a change would break a working client. Adding an optional field is not breaking. Removing a field is. Put the major version in the path, so /v1/orders, and route on it at the gateway. Publish a support window and send Deprecation and Sunset headers before you retire anything.

How do you paginate a large collection?

Offset pagination takes a page number, and gets slower the deeper you go, because the database reads and discards skipped rows. Cursor pagination takes a pointer to the last item, stays fast at any depth, and does not duplicate rows when new ones arrive. Use cursor for feeds and logs, offset for small admin tables.

How do you design errors?

Return the right status code, then a body with a stable machine readable code and a human readable message.

{ "error": { "code": "insufficient_funds", "message": "The card has insufficient funds.", "field": "amount" } }

The code is the contract. The message is for humans and can change.

How do you make an API idempotent?

The client generates a unique key and sends it on the write, usually as an Idempotency-Key header. The server stores the key with the result. If the same key arrives again, it returns the stored result instead of doing the work twice.

REST, SOAP, GraphQL, and gRPC

REST versus SOAP. SOAP is a protocol with a strict XML envelope and a formal contract file. REST is a style using plain HTTP, usually with JSON. SOAP still appears in banking and telecom, where its built in standards for security and transactions are required.

REST versus GraphQL. REST gives you a fixed response per endpoint. That causes over fetching, which means receiving fields you do not need. It also causes under fetching, which means several calls to fill one screen. GraphQL gives clients one endpoint and lets them ask for exactly the fields they want. The cost is that caching is harder, and an expensive query can hurt the server. Add query depth and complexity limits.

REST versus gRPC. gRPC uses HTTP/2 and Protocol Buffers, a binary format defined by a schema. It is faster and generates client code, and it supports streaming. It does not work directly in a browser. The usual split is gRPC between internal services and REST at the public edge.

API security and authentication

How do you secure an API? Use HTTPS everywhere. Authenticate with OAuth 2.0 or signed tokens rather than passwords on each call. Give tokens the narrowest scope that works. Validate every input on the server. Rate limit per client. Never put a token in a query string, because query strings land in logs.

OAuth versus JWT. They are not alternatives. OAuth 2.0 is a framework for getting a token on a user's behalf. A JWT is one format that token can take. You can use OAuth and receive a JWT, and you can use JWTs with no OAuth at all.

What is CORS? Browsers block a page on one origin from reading a response from another origin. Cross Origin Resource Sharing is the set of response headers a server sends to allow specific origins. It is a browser rule, so it protects users, not your server.

API integration questions

These come up for roles that consume third party APIs.

How do you handle a third party API that fails? Retry with exponential backoff and jitter, so every client does not retry at the same instant. Wrap the call in a circuit breaker that fails fast after repeated errors. Have a fallback response so your own screen still renders.

How do you handle their rate limits? Read the X-RateLimit-Remaining and Retry-After headers and slow down before you are cut off. Queue non urgent calls. Cache anything that does not change often.

How do you keep data in sync? Prefer webhooks over polling. A webhook is a call they make to you when something changes, so you find out immediately and waste no requests. Verify the signature on every webhook, and make your handler idempotent, because they will retry.

API testing questions

Testing questions come up mostly for QA and platform roles.

API testing checks the interface directly instead of through a screen. It is faster than UI testing and less brittle, because it does not break when a button moves. The usual layers are:

  • Functional tests per endpoint.
  • Contract tests that check the response shape against the schema.
  • Integration tests across services.
  • Load tests for throughput.
  • Security tests for auth and injection.

Common tools are Postman and Insomnia for exploring, REST Assured and pytest for automation, and JMeter or k6 for load. Contract testing tools such as Pact catch the case where a producer changes a field and a consumer breaks.

How to answer an API design question

The same six steps work for any of them, and they keep you from jumping to endpoints.

  1. Ask who calls it. A public API for outside developers and an internal service API get different answers.
  2. List the operations in plain words. Create a payment, refund it, list them by customer.
  3. Model the resources. Turn those operations into nouns, then check that the same pattern repeats.
  4. Write the endpoints. Plural nouns, HTTP methods for actions, no verbs in paths.
  5. Handle the hard parts. Retries, pagination, errors, auth, rate limits.
  6. Say what breaks next. Name the versioning plan and the failure behaviour before you are asked.

Common mistakes

  • Jumping to endpoints before asking who the caller is.
  • Verbs in paths, such as /getUser or /createOrder.
  • Returning 200 with an error message in the body.
  • Ignoring retries, then having no answer when asked about double charges.
  • Reciting REST constraints without saying what they buy you.
  • Treating an API design question as a database schema question.

Frequently asked questions

What questions are asked in an API interview?

Four groups. HTTP and REST basics, then API gateway and microservices questions. Then design questions, where you build an API live. Then integration questions about consuming a third party API. Security and testing come up depending on the role.

What are the most common API gateway interview questions?

What a gateway does, and how it differs from a load balancer and a reverse proxy. Then its downsides, and where authentication and rate limiting belong. The gateway versus load balancer question is the most frequent of all.

How do I prepare for an API design interview?

Learn one repeatable method and practise it on five or six problems. Model resources first, write endpoints second, then handle idempotency, pagination, errors, versioning, and rate limits. Being able to name trade offs matters more than memorising endpoints.

Is API design part of the system design interview?

Often, yes. Some companies run a separate API design round, especially API first companies such as Stripe and Twilio. At other companies it appears as one section inside a broader system design round.

What is the difference between API testing and API design questions?

Testing questions ask how you verify an API that already exists. Design questions ask you to create the contract. Testing appears mostly in QA and platform loops, design in backend and system design loops.

How many API interview questions should I prepare?

Depth beats breadth. Twenty questions you can answer with a real example beat a hundred you can only define. Make sure the gateway, idempotency, pagination, and versioning answers are solid, because those four come up constantly.

How to prepare

Learn the design round properly. It is the part most candidates have never practised. Grokking Modern API Design Interview is the dedicated course for it. It teaches a six step method and works 15 designs end to end, including payment, chat, and booking APIs.

Get the surrounding system design. Grokking the System Design Interview covers the framework, and System Design Patterns covers the building blocks that strong API answers reference.

System Design Fundamentals
System Design Interview
API

What our users say

Brandon Lyons

The famous "grokking the system design interview course" on http://designgurus.io is amazing. I used this for my MSFT interviews and I was told I nailed it.

Arijeet

Just completed the “Grokking the system design interview”. It's amazing and super informative. Have come across very few courses that are as good as this!

Eric

I've completed my first pass of "grokking the System Design Interview" and I can say this was an excellent use of money and time. I've grown as a developer and now know the secrets of how to build these really giant internet systems.

More From Designgurus
Annual Subscription
Get instant access to all current and upcoming courses for one year.

Access to 50+ courses

New content added monthly

Certificate of completion

$31.08

/month

Billed Annually

Recommended Course
Grokking the Object Oriented Design Interview

Grokking the Object Oriented Design Interview

60,269+ students

4.2

Learn how to prepare for object oriented design interviews and practice common object oriented design interview questions. Master low level design interview.

View Course
Join our Newsletter

Get the latest system design articles and interview tips delivered to your inbox.

Read More

7 Tips to Stand Out in Your System Design Interview

Arslan Ahmad

Arslan Ahmad

System Design 101: A Beginner’s Guide to Key Concepts

Arslan Ahmad

Arslan Ahmad

Circuit Breaker Pattern in System Design: Preventing Cascading Failures

Arslan Ahmad

Arslan Ahmad

What Is Grokking the System Design Interview? A Complete Guide

Arslan Ahmad

Arslan Ahmad

Design Gurus logo
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.