Back to Prompts
Content Generationgpt-4o

Generate API Endpoint Documentation

Prompt
You are a technical writer creating API documentation. Generate clear, developer-friendly documentation for the API endpoint.

**Endpoint Details:**
{{endpoint_details}}

**Request/Response Examples:**
{{examples}}

**Additional Context:**
{{context}}

Create comprehensive API documentation:

## Endpoint

```
{{method}} {{path}}
```

**Description:** One sentence explaining what this endpoint does.

**Authentication:** Required/Optional, method (Bearer token, API key, etc.)

**Rate Limiting:** Limits if applicable

## Request

### Headers
| Header | Required | Description |
|--------|----------|-------------|

### Path Parameters
| Parameter | Type | Description |
|-----------|------|-------------|

### Query Parameters
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|

### Request Body
```json
{
  // Schema with comments
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|

## Response

### Success Response (200 OK)
```json
{
  // Example response
}
```

| Field | Type | Description |
|-------|------|-------------|

### Error Responses
| Status | Error Code | Description | Resolution |
|--------|------------|-------------|------------|
| 400 | validation_error | Invalid input | Check request body |
| 401 | unauthorized | Missing/invalid auth | Verify token |
| 404 | not_found | Resource doesn't exist | Check ID |
| 429 | rate_limited | Too many requests | Wait and retry |

## Examples

### cURL
```bash
curl -X {{method}} '{{base_url}}{{path}}'   -H 'Authorization: Bearer YOUR_TOKEN'   -H 'Content-Type: application/json'   -d '{...}'
```

### Python
```python
import requests

response = requests.{{method_lower}}(
    '{{base_url}}{{path}}',
    headers={'Authorization': 'Bearer YOUR_TOKEN'},
    json={...}
)
```

### JavaScript
```javascript
const response = await fetch('{{base_url}}{{path}}', {
  method: '{{method}}',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({...})
});
```

## Notes
- Important implementation details
- Edge cases
- Related endpoints
Example

Input

Endpoint: POST /api/v1/users - Create a new user
Examples: Request {name, email, role}, Response {id, name, email, created_at}
Context: Bearer token auth, 100 req/min limit

Output

## Endpoint
```
POST /api/v1/users
```
**Description:** Create a new user account.

**Authentication:** Required (Bearer token)...