Small decisions made early in an API's life that quietly become expensive to fix later — and how to catch them before they ship

By The Coding Gopher

Published: 2026-11-17

URL: https://thecodinggopher.substack.com/p/5-costly-api-design-mistakes-to-avoid


Most API problems aren’t caused by bad engineers. They’re caused by reasonable-looking decisions made under time pressure, before anyone had real consumers to push back. The API works in Postman, it works in the demo, and it ships. Six months later there are twelve services depending on it, and every one of those early shortcuts is now a breaking change waiting to happen.

API Design - Azure Architecture Center | Microsoft Learn

\API designisthe intentional process of defining how an interface exposes data and capabilities so that different software applications can securely and reliably communicate with one another. A well-designed API acts as a clear contract that is easy to understand, difficult to misuse, and built to evolve without breaking existing integrations.\

Here are five mistakes that show up over and over — and what to do instead, while it’s still cheap to fix.

1. Modeling the API around your database, not your consumers

It’s the path of least resistance: you have a users table, a user\addresses table, and a user\preferences table, so you ship /users, /user\addresses, and /user\preferences. The API becomes a thin HTTP wrapper around your schema.

This works right up until your schema changes — and it will. Splitting a table, renaming a column, or moving to a different data store are all routine internal refactors. But if your API mirrors the schema directly, every one of those internal changes becomes an external breaking change for every client you have.

Shared Database Integration

\Adatabase schema changerefers toany modification made to the blueprint, architecture, or structural configuration of a database. Because the schema dictates how data is organized, stored, and accessed, managing these changes safely is a critical phase of the software development lifecycle.\

What to do instead: design endpoints around what consumers actually need to do, not around how you happen to store the data. GET /users/42/profile can be backed by three joined tables today and a denormalized document store next year — clients never need to know or care. The API is a contract about behavior, not a mirror of your storage layer.

Join a community of senior engineers. Subscribe and get FREE access to System Design deep dives.

Learn Backend Development, Visually (Module 1 Free)

Backend Development, Visually Explained: animated video course by The Coding Gopher

Want to understand systems like this well enough to design them yourself?
My animated course Backend Development, Visually Explained builds every concept as a clean, step-by-step diagram, from the fundamentals to real interview designs. It grew out of my YouTube explainers, which have millions of views.
Module 1 is free. No card needed.
Want everything? All-Access Lifetime includes all 6 live courses (System Design, AI Engineering, Backend Development, Cloud Development, System Design: Case Studies and Data Structures & Algorithms), the 10 on the way (Distributed Systems, How Computers Really Work, Database Internals and more), the full System Design Visual Guide and every course after that, for one payment.
💡 Many engineers expense this through their team's learning budget.

Building a product for developers? Put it in front of thousands of engineers who read this newsletter and watch The Coding Gopher on YouTube. Newsletter and video sponsorships are open.

2. Treating versioning as a “later” problem

Plenty of teams ship v1 with no versioning strategy at all, reasoning that they’ll figure it out “if we ever need to make a breaking change.” Then a breaking change becomes genuinely necessary — a field needs a different type, a response shape needs to change — and there’s no mechanism to do it without breaking every existing client simultaneously

What to do instead: decide your versioning approach before you have a single external consumer, even if you never end up needing it. A few reasonable options:

  • URI versioning (/v1/orders, /v2/orders) — most explicit, easiest for clients to reason about
  • Header-based versioning (Accept: application/vnd.yourapi.v2+json) — keeps URLs stable
  • Additive-only evolution — never remove or repurpose a field, only add new optional ones, and accept that this constrains your data model over time

Semantic Versioning in Software Engineering | by Kodegasm | Medium

\Semantic Versioning (SemVer) isa system for giving numbers to software updates. It uses a three-part format:MAJOR.MINOR.PATCH. These numbers tell users if an update breaks old code, adds new features, or just fixes bugs. You can read the official rules on theSemantic Versioning Site.\

The specific choice matters less than making it deliberately. And separately: draw a hard line between additive changes (new optional fields, new endpoints — safe, no version bump needed) and breaking changes (renamed fields, changed types, removed fields, new required fields — always require a version bump). Most teams that get burned aren’t confused about the mechanism; they’re confused about which category a given change falls into.

3. Inconsistent error responses

This one is subtle because it never breaks the happy path — it only shows up when something goes wrong, which means it usually ships unnoticed. Common symptoms:

  • Some endpoints return 400 for bad input, others return 422, others return 200 with {"success": false} buried in the body
  • Error payloads have different shapes across endpoints — sometimes {"error": "..."}, sometimes {"message": "..."}, sometimes a raw string
  • Stack traces or internal exception messages leak into production error responses

Every one of these forces client developers to write bespoke error-handling code per endpoint instead of one generic handler for your whole API — which means most of them just won’t bother, and errors get swallowed or mishandled.

What to do instead: define one error envelope and use it everywhere, from day one:


{
"error": {
"code": "INVALID_EMAIL_FORMAT",
"message": "The email field must be a valid email address.",
"field": "email"
}
}

Pair it with correct, consistent HTTP status codes (400 for client errors, 401/403 for auth, 404 for missing resources, 429 for rate limits, 5xx reserved for actual server failures). A machine-readable code matters as much as the human-readable message — clients will branch on the code, not parse your prose.

Build Redis, Git, Docker & Claude Code From Scratch

Want to become a better software engineer?
Trusted by engineers at Google, NVIDIA, and Anthropic, CodeCrafters helps you rebuild technologies like Redis, Git, Docker, and Claude Code from scratch so you can deeply understand how real systems work.
We’ve partnered with CodeCrafters to give all readers an exclusive 40% lifetime discount.
💡 Engineers may expense platforms like this through their team’s learning budget.

4. Skipping pagination until the data outgrows it

GET /orders returns a nice, manageable array of 40 records in development. It ships without pagination because, at the time, pagination feels like premature optimization. A year later that endpoint returns 200,000 records, times out under load, and can’t be fixed without a breaking change to the response shape — because clients are already expecting a bare array, not an object with a data key and cursor metadata.

The End of Pagination

Pagination is the process of dividing a large amount of content into smaller, distinct pages or numbered sequences. It improves website speed, enhances user experience, and reduces server load by preventing thousands of items from loading all at once.

What to do instead: build the pagination envelope in from the start, even when the current data volume doesn’t need it:


{
"data": [ ... ],
"pagination": {
"next_cursor": "eyJpZCI6NDJ9",
"has_more": true
}
}

Cursor-based pagination ages better than offset-based (?page=3&limit=20) for anything that might see concurrent writes, since offsets shift under you as rows are inserted or deleted. Either way, the point is the same: wrapping the array costs nothing on day one and saves you a breaking change later.

Join a community of senior engineers. Subscribe and get FREE access to System Design deep dives.

5. Designing APIs that force clients into chatty request patterns

This mistake usually comes from designing endpoints one resource at a time without thinking about the workflows consumers actually run. A mobile app needs to render an order with its line items, shipping status, and customer name — but the API only exposes /orders/:id, /orders/:id/items, /customers/:id, and /shipments/:id as separate calls. Rendering one screen now costs four round trips, and on a mobile network that’s the difference between a snappy app and a visibly slow one.

The opposite failure mode also happens: endpoints that return enormous nested payloads with everything a client could conceivably want, most of which goes unused on any given call, wasting bandwidth and making responses fragile to change.

What to do instead: look at your actual client workflows, not just your resource model, and design composite endpoints for the common ones — GET /orders/:id?include=items,shipment,customer, or a purpose-built GET /order-summary/:id. If you have many different clients with very different data needs, a GraphQL layer in front of your REST services is also a legitimate answer here — it exists largely to solve exactly this problem.

The common thread

Every one of these mistakes shares the same shape: they cost nothing today and compound the longer they go unfixed, because someone else’s client code gets written against your current behavior — implicit or not. The fix in all five cases is the same habit: before you ship an endpoint, ask what it looks like when there are ten consumers depending on it instead of zero. That’s usually enough to catch most of these before they harden into a contract you can’t change.