InterviewStack.io LogoInterviewStack.io

API Contracts and Schema Design Questions

Defining the interface contract between producers and consumers: request/response payload shapes, data models, field-level validation, nullability, and enum/typing decisions (including safely evolving an enum's allowed values without breaking clients). Covers contract-first design with OpenAPI and JSON Schema (authoring specs, generating SDKs and mock servers, catching breaking changes in CI), mapping internal domain models to external DTOs as both evolve independently, and designing a stable error-response contract (structured error codes, correlation IDs, retryable classification). Also covers the leadership and behavioral practice of establishing and governing contract standards across teams. The contract is the durable artifact clients depend on.

MediumSystem Design
75 practiced

Design an error contract for an API that aggregates calls to multiple third-party services. The contract should expose meaningful high-level errors to consumers while masking internal or third-party-sensitive details. Include how you would categorize transient versus permanent errors and propagate a correlation ID for debugging.

MediumTechnical
53 practiced

Write a minimal OpenAPI 3.1 specification (YAML) for a POST /orders endpoint on an e-commerce service. Include the request body schema (items: an array of objects with product_id and quantity), a 201 success response schema (order_id, total_amount), 400 and 401 error responses, and an example request and response embedded in the spec.

EasyTechnical
56 practiced

Compare JSON and Protocol Buffers (protobuf) as serialization formats for APIs. Discuss trade-offs across latency, payload size, schema evolution, developer ergonomics, client diversity, human-readability, and tooling. Provide scenarios where you would choose JSON for a public REST API and where you would choose protobuf for internal, high-throughput communication, and why.

EasyTechnical
53 practiced

Explain normalization versus denormalization in your API's response shape, from the consumer's perspective. When would you prefer a normalized response, and when would you intentionally duplicate data into a read model or a single response payload instead?

MediumSystem Design
75 practiced

Design the API contract between frontend dashboards and a metrics microservice: the request/response shape for a paginated tile of metrics, how you would evolve that contract over time without breaking existing dashboard clients, and what you would classify as an additive change versus a breaking one.

Unlock Full Question Bank

Get access to all 15 API Contracts and Schema Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.