API & Automation·7 min read·

API Documentation Developers Actually Read

OpenAPI turns an API into living documentation with examples, schemas, and generated clients. Write it early, lint it in CI, keep it fresh.

NB

Netbay Engineering

Netbay Engineering

On this page

Most API documentation fails for a boring reason: it is written from the organization's view instead of the consumer's. It lists endpoints alphabetically, describes parameters in jargon, and shows no real responses — so developers open it, find nothing they can copy, and go back to reading traffic. The fix is not more writing. It is treating the spec as machine-readable source of truth: define the contract in OpenAPI, generate docs and clients from it, and lint it in CI so it cannot rot.

What good docs actually contain

  • One example request per endpoint, with a real URL, headers, and authentication already filled in.
  • At least one example response with realistic data — and one error example, because errors are what clients actually look for.
  • Parameter descriptions with types, defaults, and whether they are required, placed inside the same schema clients validate against.
  • A versioned change log and an explicit deprecation section, so people can see what to migrate off.
  • A runnable curl or SDK snippet under each operation.

None of that is surprising. What is surprising is how rarely all of it exists at once, because keeping prose in sync with behavior is impossible if prose lives apart from the code.

OpenAPI basics

An OpenAPI document describes the whole surface in one file: an info block, one or more servers, the paths and methods, and reusable component schemas. Those schemas are not decoration — they feed documentation rendering, client generation, request validation, and test fixture generation. One source, many outputs, no drift between them.

yaml
openapi: 3.1.0
info:
  title: Netbay V1 API
  version: "1.4.2"
servers:
  - url: https://api.netbayhosts.in
paths:
  /api/v1/plans:
    get:
      summary: List public VM plans
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  "$ref": "#/components/schemas/Plan"
components:
  schemas:
    Plan:
      type: object
      required: [id, name, vcpu, ram_gb]
      properties:
        id: { type: string }
        name: { type: string }
        vcpu: { type: integer }
        ram_gb: { type: integer }

Keep it fresh or it lies

A stale spec is worse than none, because teams trust it far more than a comment. The mechanisms that keep it honest:

  • Lint the spec in CI. A recommended lint ruleset fails the build when operations lack summaries, responses lack examples, or schemas are missing — while the change is still a diff with an author.
  • Generate clients from the spec with openapi-generator, so type drift is caught at build time rather than discovered by a user.
  • Optionally, derive the spec from code (FastAPI, swagger modules for common frameworks) so the file can never fall behind the implementation.
  • Preview the rendered docs locally; the rendered page is the deliverable, not the YAML.
bash
# Lint the spec in CI — fail the build before the drift ships
npx @redocly/cli lint openapi.yaml --extends recommended

# Preview the rendered docs while you edit
npx @redocly/cli preview-docs openapi.yaml

# Generate a typed client from the same spec
npx openapi-generator-cli generate   -i openapi.yaml -g typescript-fetch -o ./src/api
one spec, four outputs, zero drift openapi.yaml source of truth rendered docs examples + errors typed SDK client generated at build contract/schema tests assert live responses CI lint + link checks fails on rot

Takeaway

Documentation stops being writing once the spec is code. Define the contract once in OpenAPI, render docs and clients from it, and lint it in CI — then "the docs are outdated" stops being a sentence your team can say with a straight face.

Netbay publishes its public V1 API contract to make automation predictable — the same clarity you should expect from any API you build on. Sign in at netbayhosts.in and see why the spec-first habit pays off in integrations that just work.

Keep reading

Follow along on a real VPS

Deploy Linux in under 60 seconds

These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.

Deploy an instance