Skip to main content

Error Handling

Posthoot API uses standard HTTP status codes and provides detailed error messages to help you understand and resolve issues.

📋 HTTP Status Codes

2xx Success

  • 200 OK: Request successful
  • 201 Created: Resource created successfully

4xx Client Errors

  • 400 Bad Request: Invalid request data
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 409 Conflict: Resource conflict
  • 422 Unprocessable Entity: Validation errors
  • 429 Too Many Requests: Rate limit exceeded

5xx Server Errors

  • 500 Internal Server Error: Server error
  • 502 Bad Gateway: Gateway error
  • 503 Service Unavailable: Service temporarily unavailable

🚨 Error Response Format

All error responses follow this format:

🔍 Common Error Types

Validation Errors (400)

Authentication Errors (401)

Permission Errors (403)

Not Found Errors (404)

Rate Limit Errors (429)

🛠️ Error Handling Examples

JavaScript/Node.js

Python

cURL

🔄 Retry Strategies

Exponential Backoff

Circuit Breaker

📊 Error Monitoring

Log Errors

Error Tracking

🛡️ Best Practices

1. Always Check Status Codes

2. Handle Specific Error Types

3. Provide User-Friendly Messages

4. Implement Proper Logging