Customers & growth · Developer marketing

API documentation framework

Best for Early Startup to Startup

APIENDPOINTSPARAMETERSRESPONSES

Use it when

Your API design is settled and developers need a reference that tells them exactly how to call every endpoint and handle what comes back.

Skip it when

  • The resources, errors and versions are still being decided. Use API design principles first, since the reference documents those choices.
  • You are planning the whole docs set, its page types and navigation. Use Documentation framework.
  • The reference is live and you need to judge how good it is. Use Documentation quality framework.
  • Developers call the API through your client libraries. Use SDK documentation framework, which builds on this.
  • New users need a guided path to their first working call. Use Quick start framework.

What to apply first and what to use instead are listed below.

Approaches

Design-first

The team writes the API description, such as an OpenAPI file, before the code and generates the reference from it.

  • Pro Writers and testers can work alongside developers from one precise definition, which keeps the docs consistent.
  • Con It takes more time upfront, and the team must agree the design before building.

Code-first

Developers annotate the code, and the API description and reference are generated from those annotations.

  • Pro It is faster to start and suits early or fast-changing APIs and small teams.
  • Con Writers lack a precise definition until code exists, and limits in what the description can express surface late.

Inputs

  • API description
    The OpenAPI file or equivalent for the current release, from the API repository.
  • Design document
    Resources, error format and version scheme, from API design principles.
  • Test access
    A sandbox, test keys and the current release, so every example can be run.
  • Developer questions
    Support tickets, forum posts and docs searches about the API from the last 90 days.
  • Style rules
    Your docs style guide and a linter for the API description, from the docs team.

Steps

  1. Make one API description in source control the single source of the reference, checked in continuous integration, and generate the reference pages from it.
  2. Give every operation a short summary, a description, its method and path, the permissions it needs and its lifecycle status, such as beta or deprecated.
  3. Document every path, query, header and body parameter with its data type, whether it is required, its default, its allowed values or limits, and what it changes in the response.
  4. Add a realistic request example and its matching response example to each operation, with a schema that gives every response property a type, a description and whether it is always present.
  5. Write the shared pages for authentication, rate limits, versioning and one list of status and error codes, and link each endpoint to the codes it most often returns.
  6. Run every example against the sandbox, test missing and out-of-range values, lint the description, check links and publish with the release.

Output

An API reference generated from one description, with shared pages for authentication, errors, rate limits and versions.

  • Operation summary, method and path
  • Permissions and lifecycle status
  • Parameters with type, required, default and limits
  • Request example
  • Response example and schema
  • Common errors, linked to the error code page
  • Authentication, rate limit and versioning pages
  • Lint, link and example test results, with the release tested

Done when

  • Every operation in the description has a summary, a description, its permissions and a lifecycle status.
  • Every parameter states its type, whether it is required, and its default where one exists.
  • Every request and response example was run against the current release, and the result is recorded.
  • The error code page lists every custom code with its meaning and how to fix it, and every endpoint links to it.
  • The description passes the linter, and every link resolves.

Measure

For 90 days after publishing, track support tickets and forum questions about the API, docs searches with no result, and the time new keys take to make a first successful call. Compare with the 90 days before. It worked when tickets per active developer and time to first call both fall. Recheck after each release that adds or changes operations.

Hypothetical example

Tallyport offers a shipping rates API with 24 operations, and a quarter of its support tickets ask what an error means. The team moves the hand-written pages into its OpenAPI file and generates the reference from it. Each operation gains permissions, parameter limits and a tested example. Testing missing parameters uncovers five custom error codes no one had documented, which now sit on one error page linked from every endpoint. The linter runs on every merge. Ninety days later, error tickets have dropped by about half and median time to first call is down from two days to under one.

Common mistakes

  • Keeping hand-written reference pages beside the API description. Generate the reference from one description so the two cannot drift.
  • Documenting only successful calls. Send missing, wrong and out-of-range values and document every error you get back.
  • Using placeholder values in examples. Use realistic values that run, and never real customer data.
  • Repeating the full error list on every endpoint. Keep one error page and highlight each endpoint's likely codes.
  • Leaving retired operations unmarked. Mark lifecycle status and link to the versioning page.

Sources

Show all 6 sources

By company stage

  1. Pre-IdeaNot applicableThere is no API to document.
  2. IdeaUsefulA few early users can be supported directly, so formal documentation is helpful but not required.
  3. Early StartupCriticalDevelopers outside the team start integrating and need clear examples to succeed without help.
  4. StartupCriticalScaling developer adoption requires reliable documentation or support costs rise.
  5. GrowthUsefulDocs exist already and the work is maintenance and expansion for new segments.
  6. ScaleUsefulDocumentation is run by established teams across multiple products.
  7. EnterpriseUsefulDeveloper documentation is still produced routinely for many APIs, so a structure helps keep it consistent.

Apply first

  • API design principlesCustomers & growth · Developer marketing

    Documenting endpoints, parameters, errors and versions well requires understanding the API design concepts behind them.

Use instead

  • API design principles

    The resources, errors and versions are still being decided. Use API design principles first, since the reference documents those choices.

  • Documentation framework

    You are planning the whole docs set, its page types and navigation. Use Documentation framework.

  • Documentation quality framework

    The reference is live and you need to judge how good it is. Use Documentation quality framework.

  • SDK documentation framework

    Developers call the API through your client libraries. Use SDK documentation framework, which builds on this.

  • Quick start framework

    New users need a guided path to their first working call. Use Quick start framework.

Recommended resources

No sponsored resources on this framework yet. Sponsored listings would be labelled here, never in search.

Progress is not saved until you have an account. Create a free account