API documentation
Prepare a clean API example
Format the cURL command, redact secrets, validate JSON bodies, and keep only the headers required to reproduce the behavior.
Goal: Share a request example without leaking tokens or confusing the reader.
Workflow steps
Step 1
Format the cURL command
Break a one-line command into method, URL, headers, and body so reviewers can read it quickly.
Step 2
Redact credentials
Replace tokens, cookies, API keys, emails, account IDs, and private hostnames with placeholders.
Step 3
Validate the body
If the request body is JSON, format and validate it before publishing the example.
Step 4
Keep only relevant headers
Include content type, authorization placeholder, and any header required to reproduce the behavior.
Real examples
Safe header
Authorization: Bearer <redacted-token>Readable JSON body
{
"email": "user@example.com",
"role": "editor"
}Common pitfalls
Copying browser-generated headers that are irrelevant.
Leaving live bearer tokens in docs.
Publishing invalid JSON in examples.