API Documentation: Match the Request, Response and Next Action

The request says pickup_branch_id, but the response example says pickup_branch. A partner cannot tell which field to send or read.

Start by making the documented names agree with the actual contract, then show what a successful response and a known failure look like.

Put the operation and its result together

Show the method, full request path, authentication placeholder and response for the same operation. A developer should be able to compare their request and output without hunting for a field definition on another page.

The example describes a fictional library service. Its hosts, IDs, card details and behavior are illustrative, and the page sends no requests. It contains an availability lookup and a hold creation operation, with separate parameters and failure cases.

Larkspur Library reference: availability lookup and hold creation with error examples
Larkspur Library reference: availability lookup and hold creation with error examples
Open the full example ↗

Document what the caller should do after a known error. The lookup’s 404 example asks the caller to check the book ID. The hold example’s 422 response identifies pickup_branch_id as invalid and directs the caller to the documented branch values. “Request failed” would leave the next action unclear.

Keep fields and examples in agreement

The sample’s hold request uses book_id, card_id and pickup_branch_id. Its success response returns a hold ID, status and the same book and pickup-branch fields. Each request field’s type, required status and allowed values belong in the reference, not in a paragraph the caller has to infer.

Swagger’s parameter guidance distinguishes parameter locations and schemas. Its response guidance describes status codes and returned bodies or headers, including successful responses and known errors. Use those distinctions when checking your own contract.

The buttons in this example select prepared documentation cases. They do not try the endpoint, validate a token or prove a server response. Test real examples in your authorized test environment and redact secrets before publishing them.

Generate from the source you maintain

If you already maintain an OpenAPI description, update that source and regenerate the reference through your existing workflow. Keep a repository README in its repository; a review page can supplement it rather than becoming a competing source of truth.

For a small reference draft, give AI your actual contract and redacted examples. Do not ask it to guess a field, rate limit or retry rule. If a partner requires a signed PDF or other review format, retain that delivery requirement.

Create a self-contained HTML API reference review page using my contract.
Name, purpose and audience: [PASTE]
Base URL and version: [PASTE]
Authentication method and placeholder header: [PASTE WITHOUT SECRETS]
Operations: [METHOD | FULL PATH | PURPOSE]
Parameters/body fields: [NAME | LOCATION | TYPE | REQUIRED | ALLOWED VALUES OR DEFAULT WHEN DEFINED]
Redacted request/response examples per operation: [PASTE EXACTLY]
Known errors and caller next actions: [STATUS | ERROR CODE | FIELD IF ANY | NEXT ACTION]
Source contract/repository and changelog: [PASTE]
Required delivery format: [PASTE]

Use only my facts. Do not invent endpoints, fields, status codes, limits, defaults, authentication, retry rules or changelog dates. Show missing facts as [TO CONFIRM]. Preserve examples exactly and flag disagreement with field definitions rather than correcting it silently. Replace any accidental secret with a clear placeholder and list that replacement.
Put overview and authentication first, then distinct operation sections with field tables and request/response code blocks, next-action guidance for known errors and supplied change history. Use real captions and scoped table headers, at least 16px body text and legible code. At360px stack labeled field rows and wrap code without horizontal page overflow. If buttons select prepared cases, use native buttons with announced pressed states and visible focus; never call them Try it. Keep CSS and local view-switch script in the file. No external assets, requests, forms, token entry, fake copy/save controls or live service calls. Return HTML and unresolved contract conflicts; retain the authoritative contract and required delivery workflow.

Fix the source after a caller’s question

Ask another developer to identify the field causing the validation error and the value they would send next. If they cannot, use their question to correct the field definition and the request example together.

Open an HTML review copy in NOS for that field check, with the request, response and definition visible together. Use the caller’s question to revise the authoritative contract and regenerate your maintained reference before sending the correction.

Send the corrected reference with a note naming the changed field. Update its authoritative source too. Ask the caller to confirm the example against a permitted test call before relying on it.

Keep reading