← Blog
API Documentation

What Is an API Reference? (And How to Write One)

What Is an API Reference? (And How to Write One)

An API reference is a complete, endpoint-by-endpoint specification of a web API: every URL, HTTP method (GET, POST, PUT, DELETE, PATCH), accepted parameter, required header, authentication scheme, and possible response (200, 201, 400, 401, 404, 500) documented in one place. Unlike tutorials or guides, it is not prose-first; it is a precise contract between the API and the developer consuming it. Apidoke lets you write that contract in API Blueprint and publish it as a live, interactive reference in minutes, no extra toolchain required.

  • An API reference covers every endpoint, its accepted inputs, and every response the server can return, including errors.
  • It is distinct from tutorial docs, which walk through a task step by step; a reference is consulted, not read linearly.
  • API Blueprint is a Markdown-based open standard well-suited for writing reference docs; Apidoke renders it as a searchable 3-column viewer with a live try-it console.
  • Good references ship with real request and response bodies, exact status codes, and authentication details so developers can integrate without guessing.

What does an API reference actually contain?

The term "API reference" is sometimes used loosely to mean any technical docs, but in practice it has a defined structure. Think of it as a lookup table, not a narrative. When a developer hits a 401 at 2 a.m., they open the reference to check whether the endpoint requires a Bearer token or an API key in the query string. They are not reading the getting-started guide.

A complete REST API reference includes:

  • Base URL (for example https://api.example.com/v1)
  • Authentication: token type, header name, scopes if any
  • Resource groups: logical groupings such as Users, Orders, or Products
  • Endpoint definitions: method + path, for example GET /users/{id}
  • Path, query, and body parameters: name, type, whether required or optional, allowed values
  • Request headers: Content-Type, Authorization, custom headers
  • Request body: a real JSON (or XML) example with field-level descriptions
  • Response codes: at minimum 200/201 for success and 400, 401, 403, 404, 422, 500 for errors
  • Response body: a real example plus a schema describing every field
  • Rate limits and pagination where applicable

How is an API reference different from other types of documentation?

Developers often confuse the reference with the rest of the docs suite. The full breakdown of types of API documentation lives in its own post, but the short version is this:

Doc typePrimary question answeredHow it is readExample
API referenceWhat exactly does this endpoint accept and return?Consulted on demandGET /orders/{id} returns a 200 with an Order object
Getting-started guideHow do I make my first successful call?Read top to bottom, onceStep 1: obtain a token. Step 2: call POST /sessions
Tutorial / how-toHow do I accomplish a specific task?Followed while buildingHow to implement pagination with cursor tokens
Conceptual guideWhy does the API work this way?Read for contextHow the authentication flow works
ChangelogWhat changed and when?Scanned periodicallyv2.1: deprecated GET /legacy/users

A mature API docs site has all five. But the reference is always the foundation; everything else links back to it.

Why does reference quality matter so much?

Surveys by Postman and independent developer-experience researchers consistently report that outdated or incomplete reference docs are the single biggest frustration when integrating a new API. When a parameter is missing from the docs, the developer either files a support ticket (costing your team time) or abandons the integration. Neither is a good outcome.

Reference docs also have an unusually high search-intent signal. A developer searching "POST /checkout 422 response" or "Authorization header format" is mid-integration and ready to act on whatever answer they find. An accurate, detailed reference captures that intent and keeps them in flow.

What format should you write an API reference in?

Two open standards dominate the space: API Blueprint (Markdown-based, human-readable) and OpenAPI (formerly Swagger, JSON/YAML-based). Each has real trade-offs.

CriterionAPI BlueprintOpenAPI 3.x
File formatMarkdown (.apib)JSON or YAML (.json / .yaml)
Readability in a text editorHigh; prose-like structureMedium; nested objects get verbose
Tooling ecosystemSmaller but focusedVery large
Supported by ApidokeYes, nativelyNot for import; author in Blueprint instead
Learning curveLow (standard Markdown)Medium to high

Apidoke is built around API Blueprint. If you are already comfortable writing Markdown, you can write a valid API reference today without learning a schema language. The API Blueprint vs OpenAPI vs Swagger comparison covers the format decision in depth if you want the full picture before committing.

How to write an API reference: a step-by-step process

The steps below assume you are writing in API Blueprint and publishing with Apidoke, but the underlying logic applies to any format.

  1. Audit your API surface. List every endpoint, including deprecated ones. Note the HTTP method, path, and the team or service that owns it. Gaps here become gaps in the docs.
  2. Define authentication once, at the top. Whether you use Bearer tokens, API keys, or OAuth 2.0, state it clearly before any endpoint. Developers scan for this first.
  3. Group endpoints by resource, not by HTTP method. All /orders endpoints belong together. Grouping by GET / POST / DELETE across all resources is harder to navigate.
  4. Write a real request example for every endpoint. Not a placeholder. A real JSON body with realistic field values your reader can copy and run.
  5. Document every response, especially errors. A 404 that returns {"error": "order_not_found"} is different from one that returns HTML. Both need to be in the reference.
  6. Describe every parameter. Type (string, integer, boolean), whether required or optional, allowed values or format (ISO 8601 date, UUID, email), and any defaults.
  7. Publish and share a live link. A reference locked in a private repo is not useful. Apidoke lets you publish with one click so your consumers always see the latest version.

Writing an API reference in API Blueprint: a real example

Below is a self-contained API Blueprint snippet for a GET /orders/{id} endpoint. This is the kind of source you would write in Apidoke's split-pane editor and see rendered instantly in the preview pane.

FORMAT: 1A
HOST: https://api.example.com/v1

# Orders API

Retrieve and manage customer orders.

# Group Orders

## Order [/orders/{id}]

+ Parameters
    + id: `ord_8f3kq2` (string, required) - Unique order identifier.

### Retrieve an Order [GET]

Returns a single order by its ID.

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...

+ Response 200 (application/json)

    + Body

            {
              "id": "ord_8f3kq2",
              "status": "shipped",
              "total": 4999,
              "currency": "USD",
              "created_at": "2025-03-14T10:22:00Z"
            }

+ Response 401 (application/json)

    + Body

            {
              "error": "unauthorized",
              "message": "A valid Bearer token is required."
            }

+ Response 404 (application/json)

    + Body

            {
              "error": "order_not_found",
              "message": "No order with id ord_8f3kq2 exists."
            }

When you paste this into Apidoke, the editor renders the navigation column (with the Orders group listed), the content column (the endpoint description, parameters, and examples), and the try-it console, where a developer can plug in a real token and fire the request without leaving the docs page. The token stays in their browser and never reaches Apidoke's servers.

a 3-column API reference layout showing navigation on the left, endpoint details in the center, and a live try-it console on the right with a GET /orders/{id} request and a 200 JSON response

What makes a reference document easy to maintain?

Reference rot is the silent killer of developer trust. An endpoint that changed three months ago but whose docs still show the old parameter name will frustrate integrators and generate support load. A few practices reduce this risk significantly.

Keep the source file close to the code

The closer your .apib file lives to the API code, the more likely the team will update it when behavior changes. Treating the reference as a first-class artifact in the same pull request as the code change is the single most effective quality control.

Use version history to track changes

Apidoke stores per-project version history, so you can see exactly what the reference said before a breaking change and when. This is useful for debugging consumer issues and for generating a changelog entry. The guide to API versioning strategies explains how URL versioning, header versioning, and semantic versioning each affect how you structure and update reference docs.

Document deprecations explicitly

When an endpoint or parameter is deprecated, say so in the reference with the date it will be removed and the replacement path. Developers are far more tolerant of change when they have notice and a migration path.

Authentication and security: what to document and what to omit

One question teams ask often: should secrets appear in the reference examples? No. Use placeholder values in examples (like the truncated JWT above) and tell developers where to generate real credentials in your platform. The IETF HTTP semantics specification (RFC 9110) defines the Authorization header format that most REST APIs rely on; linking to it from your reference adds credibility and saves you from re-explaining the standard.

Apidoke's try-it console is client-side only. When a developer fills in a Bearer token and fires a request, the call goes directly from their browser to your API server. Apidoke does not proxy or log it, which means sensitive tokens never touch Apidoke's infrastructure.

Common API reference mistakes (and how to avoid them)

  • Listing only success responses. A reference that only shows 200 OK is incomplete. At minimum, document 400, 401, 403, 404, and 500 for every endpoint.
  • Vague parameter descriptions. "The ID of the item" is not enough. Say what format it is (UUID, integer, prefixed string like ord_), whether it is path or query, and what happens if it is invalid.
  • No real example bodies. Schema descriptions alone are not enough. Include a realistic JSON body that a developer can copy directly into a tool like curl or Postman and adapt.
  • Inconsistent naming. If the field is created_at in one response and createdAt in another, document both and flag the inconsistency. Better yet, fix the API.
  • No base URL. Developers should never have to guess whether to use https://api.example.com or https://example.com/api. Put it at the top of the document.

How Apidoke renders a reference in practice

When you open a project in Apidoke's editor, the left pane is a CodeMirror editor where you write API Blueprint. The right pane is a live preview that re-renders on every keystroke. Once you publish, the output is a 3-column reference viewer: navigation on the left, endpoint documentation in the center, and the try-it console on the right. Developers can select an example request, edit parameters, add their auth token, and fire a real HTTP call without installing anything.

There is no build step, no CI configuration, and no CLI to manage. The step-by-step guide to publishing your first interactive API doc walks through the full process from a blank project to a live public URL.

Because Apidoke is self-hostable, teams with strict data-residency requirements can run the entire stack on their own infrastructure. The self-hosting path is documented and does not require a paid tier.

Apidoke's split-pane editor showing API Blueprint source on the left and a rendered 3-column reference preview on the right, with a visible try-it console panel

Frequently asked questions

What is the difference between an API reference and API documentation?

"API documentation" is the umbrella term covering everything: references, tutorials, guides, changelogs, and conceptual content. An "API reference" is one specific type within that umbrella: the endpoint-by-endpoint technical specification. You can have documentation without a reference, but any serious API ships both.

Does an API reference need to be interactive?

No, but interactive references that let developers fire real requests in the browser reduce time-to-first-call and lower the support burden. A static HTML page is better than nothing; a live try-it console is better than static HTML.

How long does it take to write a good API reference?

A focused single-resource reference (one or two endpoints) can be written in under an hour using API Blueprint. A full production API with 30 to 50 endpoints realistically takes several days of first drafts plus review cycles. The more consistent your API design, the faster the docs go.

Should error responses be documented in the API reference?

Yes, always. Error responses are often the most-consulted part of a reference. At minimum, document 400 (bad request), 401 (unauthorized), 403 (forbidden), 404 (not found), and 500 (server error) for every endpoint, with a real example body showing the error structure your API returns. The MDN HTTP status code reference is a useful external resource to link alongside your own error table.

Can I write an API reference without knowing OpenAPI or Swagger?

Yes. API Blueprint uses plain Markdown syntax, so if you can write a README you can write an API reference. Apidoke is built on API Blueprint specifically to remove the YAML/JSON schema learning curve that OpenAPI requires.

Ready to turn your API Blueprint source into a published, interactive reference? Create your free Apidoke account and have your first reference live in minutes, no credit card required.

Related reading: Hosted API Documentation: Pros, Cons, and How to Choose