Design Principle
An API reference is not complete just because an OpenAPI schema is rendered. It is an operating surface for developers and must support discovery, first calls, auth setup, error recovery, copied examples, try-it safety, and version trust.
Large Theory
An API reference endpoint page puts machine-readable specification, human reading flow, and executable examples into one interface. A healthy endpoint page answers what the endpoint does, what method/path it uses, which auth scopes it needs, which parameters are required, how to build the body, what success and failure return, how to recover from errors, whether it can be safely tried, and whether examples can be copied directly.
Small Points
- The first viewport must show endpoint identity: method, path, summary, operationId/tag, version, stability, deprecation notes, and source spec.
- Group parameters by path, query, header, and cookie; put required items first; each item needs type, description, default, enum/format, constraint, and example.
- Pair request body schema with example, especially nested required fields, content type, nullable behavior, file upload, validation, and idempotency.
- Responses cannot stop at 200. Use a status-code matrix for 2xx, validation/auth/permission, not found/conflict, rate limit, async accepted, and 5xx, including recovery and retry safety.
- Try-it consoles should default to sandbox or clearly show environment. Write methods such as POST, PATCH, and DELETE need confirmation, and real secrets, customer IDs, or production writes must not be treated as ordinary examples.
- Code examples should use the code-copy contract: cURL/SDK tabs, placeholders, copyText, copy feedback, syntax highlighting, failure fallback, and mobile local scrolling.
- Three-panel API docs scan well on desktop, but mobile and 200% zoom need a stable single-column flow. Schema and code can scroll locally; the page should not overflow horizontally.
Design Judgment
The API reference contract works when a developer can understand the endpoint, configure auth, fill parameters, copy examples, run a sandbox request, read success/error responses, and find the next recovery action from one page. A page with only a path list and a 200 example is still incomplete.
Implementation Notes
Create an ApiEndpointContract: id, method, path, summary, auth, parameters, requestBody, responses, examples, tryIt, pagination, rateLimitNote, sourceSpecHref, and renderer. Even with generated renderers, perform manual QA: examples match schema, status matrix is complete, destructive try-it is protected, auth placeholders are safe, logs avoid secrets, tabs work by keyboard, mobile schema tables work, copy fallback exists, and the source spec is linked. Choose renderer by task: Swagger UI for standards-based interactive OpenAPI exploration, Redoc for a three-panel static reference, and Scalar for a modern self-hosted reference/API client.
Counterexamples/Risks
Showing only the 200 response, hiding auth scope at the bottom, mixing all parameter locations in one table, letting try-it hit production write endpoints by default, copying line numbers and shell prompts from cURL examples, letting error schema drift from the real API, covering mobile prose with a right examples rail, and allowing manual examples to go stale after OpenAPI changes.
Case Study
The OpenAPI Specification defines an API surface as a language-agnostic interface understandable by humans and computers, with structures such as paths, components, and webhooks. Swagger UI visualizes and lets users interact with OpenAPI resources, which fits standards-based try-it exploration. Redoc's default three-panel layout separates left search/navigation, central documentation, and right request/response examples, showing that endpoint reference needs locating, reading, and example comparison together. Scalar combines API reference and an API client in an open-source platform, showing that modern docs increasingly approach executable debugging surfaces. The reusable lesson is that schema, layout, and try-it are not separate answers; the endpoint page needs a safe, readable, executable contract.
Source Links
OpenAPI Specification: https://swagger.io/specification/ OpenAPI Initiative GitHub: https://github.com/oai/openapi-specification Swagger UI: https://swagger.io/tools/swagger-ui/ Swagger UI GitHub: https://github.com/swagger-api/swagger-ui Redoc docs: https://redocly.com/docs/redoc Redoc GitHub: https://github.com/Redocly/redoc Scalar: https://scalar.com/ Scalar GitHub: https://github.com/scalar/scalar WAI-ARIA APG Tabs: https://www.w3.org/WAI/ARIA/apg/patterns/tabs/ WCAG Reflow: https://www.w3.org/WAI/WCAG21/Understanding/reflow.html
Agent Directive
Before generating API reference, output an ApiEndpointContract and status-code matrix; implementation must protect try-it safety, real secrets, copy examples, mobile schemas, and the source-spec update path.