API documentation is the set of materials developers and integrators use to connect to an interface without going back and forth with support. A generated list of endpoints in Swagger UI is not enough: without integration guides, authentication walkthroughs, and error codes, developers end up reading the source code. When your OpenAPI specification and Markdown guides follow a single Git workflow — either in one catalog or synced from service repos via CI — documentation stays in sync with releases.
In short
- API documentation has two layers: a machine-readable endpoint reference (OpenAPI) and written guides covering authentication, workflows, and limits.
- OpenAPI is an open standard for describing REST APIs in YAML or JSON, while Swagger is a suite of tools built around that standard.
- In a Docs as Code workflow, the OpenAPI specification and Markdown articles follow a unified Git process — in one catalog or synced from service repositories via CI.
- Large specifications are split into multiple YAML files linked via
$ref, and API versions are separated by Git branches or catalog versions. - A documentation portal brings guides and the API reference together, adds search across operations, and lets developers send test requests right from the page.
What API documentation includes: reference and guides
API documentation consists of two parts: an API reference and integration guides. If you only publish an auto-generated list of endpoints, an external developer can see individual request parameters, but still won't know what order to call them in or how to get an access token.
Documentation layer | What it contains | Question it answers | Storage format |
|---|---|---|---|
API Reference | Endpoints, HTTP methods, headers, request and response schemas, status codes. | Which fields to send in a specific request and what the server returns. | OpenAPI specification (YAML). |
Integration Guides | Quickstart, token retrieval, end-to-end workflows, webhooks, rate limits, and changelog. | How to solve a real task with the API from scratch and how to handle errors. | Text articles in Markdown. |
Just like user documentation, integration guides are organized around the reader's goals rather than an alphabetical list of fields. Beyond the endpoint reference, an integrator typically needs five sections:
- Quickstart. The shortest path to a first successful request, complete with a working
curlexample and the expected server response. - Authentication and permissions. How to obtain an API key or OAuth 2.0 token, how to refresh an expired token, and which scopes or permissions each method requires.
- End-to-end workflows. Call sequences for common tasks, such as creating an order, checking payment status, and issuing a refund.
- Errors and rate limits. Explanations of common error codes, requests-per-second limits, and retry policies.
- Webhooks and changelog. Events the service sends on its own, signature verification steps, and a record of changes between API versions.
When these sections are missing or contradict the reference, developers resort to trial and error. According to the Postman State of the API Report, in 2024, 39% of developers cited inconsistent documentation as the top obstacle to learning and integrating an API, and 44% read the source code to figure out how endpoints worked. In the 2025 report, 55% of teams pointed to missing or inconsistent documentation as their main barrier to API collaboration.
OpenAPI vs. Swagger: what is the difference and which format to choose
The OpenAPI Specification (OAS) is an open standard for machine-readable descriptions of REST APIs (OpenAPI Specification). Swagger is a set of tools built around that standard, including Swagger UI, Swagger Editor, and Swagger Codegen (Swagger documentation). Up to version 2.0, the format itself was called the Swagger Specification; since version 3.0, it has evolved under the OpenAPI name.
The standard supports YAML and JSON. Teams working with Git usually choose YAML for readable pull-request diffs without extra braces, inline comments, and faster editing by analysts and technical writers. Documentation works best when the OpenAPI specification sits directly inside written guides: a developer opens the "Authentication" page and immediately sees the schema for POST /oauth/token, without jumping to a separate Swagger UI instance.
How to maintain API documentation with Docs as Code
Docs as Code is an approach where the OpenAPI specification and written guides live in Git, go through pull-request reviews, and publish automatically. We covered the approach itself in Docs as Code — is it Easy?.
In practice, engineering teams reach Docs as Code via one of two workflows:
- Code-first. In a microservices setup, specifications are generated automatically from code annotations (Springdoc, FastAPI, Swashbuckle, ogen) during CI, and a pipeline collects the updated YAML files from service repositories into a central documentation catalog.
- Design-first. An architect or systems analyst designs and reviews the
openapi.yamlcontract in Git first, and developers generate models and implement endpoints from the approved spec.
To keep API documentation aligned with production, both workflows rely on four practices:
- Pairing contracts and guides in Git. Markdown articles and
.yamlfiles live in one documentation catalog (or sync there from service repos via CI). When an endpoint changes, the team updates the related guide in the same release cycle. - Splitting large specifications with
$ref. In a mature product, a single spec can grow to thousands of lines. Shared data models, parameters, and endpoint groups are extracted into separate YAML files and linked with$ref. - Automated linting and breaking-change checks. Before merging, linters such as Spectral or Redocly CLI check syntax, required descriptions, and naming conventions, while diff tools like oasdiff catch breaking contract changes before release.
- Versioning alongside releases. When customers use API v1 and API v2 at the same time, documentation for each supported version lives in its own Git branch or catalog version, so updating v2 never overwrites the reference for v1.
This keeps the reference accurate, though it carries an organizational cost: the platform team has to maintain a static site generator, OpenAPI plugins, and build pipelines, while technical writers and analysts must work with Markdown and Git branches alongside developers.
How to publish API documentation on a portal
A documentation portal is a website where internal teams, customers, and partners read guides and explore the API reference. To help developers find answers on their own and reduce support tickets, a portal needs to handle five jobs:
- Connected guides and reference. The Quickstart links straight to the relevant methods, and the OpenAPI specification is embedded directly in the article rather than hosted on a separate subdomain.
- Search and method navigation. A large API has dozens of endpoints, so readers need fast search across operations and a sidebar outline of methods.
- Interactive test requests. Developers paste a key or token, adjust parameters, and send a request right from the documentation page. For browser-based testing, make sure CORS is configured on your sandbox gateway — or use a desktop client without browser CORS limits.
- API version switching. Readers select the product version they use on the portal and see the exact endpoints and schemas that apply to it.
- Access control and private deployment. In B2B, some APIs are public, some are restricted to NDA partners, and some are internal only. The portal needs catalog-level permissions, corporate SSO, and self-hosting when security requires it.
For enterprise sign-offs and contract handovers, clean PDF export of articles and schemas is a useful addition.
Starter API catalog structure and quick test with openapi.yaml
To combine written guides and an OpenAPI reference without maintaining a custom static site generator, organize your catalog into four sections:
- Quickstart. Authentication, token retrieval, a working
curlcall, and expected JSON output. - Authentication and scopes. Bearer token and OAuth 2.0 flows, permission scopes, and token rotation.
- Errors and rate limits. Standard error payload (
code,message,request_id), rate-limit headers, and retry guidance. - API Reference. Domain articles (
Orders,Payments,Webhooks) with embedded OpenAPI blocks and shared schemas in aschemas/folder linked via$ref.
If you do not have a spec handy, test with this starter openapi.yaml:
openapi: 3.0.3
info:
title: Orders API
version: 1.0.0
servers:
- url: https://api.example.com/v1
paths:
/orders:
get:
tags: [Orders]
summary: List orders
security:
- BearerAuth: []
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Order"
"401":
description: Unauthorized
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
schemas:
Order:
type: object
properties:
id:
type: string
status:
type: stringYou can test how your specification renders inside a guide in three steps:
- Open the Gramax app and create a new catalog (a single YAML file works straight in the browser; for multi-file
$refspecs, connect your Git repository or open the folder locally in the desktop app). - Insert an OpenAPI block. In the bottom editor toolbar, open the tools menu, choose OpenAPI, and upload or pick your
.yamlfile. - Check navigation and test requests. Confirm that methods appear in the right-hand outline, search across operations works, and the test request dialog passes your authorization token.

How Gramax helps
Gramax is a Docs as Code platform for technical documentation where OpenAPI specifications embed directly into Markdown articles and live alongside guides in a Git repository. Developers edit YAML and Markdown in their IDE and push specs through CI, while technical writers and analysts work in a visual editor without touching the command line.
- OpenAPI specifications inside the article. Gramax renders YAML specifications with its own built-in component, no separate Swagger UI required. You can try a live example without signing up on the OpenAPI page in Gramax documentation.
- Multi-file specifications with
$ref. When a contract is split across multiple YAML files with external and nested$reflinks, Gramax resolves them automatically without manual bundling. - Search, navigation, and clear validation errors. The built-in component searches across operations, lists methods in the right-hand panel, and highlights YAML validation errors.
- Test requests from the page. Developers send requests right from an article in the browser or desktop app (where requests bypass browser CORS restrictions). The authorization dialog accepts a ready Bearer, OAuth 2.0, or OpenID Connect token and sends it straight in the request header.
- Portal, permissions, and self-hosting. Markdown guides sit next to Mermaid, PlantUML, and draw.io diagrams. Readers switch catalog versions on the portal based on Git branches or tags, access to private APIs is controlled via roles and corporate SSO, and the portal can be self-hosted on your own servers with clean PDF export.

- AI agent assistance for descriptions and guides. The Gramax AI agent helps write clear parameter descriptions and payload examples from an existing spec, updates written guides after code changes, or drafts an initial YAML file for legacy services that lack a spec. In a self-hosted setup, you can connect a local model so code and schemas stay inside your network. A human reviews every change before publishing.
Gramax does not generate client SDKs or mock servers, does not replace scenario-testing tools like Postman, and does not run an interactive OAuth 2.0 token-exchange flow inside the widget — if automated SDK generation or heavy custom frontend theming is your top priority, standalone spec renderers like Redocly or Scalar are a better fit. For a comparison of general Docs as Code platforms, see Gramax, Docusaurus, MkDocs, and GitBook.
Frequently asked questions
How do you combine OpenAPI specs from dozens of microservices into one portal?
In a code-first setup, each microservice generates its specification during CI and pushes the updated YAML file to a shared documentation repository. Inside the portal catalog, service specs sit in dedicated sections alongside cross-cutting guides on authentication and integration.
How do you avoid CORS errors when sending test requests from a docs page?
When a developer sends a request from a browser-based portal, the browser checks CORS headers on the API server. For a public sandbox, add the docs portal domain to Access-Control-Allow-Origin; for internal APIs, use a gateway proxy or the Gramax desktop app, which sends requests without browser CORS restrictions.
How do you catch breaking changes in OpenAPI before a release?
Add two checks to your CI pipeline: a linter such as Spectral or Redocly CLI for style and required descriptions, and a contract diff tool like oasdiff comparing the branch against main. If a removed field or changed data type breaks backward compatibility, the pipeline fails before merge.
Can you store a large OpenAPI specification across multiple files?
Yes. OpenAPI lets you split a contract into multiple YAML files and link them with $ref. This makes Git reviews easier to follow, and tools with external and nested $ref support, including Gramax, render the specification without manual bundling.