How to Design an API That Feels Easy to Use in Interviews
Use one clear contract before you choose field names or error shapes. The goal is an API that is simple for a client to understand and consistent enough to e...
API design comes up in interviews when you need to turn a product need into a clean contract. For an Associate Software Engineer, the key is to show that you can think from the client side, not just the server side. A good API is easy to call, easy to read, and easy to extend without confusion.
Why this matters in interviews
- Interviewers want to see if you can define the client action clearly.
- They check whether your request and response shapes are easy to use.
- They look for consistent naming and error handling.
- They want to know if you think about pagination, filtering, and versioning when needed.
A strong answer sounds like one clear endpoint contract with names, examples, and error behavior that match the use case.
The simple approach
- Start with the user action and the main resource.
- Draft the request and response around that action.
- Keep field names aligned with client vocabulary.
- Define standard success and error shapes.
- Add only the extra behavior the use case actually needs.
Step-by-step
- State the client action, resource, and success result in one sentence.
Check: can you describe what the API does without listing implementation details?
- Sketch the request body and response body for the main case.
Check: do the field names match the client’s point of view?
- List the top trade-offs: naming, payload size, and simplicity.
Check: can you defend each choice in one line?
- Define one error shape for validation and one for server failure.
Check: can a client tell what they did wrong and what to retry?
- Review the contract for consistency across similar actions.
Check: would a client predict the next endpoint from the first one?
Example (weak vs strong)
Weak answer: ``text I would make an endpoint and return the data. The field names are based on the database and the errors are whatever the server sends. ``
Strong answer: ``text I would design a POST /items endpoint for creating a new item. The request uses client-friendly field names, and the response returns the created item plus its id. Validation errors return a standard error object with the field name and message. ``
The strong version is better because it starts from the client action and keeps the contract predictable. It also shows that the error path is part of the design, not an afterthought.
Mistakes to avoid
- Naming endpoints from internal tables instead of user actions.
- Exposing internal database fields in the response.
- Letting similar endpoints behave differently without a reason.
- Making error responses vague or inconsistent.
- Adding too many optional fields before the core shape is clear.
Try this now (10 minutes)
- Pick one common API action: create, list, update, or delete.
- Write the endpoint goal in one sentence.
- Draft the request, response, and one error shape.
- Remove any internal or confusing field names.
- Add one note for pagination, filtering, or idempotency if needed.
Output: a one-page API contract with request, response, and error shape.
Quick self-check
- Is the client action clear?
- Are the field names easy to understand?
- Is the error shape standard and readable?
- Did you include only the behavior the use case needs?
Focus
- Query: api design interview contract request response error shape
- What to focus on: Focus on turning a use case into a clear endpoint contract and explaining trade-offs.