Interview Q&A · questions with model answers
API Design Interview Questions
Part of the study plan for: Backend Engineer · Full Stack Engineer · Native AI Engineer · Forward Deployed Engineer (FDE) · QA Engineer / SDET · Tech Lead
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked How do idempotency keys work for POST requests?
The client sends a unique Idempotency-Key header per logical operation; the server stores the key with a hash of the request and the resulting response, and if the same key arrives again it returns…
-
How should APIs format error responses?
Use a consistent, machine-readable structure such as RFC 9457 Problem Details (type, title, status, detail, instance) plus extensions like field-level validation errors and a correlation ID; never…
-
How should APIs support filtering, sorting and field selection?
Use query parameters with clear conventions (?status=paid&created_after=2026-01-01&sort=-created_at&fields=id,total), allow-list filterable and sortable fields backed by indexes, validate inputs,…
-
How should an API communicate rate limits to clients?
Return 429 with Retry-After when limited, and expose current limits with headers (the IETF RateLimit-Limit/RateLimit-Remaining/RateLimit-Reset style or X-RateLimit-*), document per-plan quotas, and…
-
How do APIs prevent lost updates from concurrent edits?
Use optimistic concurrency: return an ETag (or version) with the resource, require clients to send If-Match on updates, and reject mismatches with 412 Precondition Failed (or 409 with a version…
-
How should APIs represent dates, times and money?
Dates/times as ISO 8601 strings in UTC with offset (2026-10-10T09:15:00Z), date-only values as YYYY-MM-DD, durations in ISO 8601 or explicit units; money as integer minor units (cents) or decimal…
-
How should APIs handle large file uploads and downloads?
Use pre-signed URLs to object storage so clients upload/download directly, support multipart/resumable uploads for large files, stream rather than buffer on servers, and use range requests for…
-
How can APIs leverage HTTP caching?
Set Cache-Control appropriately (public/private, max-age), return ETag or Last-Modified validators, support conditional requests (If-None-Match → 304), and use Vary for content negotiation.
-
How do APIs handle localization?
Accept a locale via Accept-Language or a parameter, return localized human-readable messages while keeping stable machine codes, format nothing locale-specific in data fields (return ISO dates and…