Error Response Format
All error responses follow a consistent structure:HTTP Status Codes
Error Codes Reference
Authentication Errors
Validation Errors
Validation errors include details about which fields failed.
details is a tree
mirroring the request body: each node has an errors array (issues at that
path), and object nodes additionally have a properties map keyed by field
name. The top-level errors array carries issues that apply to the request as a
whole.
Resource Errors
For standard resources,
GET, PUT/PATCH, and DELETE requests that
target a resource which doesn’t exist (or isn’t visible to your
organization) all return 404 with the NOT_FOUND code. Updating or
deleting a missing resource is never a 500.DNS record write operations
(PUT/DELETE /v1/domains/{id}/dns-records/{recordId}) are the exception:
they proxy Cloudflare, so a missing record surfaces the upstream status
(typically 404) with the DNS_ERROR code rather than NOT_FOUND.Domain Management Errors
A small number of management operations aren’t available for every domain —
for example, some domains have WHOIS privacy permanently enabled, so it
can’t be disabled. When that happens the request returns
422 with this
code and the affected operation.Rate Limiting Errors
429 from your plan’s rate limit carries X-RateLimit-Limit,
X-RateLimit-Remaining, X-RateLimit-Reset, and Retry-After headers —
wait Retry-After seconds before retrying (fall back to exponential backoff
if the header is absent). See Rate Limits for
per-plan limits.
Server Errors
Handling Errors
Basic Error Handling
Retry with Exponential Backoff
For transient errors (429, 500, 503), implement retry logic with exponential backoff:Best Practices
Always check the error code
Always check the error code
Use the
code field for programmatic error handling, not the message. Error messages may change, but error codes remain stable.Log errors with context
Log errors with context
Include the request ID from response headers (
X-Request-ID) when logging
errors to help with debugging and support requests.Handle validation errors gracefully
Handle validation errors gracefully
Walk the
details tree (each node’s errors array, recursing into properties) to show specific field errors to your users rather than generic error messages.