PrepPilotPractise free

API Design interview questions

REST, status codes, versioning, pagination, auth, gRPC and GraphQL

17 questions · GET /v1 · updated November 2026

Practise these as flashcards. One or two lines each; the ones you miss come back first.

Start free

Core questions

What is a REST resource and how do you represent it in an API?

A REST resource is an object or entity, like a user or order, that the API exposes. It's represented by a URI, such as /users/123, and manipulated using HTTP verbs like GET, POST, PUT, and DELETE.

Which HTTP verbs are idempotent and why does it matter?

GET, PUT, and DELETE are idempotent, meaning repeating the same request has the same effect. This matters because it makes APIs safer and more predictable, especially when clients retry requests.

What status code should you return when a resource is successfully created?

You should return 201 Created, and ideally include a Location header pointing to the new resource.

How would you implement pagination in a REST API?

I would add query parameters like limit and offset for offset-based pagination, or use a cursor parameter for cursor-based pagination, to let clients fetch results in pages.

Intermediate questions

Explain the difference between authentication and authorization in APIs.

Authentication verifies the identity of the client, such as via API keys or OAuth tokens. Authorization checks if the authenticated client has permission to perform a specific action, often using roles or scopes.

When would you use 409 Conflict vs 422 Unprocessable Entity?

409 Conflict is for resource state conflicts, like trying to create a duplicate. 422 Unprocessable Entity is for semantic errors, like invalid input that passes syntax checks but fails business rules.

How do you ensure backward compatibility when evolving an API?

I avoid breaking changes in existing endpoints, use versioning for major changes, and add new fields or endpoints in a way that doesn't affect current clients.

What is an idempotency key and how does it help with POST requests?

An idempotency key is a unique value sent by the client with a POST request. The server uses it to recognize and ignore duplicate requests, ensuring only one resource is created even if the client retries.

Describe how you would secure a public API.

I would require authentication, such as API keys or OAuth 2.0, use HTTPS to encrypt traffic, validate input, and implement rate limiting to prevent abuse.

What are the benefits of contract-first API design with OpenAPI?

Contract-first design ensures everyone agrees on the API before coding, reduces misunderstandings, enables code generation, and provides up-to-date documentation for clients.

How would you design error responses for an API?

I would use a structured format, like RFC 7807 Problem Details, including fields like type, title, status, and detail, so clients can programmatically handle errors.

What is the difference between OAuth 2.0 and JWT?

OAuth 2.0 is an authorization framework for delegated access, while JWT is a token format often used to carry claims in OAuth. JWTs are self-contained and stateless, making them suitable for scalable APIs.

Senior questions

Compare offset-based and cursor-based pagination. When would you use each?

See the answer in the app, free

When would you choose gRPC or GraphQL over REST for an API?

See the answer in the app, free

How do you handle retries and ordering for webhooks?

See the answer in the app, free

How would you design an API to support both old and new clients during a breaking change?

See the answer in the app, free

Describe how you would implement rate limiting and communicate it to clients.

See the answer in the app, free

More Developer fundamentals topics