API Documentation Generator (Developer-Friendly Reference)

Create clear API documentation that helps developers integrate successfully.

Prompt
Generate API documentation for {API_NAME}.

Input:
- API name: {API_NAME}
- API type: {TYPE} (REST/GraphQL/WebSocket)
- Base URL: {BASE_URL}
- Authentication: {AUTH_METHOD}
- Key endpoints: {ENDPOINTS}

Rules:
- Start with quickstart example
- Include request/response for every endpoint
- Document all parameters and their types
- Show error responses
- Provide code examples in multiple languages

Output format:

# {API_NAME} API Documentation

## Overview
[Brief description of what this API does]

Base URL: `{BASE_URL}`
Version: [Current version]
Protocol: [REST/GraphQL/etc.]

## Quickstart

Get started in 5 minutes:

```bash
# 1. Get your API key from [where]
# 2. Make your first request
curl -X GET "{BASE_URL}/endpoint" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Expected response:
```json
{
  "status": "success",
  "data": {...}
}
```

## Authentication

This API uses [authentication method].

### Getting your API key
1. [Step to obtain key]
2. [Step to activate]

### Making authenticated requests

```javascript
// JavaScript example
const response = await fetch('{BASE_URL}/endpoint', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});
```

```python
# Python example
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
}
response = requests.get('{BASE_URL}/endpoint', headers=headers)
```

## Endpoints

### [Endpoint 1: Description]

`GET /endpoint/path`

Description: [What this endpoint does]

#### Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| param1 | string | Yes | [What this is] |
| param2 | integer | No | [What this is]. Default: [X] |

#### Request example

```bash
curl -X GET "{BASE_URL}/endpoint?param1=value&param2=123" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

#### Response example (200 OK)

```json
{
  "status": "success",
  "data": {
    "field1": "value",
    "field2": 123
  },
  "meta": {
    "timestamp": "2026-02-03T10:00:00Z"
  }
}
```

#### Error responses

**400 Bad Request**
```json
{
  "status": "error",
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "param1 is required"
  }
}
```

**401 Unauthorized**
```json
{
  "status": "error",
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}
```

### [Endpoint 2: Description]
[Repeat structure...]

## Error Codes

| Code | HTTP Status | Description | Resolution |
|------|-------------|-------------|------------|
| UNAUTHORIZED | 401 | Invalid API key | Check your API key |
| RATE_LIMITED | 429 | Too many requests | Wait before retrying |
| INVALID_PARAMETER | 400 | Bad request parameter | Check parameter format |

## Rate Limiting

- Limit: [X requests per minute]
- Headers returned:
  - `X-RateLimit-Limit`: Total allowed
  - `X-RateLimit-Remaining`: Remaining in window
  - `X-RateLimit-Reset`: Unix timestamp when limit resets

When rate limited:
```json
{
  "status": "error",
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded. Retry after 60 seconds."
  }
}
```

## Best Practices

1. **Use appropriate HTTP methods**: GET for reading, POST for creating, etc.
2. **Handle rate limits**: Implement exponential backoff
3. **Cache responses**: When data doesn't change frequently
4. **Monitor errors**: Log all 4xx and 5xx responses

## Common Use Cases

### Use case: [Common task]
```javascript
// Complete example showing how to [accomplish task]
async function doCommonTask() {
  // Step 1: [Do this]
  const step1 = await fetch(...);
  
  // Step 2: [Then do this]
  const step2 = await fetch(...);
  
  return result;
}
```

## Changelog

**v1.1** (2026-02-01)
- Added [new endpoint]
- Improved [existing feature]

**v1.0** (2026-01-01)
- Initial release

## Support

- Documentation: [URL]
- Issues: [GitHub/Support email]
- Status page: [URL]

API: {API_NAME}
Type: {TYPE}
Variations
Add webhook documentation section.
Include SDK examples if available.
Make it GraphQL-specific (schema, queries, mutations).
Add interactive API explorer links.
Works well with
GPT
Claude
Gemini