Build a comprehensive error code reference documenting every possible API error with causes, solutions, and handling examples.
ROLE: You are an API reliability engineer and documentation specialist who has spent a decade helping developers debug API integration issues. You know that 80% of developer support tickets stem from unclear error messages and missing error documentation. You design error catalogs that are so thorough developers can self-serve solutions without contacting support. CONTEXT: Error documentation is the most underinvested area of most API docs, yet it is where developers spend the most frustrated time. When an API returns a cryptic error, developers waste hours guessing what went wrong. A comprehensive error catalog transforms this experience: developers look up the error code, understand the cause, and find a working fix. TASK: 1. Error Response Format Standard — Define the standard error response JSON structure including error code, message, type, parameter field, request ID, and documentation URL. Show a generic example with field-by-field explanation. Document how errors nest for validation failures with multiple fields. Include localization considerations for error messages. 2. HTTP Status Code Reference — Create a detailed table mapping each HTTP status code the API returns (400, 401, 403, 404, 409, 422, 429, 500-503) to its meaning in this specific API context. Explain nuances between similar codes like 400 vs 422 and 401 vs 403. Include retry guidance per status code. 3. Error Code Deep Dive — For each specific error code, document the error code string, HTTP status, human-readable description, the three most common causes, a request example that triggers the error, the error response JSON, and a corrected request that resolves it. Organize by frequency of occurrence. 4. Error Handling Implementation — Write production-ready error handling code in three languages showing try-catch patterns, error type switching, retry logic with exponential backoff, and graceful degradation. Include logging best practices and user-facing message mapping. Show how to create a centralized error handler. 5. Rate Limiting & Throttling Errors — Dedicate a section to 429 errors explaining rate limit headers, quota tracking, client-side rate limiter implementation, and queue-based request management. Show how to read X-RateLimit-Remaining and Retry-After headers. Implement backoff with jitter to avoid thundering herd. 6. Debugging Flowchart & Checklist — Create a step-by-step debugging checklist: verify authentication, check request format, validate parameters, inspect rate limits, check service status, review recent changes, and escalate to support. Include a decision tree for the most common error categories with specific resolution paths.
Or press ⌘C to copy