İçeriğe geç
wedevit

November 20, 2026 · 9 min read · software

İlhan Buğra Aslan

The team integrating with us asks about everything: how do you write API documentation that works?


API documentation that actually works has a shape to it: one machine-readable OpenAPI description as the source of truth, four distinct kinds of writing on top of it (a quickstart, task guides, endpoint reference, concept pages), examples you can copy and run, test credentials nobody has to request through a sales form, a catalogue of error codes, and a dated changelog. There is a single question that measures all of it: from the moment a developer opens your docs, how many minutes pass before their first successful call? If the honest answer is measured in hours, the problem is not on the integrator's side.

Most companies are not short on documentation. There is a Swagger page, a Word file somebody wrote in 2023, and a piece of knowledge that lives in an email thread between two engineers ("you actually have to send that field too"). Postman's 2025 State of the API report, published in October 2025 and based on a survey of more than 5,700 developers, architects and executives, puts numbers on it: 93 percent of API teams hit at least one collaboration blocker, 55 percent struggle with inconsistent documentation, and 34 percent cannot find APIs that already exist inside their own organisation. The report's diagnosis matches what you see in practice. The information exists. It is scattered across too many places to trust.

One source of truth: the OpenAPI description

Fixing documentation does not start with writing prose. It starts with producing a machine-readable description of the API, and OpenAPI is the de facto standard for that. Version 3.1 aligned the schema language with JSON Schema 2020-12. Version 3.2.0, released on 23 September 2025, added nestable tags, a querystring field that describes the whole query string with one schema, the OAuth device authorization flow for limited-input devices, and support for the QUERY method. Per the upgrade guide there are no breaking changes, so an existing 3.1 file stays valid.

There are two acceptable ways to produce that file. Writing the description first and building against it (contract first) opens the design to discussion early and lets client and server teams work in parallel. Generating it from types and annotations in the code (code first) solves the staying-in-sync problem directly. The third way is the one to avoid: a hand-written description that lives apart from the code. What you have at that point is not documentation, it is a story that happened to be true once.

Get the description right and a long list of things comes for free: the reference site, a mock server, client library scaffolding, a Postman collection, contract tests, even tool definitions for AI agents. Because they all derive from one file, they cannot contradict each other.

Four questions, four kinds of page

A reference page is not the documentation, it is one part of it. Daniele Procida's Diátaxis framework splits technical writing into four types: tutorial, how-to guide, reference, and explanation. On the API side they map cleanly:

  • Quickstart. One scenario, start to first successful call, no branching. It does not offer options or ask the reader to decide anything.
  • Task guides. "Cancel an order and issue a refund", "push a bulk stock update". Integrators do not look for endpoints, they look for jobs.
  • Endpoint reference. Parameters, schemas, status codes. Generated from the description, never hand-maintained.
  • Explanation. Why idempotency keys exist, how webhook retries behave, where the tenant identifier comes from. None of this fits in a table, and all of it generates support tickets when missing.

The common failure is shipping the third item alone and calling the job done. An auto-generated reference covering 180 endpoints is fast for someone who already knows the API and roughly as useful as an index for someone seeing it for the first time.

Time to first successful call

Stop debating whether the docs are good and measure them instead. The time to first call metric Postman has argued for over the years needs nothing more than a developer who has never touched your API, a screen recording, and a stopwatch. Give them the docs URL and nothing else. Do not help, do not answer questions.

Watch the recording and the stalls land in the same places every time. Getting a test key requires filling in a sales form. The curl snippet in the quickstart does not include the base URL. The exact shape of the auth header is three pages away. The example body is padded with "string" and 0. Or the first call needs an account identifier and no page explains where to get one. Fixing those five things beats rewriting the whole site.

Make examples real and errors a catalogue

An example is not a restatement of the schema. Give request and response as a pair, use realistic values, and include at least one error response. Keep examples inside the description file and validate them against the schema in CI, otherwise they rot silently the first time the API changes. In your test automation strategy that check is a one-line job; skip it and the snippet your customer copied stops working without anyone noticing.

Errors are the section teams skip most often. RFC 9457, published in July 2023 to replace RFC 7807, defines a ready-made format for error bodies: type, title, status, detail, instance, plus any extension members you need. It exists precisely so that every API does not invent its own error shape, and adopting it is a day of work. The valuable part is giving each error a stable machine-readable code. An integrator can branch on insufficient_stock. They cannot branch on a sentence of English prose that your support team will reword next quarter.

Add one more column to that catalogue: is this error retryable? A 429 comes with Retry-After and should be retried, 5xx should be retried, 422 should not. Retries bring up the POST problem, and the IETF's Idempotency-Key header draft (httpapi working group, still a draft rather than an RFC) is the standard-track answer to it. What it looks like in production is covered in payment integration and reconciliation, and the user-facing half of the same subject in error handling.

The three most-opened pages: auth, quotas, webhooks

Read your support queue and the questions cluster in three places. The authentication page needs the flow you use (API key, OAuth authorization code), token lifetime, refresh behaviour and the full list of scopes, all on one page. When the scope list is missing, integrators run with broader permissions than they need and nobody finds out.

The quota page has to contain numbers. There is no such limit as "fair use": how many requests per minute, which headers report the remaining allowance, what status code comes back when the limit is hit, and whether the quota is per tenant or per key. The design side of that is in rate limiting and quota design. The webhook page needs the event type list, a working code sample for signature verification, the retry schedule, and one explicit sentence: ordering is not guaranteed and the same event can arrive twice. Details in webhook design.

Nobody trusts an API without a changelog

The second-biggest complaint from integrating teams is waking up to find something changed quietly. Keep a dated changelog, mark every entry as breaking or non-breaking, and put your version policy on one page. That is the documentation half of the rules in API versioning and backwards compatibility.

Deprecation can now be announced at the protocol level too. RFC 9745, published in March 2025, defines the Deprecation response header; used alongside the Sunset header from RFC 8594 it also carries the shutdown date, and the Sunset timestamp cannot be earlier than the Deprecation one. A client calling the old endpoint sees the warning in the response headers even if nobody on their side reads email. In the docs the equivalent is a dated notice at the top of the endpoint page with one link to whatever replaces it.

Documentation belongs next to the code

Docs go stale for a structural reason: they live somewhere the code does not. Keep the description file in the repository, review changes in the pull request, run a linter in CI (tools like Spectral check naming, required description fields and error shapes automatically), validate examples against the schema, and publish on merge. Write a one-page API style guide as well: naming, date format (UTC and ISO 8601), pagination, error body, versioning. Without written rules every team invents its own conventions, and inconsistent documentation is really a symptom of an inconsistent API.

This setup pays off again on the day the team changes hands. When you switch software vendors, documentation transfers with the code. Put the current OpenAPI file and the example collection on the handover checklist alongside the repository access.

Your reader is not only human any more

From the same Postman report: 89 percent of developers use AI, only 24 percent design their APIs with agents in mind, and 41 percent use AI to generate documentation. Read those together and the picture is clear enough. Machines write the docs while the API is still designed on the assumption that only a person will read them.

An agent cannot pick up what your team knows from a shared Slack channel. What it can read is schemas, typed error responses, consistent naming, and description fields explaining when and why an endpoint is used. For multi-step flows there is the OpenAPI Initiative's Arazzo specification (currently at 1.1), which describes a sequence such as "authenticate, create the order, confirm the payment" in machine-readable form. Whether to expose the system to an assistant directly is a separate decision, covered in running an MCP server. One warning on the generated half: a field name a model invented looks exactly like a real one on a documentation page, so the acceptance criteria you apply to AI-written code apply here too.

What you can do this week

One: hand the docs URL to someone who has never used the API, time the first successful call, and write down the first five places they got stuck. Two: confirm the OpenAPI description lives in the same repository as the code and is produced by CI; if it is a file someone edits by hand, start there. Three: open an error catalogue page with a stable code, a description and a "retryable?" column for every error. Four: make test credentials self-serve so a developer can reach your sandbox without talking to anyone. Five: publish a dated changelog and a deprecation policy, and make last month's change the first entry.


Need help with this topic?

get in touch →← all posts