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.

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.

MediumTechnical
42 practiced

You need to transform internal domain models into external API response objects (DTOs) and back. Describe patterns for this mapping (hand-written mappers, code generation, annotation-based), how you validate the DTO independently of the domain model, and how you handle optional or deprecated fields in the DTO as the underlying domain model evolves.

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.

MediumTechnical
53 practiced

Your team wants to add a computed field to an existing API response, but the value is expensive to calculate and could materially change the response time. How would you decide whether to compute it synchronously, cache it, materialize it in storage ahead of time, or expose it through a separate endpoint instead?

HardTechnical
40 practiced

You need to add new enum values to a public API response without breaking older clients that may error or crash on an unrecognized value. Propose both server-side and client-side strategies to make this safe, and describe how you would migrate the schema and communicate the change to minimize client impact.

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.