API Design

Designing APIs people love to use — resource modeling, versioning, pagination, errors, and the conventions that age well.

8 parts · written by Pratik Dhanave. Start with Part 1 →

← All series · All posts

Part 1 · ·13 min read

API Design Principles

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.

Part 2 · ·14 min read

RESTful Resource Design: Nouns, Methods, and the Maturity Model

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.

Part 3 · ·14 min read

Requests, Responses, and Pagination

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.

Part 4 · ·16 min read

Errors and Idempotency: The Two Things That Make an API Safe to Build On

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).

Part 5 · ·15 min read

Versioning and Evolution: Changing an API Without Breaking Its Consumers

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.

Part 6 · ·11 min read

Beyond REST: GraphQL and gRPC

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.

Part 7 · ·12 min read

Documentation and Developer Experience

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.

Part 8 · ·13 min read

API Lifecycle and Governance

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.

This series is part of a larger body of work by Pratik Dhanave, an Agentic AI Architect writing about production AI systems, distributed systems, and cloud-native engineering. Explore all course series, browse every post, or find topics via the tag index.