Error Handling
Understanding and handling Nudg3 API errors
Error Handling
The Nudg3 API uses conventional HTTP response codes to indicate the success or failure of an API request. This guide covers all error types and how to handle them.
Error Response Format
All errors follow a consistent JSON format:
| Field | Type | Description |
|---|---|---|
success | boolean | Always false for errors |
error.code | string | Machine-readable error code |
error.message | string | Human-readable description |
error.details | object | Additional error context (optional) |
HTTP Status Codes
2xx Success
| Code | Description |
|---|---|
| 200 | Request succeeded |
| 201 | Resource created |
| 204 | No content (successful deletion) |
4xx Client Errors
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Authentication failed |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesn't exist |
| 422 | Unprocessable Entity - Validation error |
| 429 | Too Many Requests - Rate limit exceeded |
5xx Server Errors
| Code | Description |
|---|---|
| 500 | Internal Server Error |
| 502 | Bad Gateway |
| 503 | Service Unavailable |
| 504 | Gateway Timeout |
Common Error Codes
Authentication Errors (401)
| Code | Message | Solution |
|---|---|---|
invalid_api_key | API key is invalid or malformed | Check key format starts with nudg3_ |
expired_api_key | API key has been revoked | Generate a new key |
missing_api_key | No API key provided | Include Authorization header |
Permission Errors (403)
| Code | Message | Solution |
|---|---|---|
insufficient_scope | Key lacks required scope | Create key with required scopes |
ip_not_allowed | Request from non-allowlisted IP | Update IP allowlist or use VPN |
workspace_access_denied | No access to this workspace | Check workspace membership |
Validation Errors (400/422)
| Code | Message | Solution |
|---|---|---|
validation_error | One or more fields are invalid | Check details.errors for specifics |
invalid_uuid | Invalid UUID format | Use valid UUID format |
invalid_date_range | end_date before start_date | Fix date order |
missing_required_field | Required field is missing | Include required parameters |
Rate Limit Errors (429)
| Code | Message | Solution |
|---|---|---|
rate_limit_exceeded | Too many requests | Wait and retry with backoff |
export_limit_exceeded | Export rate limit hit | Wait 1 hour or reduce exports |
Resource Errors (404)
| Code | Message | Solution |
|---|---|---|
resource_not_found | Resource doesn't exist | Verify resource ID is correct |
workspace_not_found | Workspace doesn't exist | Check workspace_id parameter |
Server Errors (5xx)
| Code | Message | Solution |
|---|---|---|
internal_error | Server error | Retry with backoff, contact support if persistent |
service_unavailable | Service temporarily down | Retry after a few minutes |
export_service_error | Export service unavailable | Retry export later |
Error Handling Best Practices
Implement Retry Logic
For transient errors (429, 5xx), implement exponential backoff:
Handle Specific Errors
Log Errors for Debugging
Include request IDs in error logs for support tickets:
Brute Force Protection
The API implements brute force protection for authentication:
| Condition | Action |
|---|---|
| 10 failed auth attempts | IP blocked for 1 hour |
| Repeated blocks | Progressive blocking periods |
If blocked, you'll receive:
Getting Help
If you encounter persistent errors:
- Check the error code and message
- Review this documentation for solutions
- Include the
request_idwhen contacting support - Provide the full error response and request details