API Documentation Generator (Developer-Friendly Reference)

This prompt generates comprehensive API documentation with clear endpoint descriptions, request/response examples, authentication details, and error handling. It balances technical accuracy with usability, helping developers understand and implement APIs quickly.

GPT / Claude / Gemini5 variables
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}
Quick brief
Purpose

Create clear API documentation that helps developers integrate successfully.

Expected output

API documentation containing: overview and base URL, authentication guide with examples, endpoint reference with all parameters, request/response examples in multiple formats, error code reference, rate limiting details, common use case tutorials, and changelog for updates.

Customize before copying

Replace these placeholders with your own context before you run the prompt.

{API_NAME}{TYPE}{BASE_URL}{AUTH_METHOD}{ENDPOINTS}
Works well with
GPT
Claude
Gemini
Variations
Add webhook documentation section.
Include SDK examples if available.
Make it GraphQL-specific (schema, queries, mutations).
Add interactive API explorer links.
What this prompt helps you do
This prompt generates comprehensive API documentation with clear endpoint descriptions, request/response examples, authentication details, and error handling. It balances technical accuracy with usability, helping developers understand and implement APIs quickly.
When to use it
Use when documenting REST APIs, GraphQL APIs, webhooks, SDKs, or any developer-facing interfaces. Essential for external APIs, internal microservices, or partner integrations.
How it works
The prompt structures documentation with: overview and authentication, endpoint reference with parameters, request/response examples in multiple languages, error codes and handling, rate limits and best practices, and quickstart guide for common use cases.
Best practices
Start with quickstart for common use case. Provide working code examples in popular languages. Show both success and error responses. Document all parameters including optional ones. Include rate limits and authentication upfront. Keep examples up to date with API changes.
Common mistakes
Assuming too much developer knowledge. Only documenting happy path, ignoring errors. Outdated examples that don't work. Missing authentication details. No explanation of why parameters exist. Jargon without explanation. Not testing examples before publishing.
What you should expect back
API documentation containing: overview and base URL, authentication guide with examples, endpoint reference with all parameters, request/response examples in multiple formats, error code reference, rate limiting details, common use case tutorials, and changelog for updates.
Limitations
Can't replace actually testing the API. Requires technical accuracy which must be verified. May need developer review for completeness. Examples may need language-specific updates. Can't cover every possible integration scenario.
Model notes
Compatible with all major models. GPT creates clear parameter tables. Claude provides thorough examples. Gemini sometimes suggests helpful code snippets. Works for any API type or protocol.
Real-world applications
Platform teams use this for public APIs. Backend engineers use it for internal services. Developer advocates use it for partner integrations. SaaS companies use it for programmatic access. Open source projects use it for contributor onboarding.
How to tell if it worked
Successful docs mean developers integrate successfully without support tickets, time-to-first-API-call decreases, error rates are low due to clear guidance, and developers reference docs repeatedly. High support volume on basics signals doc gaps.
Where to go next
Use Technical Explainer for concept documentation. Pair with Tutorial Writer for integration guides. Follow with SDK documentation if applicable.