Jonatan Matajonmatum.com
conceptsnotesexperimentsessays
© 2026 Jonatan Mata. All rights reserved.v2.1.1
Concepts

API Documentation

Practices and tools for documenting APIs clearly, interactively, and maintainably, from OpenAPI specifications to documentation portals.

evergreen#api-docs#openapi#swagger#documentation#developer-experience

What it is

API documentation is the critical interface between your service and its consumers. It's not simply a list of endpoints — it's a product that determines adoption velocity, integration quality, and support ticket volume. Effective documentation combines precise technical reference, executable examples, and contextual guides that enable developers to be productive in minutes, not hours.

Modern documentation generates automatically from specifications like OpenAPI, ensuring synchronization with implementation. It includes interactive sandboxes, comprehensive error handling, and optimized developer experience workflows. The goal is reducing time-to-first-successful-call and minimizing adoption friction.

OpenAPI 3.1 Specification

OpenAPI 3.1 is the de facto standard for describing REST APIs. It defines machine-readable contracts that generate documentation, mocks, SDKs, and automatic validation. A well-structured specification is the foundation of a robust tooling ecosystem.

openapi: 3.1.0
info:
  title: User Management API
  version: 2.1.0
  description: User management with JWT authentication
  contact:
    name: API Support
    email: api-support@company.com
servers:
  - url: https://api.company.com/v2
    description: Production
  - url: https://staging-api.company.com/v2
    description: Staging
paths:
  /users/{userId}:
    get:
      summary: Get user by ID
      operationId: getUserById
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          example: "550e8400-e29b-41d4-a716-446655440000"
      responses:
        '200':
          description: User found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
              examples:
                active_user:
                  summary: Active user
                  value:
                    id: "550e8400-e29b-41d4-a716-446655440000"
                    email: "john.doe@company.com"
                    name: "John Doe"
                    status: "active"
                    created_at: "2024-01-15T10:30:00Z"
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - bearerAuth: []
components:
  schemas:
    User:
      type: object
      required: [id, email, name, status]
      properties:
        id:
          type: string
          format: uuid
          description: Unique user identifier
        email:
          type: string
          format: email
          description: User email address
        name:
          type: string
          minLength: 2
          maxLength: 100
          description: Full user name
        status:
          type: string
          enum: [active, inactive, suspended]
          description: Current user status
        created_at:
          type: string
          format: date-time
          description: Creation date in ISO 8601
    Error:
      type: object
      required: [code, message]
      properties:
        code:
          type: string
          description: Internal error code
        message:
          type: string
          description: Human-readable error message
        details:
          type: object
          description: Additional error information
  responses:
    Unauthorized:
      description: Invalid or expired authentication token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

Rendering Tools

The choice between Swagger UI and Redoc significantly impacts developer experience. Each tool has specific strengths depending on the use case.

AspectSwagger UIRedoc
InteractivityBuilt-in try-it-outRead-only, navigation-focused
PerformanceSlow with large specs (over 100 endpoints)Optimized for extensive specifications
CustomizationLimited themes, customizable CSSHighly customizable, professional themes
NavigationBasic sidebarAdvanced hierarchical navigation
MobileBasic responsiveMobile-first design
Initial loadOver 2MB JavaScriptUnder 500KB
Use casesInternal APIs, quick testingPublic documentation, complex APIs

For APIs with over 50 endpoints or external audiences, Redoc offers better experience. For internal teams needing quick testing, Swagger UI is more practical.

Documentation as Code

The docs-as-code workflow integrates documentation into the development cycle, treating it as first-class code. This approach ensures documentation evolves alongside the API and stays automatically updated.

Typical pipeline:

  1. Specification in repository — OpenAPI spec versioned alongside code
  2. CI validation — Spec linting, example validation, breaking change verification
  3. Automatic generation — Documentation build on every merge to main
  4. Synchronized deployment — Documentation deployed alongside API
  5. Notifications — Automatic changelog in Slack/email for changes

Ecosystem tools:

  • Spectral — Linting and style guide enforcement for OpenAPI
  • OpenAPI Diff — Automatic breaking change detection
  • Prism — Mock server from specification for parallel development
  • OpenAPI Generator — Automatic SDKs in multiple languages

Changelog and Versioning

An effective API changelog communicates changes so consumers can assess impact and plan migrations. It goes beyond a simple git log — it contextualizes changes from the integrator's perspective.

Recommended structure:

  • Breaking changes — Changes requiring client modification
  • New features — New endpoints, optional parameters
  • Improvements — Performance optimizations, better documentation
  • Bug fixes — Corrections that don't change expected behavior
  • Deprecations — Functionality marked for future removal

Example changelog entry:

## v2.1.0 - 2024-03-15
 
### Breaking Changes
- `GET /users` now requires mandatory pagination (`page` and `limit` parameters)
- Removed `legacy_id` field from user response
 
### New Features  
- New `POST /users/bulk` endpoint for bulk creation
- Status filtering in `GET /users`
- Webhook notifications for user changes
 
### Migration Guide
To migrate from v2.0 to v2.1:
1. Update `GET /users` calls to include `?page=1&limit=20`
2. Remove `legacy_id` references in client models
3. Optional: implement webhook handler for notifications

Why it matters

API documentation is a force multiplier for engineering teams. Well-documented APIs significantly reduce backend team interruptions, accelerate new consumer onboarding from weeks to days, and enable frontend teams to work in parallel using mocks generated from the specification.

From a staff+ engineering perspective, documentation is critical infrastructure that scales team capacity. APIs without adequate documentation generate organizational technical debt — tribal knowledge, manual onboarding processes, and dependencies on specific individuals. The ROI of investing in quality documentation materializes in lower operational load, faster internal adoption velocity, and reduced integration errors.

The difference between "sufficient" and "excellent" documentation determines whether your API becomes an enabler or a bottleneck for the organization.

References

  • OpenAPI Specification 3.1.0 — OpenAPI Initiative, 2021. Official standard specification.
  • API Documentation Best Practices — SmartBear, 2024. Comprehensive best practices guide.
  • Redoc CE Quickstart — Redocly, 2024. Quickstart guide for documentation rendering with Redoc.
  • Docs as Code — Write the Docs, 2024. Methodology for integrating documentation into development workflows.
  • APIs as Infrastructure: Future-proofing Stripe with Versioning — Stripe, 2017. Strategies for API versioning and changelog management.
  • Spectral OpenAPI Linting — Stoplight, 2024. Tool for OpenAPI specification validation and style guide enforcement.

Related content

  • Spec-Driven Development

    Development methodology where the specification is written before the code, serving as a contract between teams and as the source of truth for implementation.

  • API Design

    Principles and practices for designing clear, consistent, and evolvable programming interfaces that facilitate integration between systems.

  • Developer Experience

    Discipline focused on optimizing developer productivity, satisfaction, and effectiveness through well-designed tools, processes, and environments.

  • SDK Design

    Principles for designing development kits that are intuitive, consistent, and facilitate service integration across multiple programming languages.

  • Developer Portals

    Centralized platforms providing developers with documentation, APIs, tools, and service catalogs in one place.

Concepts