Proper error handling is essential for building robust integrations with the G-Tateth API. This guide covers all error types, status codes, and best practices.
HTTP Status Codes
The G-Tateth API uses standard HTTP status codes to indicate success or failure:
Success Codes
- 200 OK - Request succeeded
- 201 Created - Resource created successfully
- 204 No Content - Request succeeded, no content to return
Client Error Codes
- 400 Bad Request - Invalid request parameters or malformed JSON
- 401 Unauthorized - Missing or invalid authentication
- 403 Forbidden - Insufficient permissions
- 404 Not Found - Resource doesn’t exist
- 409 Conflict - Resource conflict (e.g., duplicate entry)
- 422 Unprocessable Entity - Validation errors
- 429 Too Many Requests - Rate limit exceeded
Server Error Codes
- 500 Internal Server Error - Unexpected server error
- 502 Bad Gateway - Upstream service error
- 503 Service Unavailable - Service temporarily unavailable
- 504 Gateway Timeout - Request timeout
All error responses follow a consistent format:
Common Error Codes
Authentication Errors
Always check authentication before making requests.
AUTH_REQUIRED
Status: 401 Unauthorized
Solution:
AUTH_INVALID
Status: 401 Unauthorized
Solution: Verify your API key is correct and hasn’t been revoked.
AUTH_EXPIRED
Status: 401 Unauthorized
Solution: Refresh your token or generate a new API key.
Validation Errors
VALIDATION_ERROR
Status: 422 Unprocessable Entity
Solution: Fix the validation errors and retry the request.
Rate Limiting
RATE_LIMIT_EXCEEDED
Status: 429 Too Many Requests
Solution: Wait until resetAt or upgrade your plan for higher limits.
Resource Errors
RESOURCE_NOT_FOUND
Status: 404 Not Found
Solution: Verify the resource ID exists and you have access to it.
RESOURCE_CONFLICT
Status: 409 Conflict
Solution: Use a different identifier or update the existing resource.
Permission Errors
PERMISSION_DENIED
Status: 403 Forbidden
Solution: Use an API key with the required permissions or contact your administrator.
Plan Limits
PLAN_LIMIT_EXCEEDED
Status: 403 Forbidden
Solution: Upgrade your plan or wait for the next billing cycle.
Error Handling Examples
JavaScript/TypeScript
Python
PHP
Retry Logic
Implement exponential backoff for retryable errors:
Best Practices
1. Always Check Response Status
2. Handle Network Errors
3. Log Errors for Debugging
4. Provide User-Friendly Messages
5. Use Request IDs for Support
Always include the requestId when contacting support:
Testing Error Handling
Test your error handling with different scenarios:
Support
If you encounter an error that isn’t documented here:
- Check the error
requestId in the response
- Review the error
details for additional context
- Contact support with the
requestId and error details
- Check our status page for service issues
Support Email: support@g-tateth.com