Errors
The Benchmark Email API uses standard HTTP status codes and returns structured error responses to help you diagnose and handle problems.Error Response Format
All errors return a JSON body with anerrors array:
| Field | Type | Description |
|---|---|---|
errorType | string | The error class name (e.g., UnauthorizedError, ForbiddenError, ValidationError) |
message | string | A human-readable description of what went wrong |
errors array typically contains a single error object. Validation errors may include additional fields like field or fieldId to identify the problematic input.
HTTP Status Codes
| Status | Meaning | When It Happens |
|---|---|---|
400 | Bad Request | Invalid request body, missing required fields, validation failures, duplicate values |
401 | Unauthorized | Invalid, expired, or inactive API key |
403 | Forbidden | Valid key but missing required scope, or account not in good standing |
404 | Not Found | Requested resource does not exist |
429 | Too Many Requests | Hourly rate limit or monthly quota exceeded, or IP temporarily blocked |
Common Error Scenarios
Invalid API Key (401)
Returned when the API key is malformed, does not exist, or has been deleted.Expired API Key (401)
Returned when the API key’s expiration date has passed.Inactive API Key (401)
Returned when the API key has been deactivated by the account owner.Missing Required Scope (403)
Returned when the API key is valid but does not have the scope required for the requested operation. The error message tells you which scope is needed.- Edit the key’s scopes from the API Keys page to add the required permission.
- Create a new key with the appropriate scopes.
Endpoint Not Accessible via API Key (403)
Returned when the endpoint is not available for API key access (e.g., billing, user management, or admin endpoints).Account Not in Good Standing (403)
Returned when the API key is valid but the account status does not allow API access (e.g., suspended, past due, or terminated accounts).open or pending_cancel. See Authentication for details.
Resource Not Found (404)
Returned when the requested resource does not exist.Validation Error (400)
Returned when the request body fails validation (e.g., missing required fields, invalid field values).Duplicate Field (400)
Returned when the operation conflicts with existing data (e.g., creating an API key with a name that already exists).Rate Limit Exceeded (429)
Returned when the hourly rate limit or monthly quota is exceeded. See Rate Limits for full details. Hourly limit exceeded:Retry-After header indicates the number of seconds to wait before retrying. For hourly limits, this is the time until the current window resets. For monthly quotas, this is the time until the billing period resets.
IP Temporarily Blocked (429)
Returned when your IP address has been temporarily blocked due to too many failed authentication attempts.Retry-After.
Error Handling Best Practices
- Always check the status code first. Use the HTTP status to determine the category of error before parsing the response body.
-
Retry on 429 only. Use the
Retry-Afterheader to determine when to retry. Do not retry401or403errors — they will not resolve without configuration changes. -
Log the full error response. Include the
errorTypeandmessagein your logs for debugging. -
Handle scope errors proactively. If you receive a
403with a scope message, update your API key’s permissions in Settings rather than retrying the request. - Use exponential backoff for rate limits. See the Rate Limits guide for retry strategies.
Next Steps
- Rate Limits — detailed rate limiting information
- Authentication — API key setup and scopes
- API Reference — explore available resources