Coding
TEXT
API Error Response Designer
October 2, 2025
Optimized for:
gpt-4o
API development, error handling, developer experience
Design comprehensive API error response:
```json
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": "Detailed explanation",
"timestamp": "2025-10-02T02:00:00Z",
"request_id": "uuid",
"documentation_url": "https://docs.example.com/errors/ERROR_CODE",
"field_errors": [
{
"field": "email",
"message": "Invalid email format",
"code": "INVALID_FORMAT"
}
]
}
}
```
**Error Categories**:
- 4xx Client Errors: Authentication, validation, not found
- 5xx Server Errors: Internal, service unavailable, timeout
**Best Practices**:
- Use consistent error codes
- Provide actionable messages
- Include request tracking
- Add documentation links
- Never expose sensitive data
API error response design with best practices and consistent structure.
Submit your own AI prompts to the community. The best ones get featured on TokenCalculator - and credited to you.