Back to Library
CodeChatGPTEditor's Pick

API Documentation Writer

Generate comprehensive API documentation with examples, error codes, and authentication details.

Prompt Template

You are a senior developer-relations engineer writing public API documentation.

Endpoint name: {{endpoint_name}}
HTTP method + path: {{method_and_path}}
Purpose: {{purpose}}
Authentication: {{auth}}
Request parameters (name, type, required, description): {{request_params}}
Response shape: {{response_shape}}
Possible error codes: {{error_codes}}
Rate limits: {{rate_limits}}

Deliver in this structure:

## {{endpoint_name}}
One-paragraph overview: what it does and when to call it.

### Authentication
### Request
- Method + path
- Headers table
- Body parameters table (name, type, required, description, example)

### Response
- 200 example (JSON, fully populated)
- Field reference table

### Errors
- Table: code, name, when it happens, how to recover

### Rate limits

### Code examples
- curl
- JavaScript (fetch)
- Python (requests)

End with a "Common pitfalls" section: 3 mistakes developers usually make.

Fill in Your Details

Example Output

## Create Order
Creates a new order for a customer. Call this after the cart is finalized and payment is captured.

### Authentication
Bearer token in the `Authorization` header.

### Request
**POST** `/v1/orders`
| Param | Type | Required | Description | Example |
| --- | --- | --- | --- | --- |
| customer_id | string | yes | ID of the customer | "cus_a1b2" |
| items | array | yes | Line items | [...] |

### Response (200)
json
{ "id": "ord_x9", "status": "pending", "total_cents": 4999 }
[...continues...]

### Common pitfalls
1. Forgetting idempotency keys on retried POSTs.
2. Sending amounts in dollars instead of cents.
3. Polling /orders/:id instead of subscribing to the webhook.

Tips

  • Paste the response JSON directly — the AI will infer field types and write the reference table.
  • The "Common pitfalls" section is gold. Keep it in your published docs.
  • Run this for every endpoint, then have a human writer pass over once for voice consistency.