← Back
Cloudflare
Cloudflare adds JSON and RFC 9457 support for 1xxx error responses
Cloudflare · featureapibreaking-change · developers.cloudflare.com ↗

Structured JSON Error Responses

Cloudflare-generated 1xxx errors now return structured JSON when clients send Accept: application/json or Accept: application/problem+json headers. This brings Cloudflare's error responses in line with industry standards and improves developer experience across HTTP clients and SDKs.

RFC 9457 Standard Members

JSON responses include RFC 9457 Problem Details standard members alongside operational fields:

  • type — URI pointing to Cloudflare documentation for the specific error code
  • status — HTTP status code matching the response status
  • title — Short, human-readable summary
  • detail — Human-readable explanation specific to this occurrence
  • instance — Ray ID identifying this specific error occurrence

Content Negotiation

The implementation respects HTTP content negotiation rules:

Request header Response format
Accept: application/json JSON with application/json content type
Accept: application/problem+json JSON with application/problem+json content type
Accept: text/markdown Markdown (default for non-JSON requests)
Accept: */* HTML (default fallback)

When multiple formats are specified with equal quality, the first-listed format wins.

Breaking Changes

Field renames — The http_status field has been renamed to status in both JSON and Markdown formats. Additionally, what_happened is now detail in JSON responses only; Markdown prose sections remain unchanged. Agents consuming Markdown frontmatter should update parsers accordingly.

Getting Started

Test the new JSON responses using curl:

curl -s -H "Accept: application/json" \
  "https://<YOUR_DOMAIN>/cdn-cgi/error/1015" | jq .

This feature is available now for all Cloudflare-generated 1xxx errors. Refer to the Cloudflare 1xxx error documentation for more details.