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.

HardBehavioral
47 practiced

Tell me about a time you had to push back on an API or data-model design that seemed simpler for short-term delivery but would have created long-term pain for downstream consumers. How did you make the case, and what was the final decision?

MediumTechnical
42 practiced

Write a JSON Schema (draft 2020-12 or later) for a POST endpoint /v1/apps/{app_id}/events that accepts an event payload with properties: eventType (enum), timestamp (ISO 8601 string), actor (object with id and type), metadata (optional object with string values), and items (array of objects with id and quantity). Include validation rules, required fields, and example success and validation-error responses.

EasyTechnical
50 practiced

What fields does a good JSON error response need so both a machine caller and a human developer can act on a failure? Design that shape for a REST API consumed by mobile and web clients: an error code, a user-facing message, a developer-facing trace or correlation ID, and how you would map these to HTTP status codes. Provide one example error JSON a client could parse programmatically.

HardTechnical
56 practiced

How do you lead API and schema governance across multiple engineering teams without becoming a bottleneck? Describe the standards, review rituals, exception process, and coaching mechanisms you would put in place so teams can move quickly while still protecting contract quality and data integrity.

EasyTechnical
39 practiced

Explain contract-first (OpenAPI-first) versus code-first API development. Discuss how each approach impacts documentation quality, SDK generation, design reviews, iteration speed, and coordination with product and client teams in a cross-functional environment.

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.