By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
A practical, portfolio-ready guide for aspiring and modernizing technical writers
API documentation is the instruction manual for developers using your API—it explains endpoints, parameters, authentication, and error codes. Without clear docs, even the best API is unusable.Example: Stripe’s API reference lets developers integrate payments in minutes by showing request/response examples, SDK snippets, and interactive testing. This guide covers tools to design, test, and publish API docs efficiently, whether you’re documenting a REST API for a fintech startup or a cloud service’s SDK.
OpenAPI (formerly Swagger): A machine-readable specification (YAML/JSON) to describe REST APIs. Enables auto-generated docs, client SDKs, and server stubs. Tools: SwaggerHub, Redocly, Stoplight.
Swagger UI: An open-source tool that renders OpenAPI specs as interactive docs (try it at petstore.swagger.io). Lets users test endpoints directly in the browser.
ReDoc: A sleek, three-panel alternative to Swagger UI (used by Microsoft, GitHub). Focuses on readability with collapsible sections and Markdown support.
SwaggerHub: A SaaS platform by SmartBear for hosting, collaborating on, and publishing OpenAPI specs. Integrates with CI/CD pipelines and version control.
Redocly: A suite of tools (CLI, editor, hosting) for OpenAPI workflows. Includes redoc-cli to generate static docs and redocly lint to validate specs.
redoc-cli
redocly lint
Postman: A collaboration platform for API development. Lets you test endpoints, generate docs from collections, and mock APIs. Key feature: Postman’s "Publish Docs" button auto-generates a public portal.
Docs-as-Code: Treating docs like code—stored in Git, written in Markdown/AsciiDoc, built with static site generators (e.g., Docusaurus, MkDocs), and reviewed via pull requests.
API Blueprint: A Markdown-based alternative to OpenAPI (used by Apiary). Less common but simpler for quick prototyping.
Static Site Generators (SSGs): Tools like Docusaurus, Hugo, or MkDocs that convert Markdown files into fast, versioned documentation sites. Example: Stripe’s docs use a custom SSG.
Mock Servers: Simulate API responses before the backend is ready. Tools: Postman Mock Servers, Prism (by Stoplight), SwaggerHub Mocking.
SDKs (Software Development Kits): Language-specific libraries (e.g., Python, Java) that wrap API calls. Docs should include SDK installation and usage examples.
Webhooks: "Reverse APIs" where the server sends data to a client’s URL. Docs must explain event payloads, authentication, and retry logic.
How to document an API from scratch (or update existing docs):
create-openapi-repo
Pro tip: Use redocly lint to catch errors early (e.g., missing description fields).
description
Test the API
Example: Test a GET /users endpoint with query params like ?limit=10.
GET /users
?limit=10
Write the Docs
examples
x-codeSamples
# Authentication
Pro tip: Use Mermaid.js in Markdown to add sequence diagrams (e.g., OAuth flow).
Generate & Style the Docs
redoc-cli build openapi.yaml
Example: Twilio’s API docs use ReDoc with a custom theme.
Add Tutorials & Guides
Example: Stripe’s "Build a Subscription Service" tutorial.
Review & Deploy
Mistake: Writing docs after the API is built. Correction: Collaborate with developers during design (e.g., review the OpenAPI spec before coding). Why: Early feedback catches inconsistencies (e.g., naming conventions, missing error codes).
Mistake: Assuming the OpenAPI spec is "self-documenting." Correction: Add human-readable descriptions for every endpoint, parameter, and response. Why: A spec is for machines; docs are for humans. Example: Instead of GET /users, write: yaml description: | Retrieves a paginated list of users. Use `limit` and `offset` for pagination. Example: `GET /users?limit=10&offset=20`
yaml description: | Retrieves a paginated list of users. Use `limit` and `offset` for pagination. Example: `GET /users?limit=10&offset=20`
Mistake: Only showing curl examples. Correction: Include SDK snippets (Python, JavaScript, etc.) and Postman collections. Why: Developers prefer copy-paste-ready code. Example: javascript // Node.js example using Stripe SDK const stripe = require('stripe')('sk_test_123'); const customers = await stripe.customers.list({ limit: 10 });
curl
javascript // Node.js example using Stripe SDK const stripe = require('stripe')('sk_test_123'); const customers = await stripe.customers.list({ limit: 10 });
Mistake: Ignoring error codes. Correction: Document every HTTP status code (e.g., 401 Unauthorized, 429 Too Many Requests) with examples. Why: Developers need to handle errors gracefully. Example: yaml responses: '401': description: Unauthorized. Missing or invalid API key. content: application/json: example: { "error": "Invalid API key" }
401 Unauthorized
429 Too Many Requests
yaml responses: '401': description: Unauthorized. Missing or invalid API key. content: application/json: example: { "error": "Invalid API key" }
Mistake: Not versioning docs. Correction: Use semantic versioning (e.g., v1, v2) and deprecation notices. Why: Breaking changes break apps. Example: Add a banner:
v1
v2
⚠️ Deprecation Notice: GET /v1/users will be removed on 2024-06-01. Migrate to GET /v2/users.
GET /v1/users
GET /v2/users
Process: Explain how you collaborate with developers (e.g., "I review OpenAPI specs in PRs and test endpoints in Postman").
Tricky Distinctions:
Tutorial vs. How-To:
Portfolio Project Ideas:
Scenario: A developer complains that the API docs are outdated. How would you ensure docs stay in sync with code? Answer: Set up CI/CD pipelines to auto-generate docs from the OpenAPI spec on every code merge. Why: Automation reduces human error and keeps docs current.
Scenario: Your team uses Postman for API development but wants to switch to OpenAPI. How would you migrate the docs? Answer: Export the Postman collection to OpenAPI (Postman supports this natively), then use Redocly or SwaggerHub to generate docs. Why: OpenAPI is the industry standard for machine-readable specs.
Scenario: A stakeholder asks, "Why can’t we just use Swagger UI for our entire documentation site?" What’s your response? Answer: Swagger UI is great for reference docs but lacks support for tutorials, guides, or conceptual content. Use a static site generator (e.g., Docusaurus) to combine Swagger UI with other doc types. Why: Developers need more than just endpoint lists—they need examples, use cases, and troubleshooting tips.
webhooks
|
description: |
400
401
500
Next Steps:- Try documenting a public API (e.g., GitHub, Spotify) using SwaggerHub or Postman.- Build a portfolio project combining API reference + tutorial (e.g., "Build a Weather App with OpenWeatherMap API").- Explore Redocly’s CLI (npm install -g @redocly/cli) to lint and generate docs locally.
npm install -g @redocly/cli
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.