← Blog
API Documentation

API Documentation: What It Is, What It Includes, and Examples

API Documentation: What It Is, What It Includes, and Examples

API documentation is the technical content that explains how to call and integrate an API: its endpoints, authentication, request parameters, response formats, status codes, and errors. Good API documentation lets a developer who has never seen your API send a successful request, handle the failures, and build on it without asking your team for help.

  • API documentation has two layers: the API reference (every endpoint, exactly) and the guides around it (quickstart, authentication, tutorials, concepts).
  • The minimum useful set is a reference, an authentication guide, and a quickstart that gets a developer to their first successful call.
  • It is usually written in a description format such as OpenAPI or API Blueprint and published as a website, ideally with a try-it console so readers can send real requests.
  • The most common failure is drift: docs that no longer match what the API actually returns.

What is API documentation?

API documentation is the contract and the manual for an API in one place. The contract part states precisely what the API accepts and returns. The manual part explains how to use it to get a job done. A developer reads it to answer three questions: what can this API do, how do I call it, and what happens when something goes wrong?

It is written for developers, but not only for them. Product managers, partners, and support teams read the overview and error sections, and AI coding assistants increasingly read API docs to generate client code. Clear, structured docs serve all of them.

What does API documentation include?

Most complete API documentation contains the following parts. The first five are essential; the rest become important as the API and its audience grow.

PartWhat it answersExample content
OverviewWhat does the API do, and for whom?One paragraph, base URL, main resources
AuthenticationHow do I prove who I am?API key header, bearer token, how to obtain credentials
QuickstartHow do I make my first successful call?A copy-paste cURL request and its response
Endpoint referenceExactly what does each endpoint accept and return?Method, path, parameters, request body, responses
Errors and status codesWhat can go wrong, and what do I do about it?400, 401, 403, 404, 409, 422, 429, 500 with example bodies
Rate limits and paginationHow much can I request, and how do I page through results?Limits per window, Retry-After, cursor or page parameters
Guides and tutorialsHow do I accomplish a real task end to end?"Create an order and track its status"
Changelog and versioningWhat changed, and will it break my integration?Dated entries, breaking-change labels, deprecation dates

Status code meanings come from the HTTP standard (RFC 9110), and MDN's status code reference is a good plain-language companion. Your docs should not redefine them, only say when your API returns each one and what the body looks like.

What are the types of API documentation?

A widely used way to organize documentation is the Diátaxis framework, which splits it into four types by what the reader needs at that moment:

  • Reference (information-oriented): the endpoint-by-endpoint specification. See what an API reference is and how to write one.
  • Tutorials (learning-oriented): a guided first project, such as a quickstart.
  • How-to guides (task-oriented): steps for a specific job, such as rotating an API key.
  • Explanation (understanding-oriented): concepts and design decisions, such as how webhooks are retried.

Most teams need reference and a quickstart first, then add guides as support questions reveal what is missing. The trade-offs between the four types are covered in reference docs vs tutorial docs, and the difference between a reference and a full site is covered in developer portal vs API reference.

What does good API documentation look like? An example

Here is one endpoint documented well. It states the method and path, the auth requirement, each parameter with its type, a realistic success response, and the errors a client must handle. This is written in API Blueprint, a Markdown-based description format:

## Order [/orders/{order_id}]

+ Parameters
    + order_id: `ord_8c2e1a` (string, required) - The order ID returned by POST /orders.

### Get an order [GET]

Returns one order. Requires a bearer token with the `orders:read` scope.

+ Request
    + Headers

            Authorization: Bearer <token>

+ Response 200 (application/json)

        {
          "order_id": "ord_8c2e1a",
          "status": "shipped",
          "created_at": "2026-11-02T09:14:00Z"
        }

+ Response 401 (application/json)

        { "error": "invalid_token", "message": "The bearer token is missing or expired." }

+ Response 404 (application/json)

        { "error": "order_not_found", "message": "No order exists with ID ord_8c2e1a." }

The same information can be written in OpenAPI (YAML or JSON) instead. The format matters less than completeness: every parameter typed, every realistic response shown, every error explained. More full examples, including how well-known API providers structure their docs, are in API documentation examples.

How is API documentation written and published?

There are three common approaches, and teams often combine them:

  1. Write a description file by hand in OpenAPI or API Blueprint, then render it as a website. This gives the most control over wording and examples. See API Blueprint vs OpenAPI vs Swagger for choosing a format.
  2. Generate it from code (annotations or framework introspection). This keeps the reference close to the implementation, but descriptions and examples are often thin. See API documentation from code comments.
  3. Use a documentation platform that handles editing, rendering, and hosting. The options range from open-source renderers to hosted platforms; best API documentation tools compares them.

Whichever approach you choose, publish the docs at a stable public URL (or a private one for internal APIs) and keep the source under version control. Apidoke is one platform in the third group: you write API Blueprint in a browser editor with a live preview, publish a three-column reference with one click, and readers can send real requests from a built-in try-it console that runs in their own browser, so their tokens never reach Apidoke's servers. It can also be self-hosted. The step-by-step version is in how to write API documentation.

Why does API documentation matter?

For an API, the documentation is most of the product experience. Developers usually meet your docs before they meet your API, and they judge the API by how quickly they get a working request. Concretely, good documentation:

  • Shortens time to first call, the time from opening the docs to a successful response.
  • Reduces support load, because the answers to common questions (auth errors, rate limits, pagination) are written down.
  • Prevents integration bugs, because error cases and edge cases are explicit rather than discovered in production.
  • Makes change safer, because a changelog and versioned docs let consumers see what will break before it does.

How to measure these effects is covered in API documentation metrics.

What are the most common API documentation mistakes?

  • Drift. The docs describe last quarter's API. Field names, required parameters, and error bodies no longer match. Treat a docs update as part of every API change; the API documentation lifecycle shows where it fits.
  • Only the happy path. A 200 response is shown, but not the 400, 401, 404, or 429 a real client will hit.
  • Placeholder examples. "string" and "foo" instead of realistic values a developer can recognize and reuse.
  • Authentication buried or vague. The reader cannot tell which header to send or how to get a credential.
  • No way to try it. Readers must copy every request into a separate client before they learn anything. A try-it console in the docs removes that step; see what makes API docs interactive.

A broader checklist is in API documentation best practices.

Frequently asked questions

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

An API reference is one part of API documentation: the precise, endpoint-by-endpoint specification of methods, parameters, and responses. API documentation also includes the overview, authentication guide, quickstart, tutorials, error explanations, and changelog that help a developer use those endpoints.

What should API documentation include at minimum?

At minimum, API documentation should include an overview with the base URL, an authentication section, a quickstart with one working request, a reference for every endpoint, and the error responses each endpoint can return. Rate limits and a changelog should follow as soon as external developers depend on the API.

Who writes API documentation?

API documentation is usually written by the engineers who build the API, technical writers, or developer advocates, and often by all three. Engineers own accuracy, writers own clarity and structure, and a review step before publishing catches mistakes from both sides.

What format is API documentation written in?

API documentation is most often written in a machine-readable description format such as OpenAPI (YAML or JSON) or API Blueprint (Markdown-based), then rendered into a website. Guides and tutorials are usually plain Markdown or MDX alongside the reference.

Is API documentation the same as a developer portal?

No. A developer portal is the website that hosts API documentation together with other resources such as sign-up, API keys, a changelog, and support. API documentation is the content; the portal is the place it lives. See what a developer portal is.