#API Design
API design defines the contracts that clients depend on for system integration. Articles cover multi-cloud API abstraction in Gocloud, GraphQL vs. gRPC trade-offs, and the design patterns that make APIs stable, discoverable, and backward-compatible across versions.
18 posts tagged with api design. ← Blog home
Every mechanism in this series — versions, gates, specs, deprecations — is the cost of changing decisions already shipped. The cheapest breaking change remains the one you never need, and whether you need many or few is substantially determined at design time, by choices that cost nothing when made and compound forever after. This closing post is that discipline: the additive-evolution patterns, the robustness-principle corrections, and the design review that asks about every surface, "how will this change?"
The cheapest breaking change is the one never needed: objects and envelopes over bare scalars, open sets declared with catch-all semantics, expansion parameters over endpoint forks, names reviewed against their futures — plus the corrected robustness principle and an honest beta ladder. Closes the series.
Shipping a version is a product launch; retiring one is a diplomatic mission. The clients still on it are, by definition, the ones who didn't upgrade when asked — working code owned by teams with no budget for your roadmap — and behind every deprecation that went badly is an integrator who found out from an outage. Deprecation done well is a designed process: telemetry that knows who's affected, communication that reaches them, migration paths that respect their economics, and sunsets that mean what they say.
Deprecation as designed lifecycle: deprecated-but-fully-functional with machine-readable marking, declared minimum support windows, warning cadences escalating through pre-announced brownouts, account-level telemetry driving targeted comms and burndown curves — and an explicit slip policy protecting sunset credibility.
An API that exists as code, a spec document, hand-written SDKs in six languages, and documentation pages is an API that exists in four slowly diverging copies. The evolution-era answer is to pick one source of truth — the machine-readable spec — and generate or verify everything else from it, so a change made once propagates everywhere or fails loudly. This post is the spec-first pipeline: what it takes, what it buys, and where generated SDKs still need human hands.
One machine-readable source of truth: complete specs, bidirectional conformance tests, dated snapshots per version, and spec-diff breaking-change detection as the evolution linter. Generate the mechanical 80% of every SDK with tolerant-reader behaviors built in; humans keep idiom and the fenced hand-written islands.
Promising account-pinned dated versions is easy; the hard part is the server that must honor all of them. The naive answers — fork the codebase per version, or thread `if version < X` through every handler — both collapse within a year. The architecture that scales is a transform pipeline: one current implementation at the core, and a chain of small, testable version-gates that translate requests forward and responses backward. This post builds it.
The transform chain: a latest-only core wrapped in per-version gates — small, pure, fixture-tested pairs of request-forward and response-backward transforms composed in date order. Know the hard species (semantic conversion, information asymmetry, behavioral wraps, fan-in/out) and retire versions by deleting gates.
Where does the version live — in the path, a header, a date? The debate consumes design reviews and misses the real decision underneath: what a version even is (the whole API? a resource? a behavior?), who chooses it (the request? the account?), and how many will you honestly support? This post surveys the schemes with their true trade-offs, including the account-pinned date scheme that the most evolution-serious API companies converged on — and why.
Path, header, and per-resource schemes mostly relocate the number; the real axes are granularity, default policy, and lifetime. The convergent answer for continuously-evolving APIs: dated versions pinned per account — every breaking change ships independently, integrations keep their era's semantics, the provider pays in transforms.
The day an API gets its first external integration, its shape stops being yours. Every field name, every status code, every undocumented quirk becomes load-bearing for code you can't see, written by teams you can't reach, deployed on schedules you don't control. API evolution is the discipline of changing a thing that thousands of strangers depend on — and it begins with understanding exactly what you promised, because most breakage comes from changes the provider genuinely believed were safe.
The real contract is operational: a change is breaking if any plausible client stops working — extending past docs into everything observable (Hyrum's Law), split across tolerant and strict readers. Rot decomposes into nameable forces: design debt, version sprawl, spec drift, zombie clients, change aversion. Opens the series.
Every webhook program eventually argues about payload shape: send the whole resource ("fat"), or just an ID and a hint ("thin")? The argument feels stylistic and is actually architectural — it decides your staleness semantics, your security exposure, your versioning burden, and whether consumers converge on truth or drift from it. This post makes the trade explicit, explains why providers have been drifting thin, and locates the pattern most receivers should default to: the event as doorbell, the API as truth.
Fat events are self-contained but stale-by-construction, data-exposing, and a second API to version; thin events are doorbells whose fetch returns authorized current truth and dissolves ordering problems. Default: doorbell, queued fetch, version-gated upsert — fat for immutable facts, thin for mutable state.
In an event-driven system your events are a public API that outlives every service that reads them, so how you shape them and how you evolve them without breaking consumers is not a detail — it is the contract the whole architecture rests on.
In an event-driven system your events are a public API that outlives every service that reads them, so how you shape and evolve them without breaking consumers is the contract the whole architecture rests on.
How APIs are designed, shipped, and kept consistent at scale — the design review, the enforceable style guide, spec linting as policy-as-code, contract tests, an API catalog, and the org model that makes ten teams' APIs feel like one.
The capstone: designing and shipping consistent APIs at scale — the lifecycle, design review and style guides, linting the spec as policy-as-code in CI, contract testing so changes don't break consumers, an API catalog with ownership, and production observability.
Why an API is only as good as a developer's ability to succeed with it — the OpenAPI contract as the source of truth, reference docs versus guides, errors as documentation, and the DX niceties that turn a first request into a shipped integration.
An API is only as good as a developer's ability to succeed with it: OpenAPI as the machine-readable contract (docs, SDKs, mocks, contract tests), reference plus guides, errors as documentation, and optimizing time-to-first-successful-call.
When REST is the wrong shape for the problem, GraphQL and gRPC each fix a different pain — and each buys that fix with a new cost you have to design around.
When REST isn't the right shape: GraphQL (client-selected fields, and its N+1 / caching / complexity costs) and gRPC (Protobuf, HTTP/2, streaming, codegen) — plus a decision framework for REST vs GraphQL vs gRPC.
The real skill isn't cutting a v2 — it's knowing which changes are safe to ship silently, which ones break clients you'll never meet, and how to retire an old version responsibly instead of forever.
Changing an API without breaking consumers: what counts as breaking, versioning strategies and their trade-offs (URI vs header vs additive evolution), the robustness principle and its limits, and responsible deprecation with Sunset headers and usage telemetry.
Why a consistent, machine-readable error model (RFC 9457 problem+json) and idempotency keys are the difference between an API clients can trust and one that quietly double-charges them.
The two things that make an API safe to build on: a consistent machine-readable error model (RFC 9457 problem+json, stable error codes, no leaked internals) and idempotency (the Idempotency-Key pattern so retries don't double-charge).
Shaping the payloads clients actually consume — consistent bodies, content negotiation, field selection, and pagination that survives scale and mutation.
Shaping the payloads clients consume: consistent naming, dates and money done right, content negotiation, field selection, and pagination — why offset pagination breaks at scale and how cursor/keyset pagination fixes it.
How to model resources as nouns, choose HTTP methods by their spec-defined semantics, return the right status codes, and decide honestly how much hypermedia your API actually needs.
Designing REST resources the right way: modeling resources as nouns, URI design, HTTP method semantics (safe vs idempotent, PUT vs PATCH), using status codes correctly, and a realistic take on the Richardson Maturity Model and HATEOAS.
The opening post of a series on designing APIs people actually enjoy using — why an API is a contract and a product, the qualities that separate a good one from a bad one, and why the contract should exist before a single line of implementation.
The opener to an API design series: an API is a contract and a product whose users are developers — the qualities that matter (consistency, evolvability, hard-to-misuse), API-first vs code-first, the interface/implementation boundary, and the paradigms you'll weigh.
Range-over-func iterators and generics, with the discipline that keeps them from turning readable code into clever code — including a measured 42× peak-memory win for streaming, and a measured (and reassuringly small) number for generic binary bloat.
Range-over-func and generics used sparingly: streaming a million-row walk measured at 4 MB peak heap versus 169 MB materialized, the yield-false rule that makes early break safe, one generic LRU that earns its keep — and a measured ~6 KB per instantiation that defuses the binary-bloat scare.
What it actually takes to build a unified cloud API library — and why "write once, run anywhere" still doesn't quite work, even for the patterns where it almost does.
All posts on this site are written by Pratik Dhanave, an Agentic AI Architect with 7+ years building production distributed systems, multi-agent AI platforms, and cloud-native infrastructure. About the author → Each article includes working code, architecture diagrams, and references to the specific frameworks and standards discussed. Browse the blog or explore related topics using the tag cloud above.