← Back
Cloudflare
Cloudflare adds RFC 9457 JSON responses for 1xxx errors with content negotiation
Cloudflare · apifeaturebreaking-change · developers.cloudflare.com ↗

JSON Response Support

Cloudflare has updated error handling for 1xxx errors to support structured JSON responses. Clients can now request JSON-formatted error responses by sending either Accept: application/json or Accept: application/problem+json headers. This standardizes error handling across different HTTP clients and improves programmatic error parsing.

RFC 9457 Compliance

The JSON responses follow RFC 9457 (Problem Details for HTTP APIs), a standard for structured error representation. This means any HTTP client that understands Problem Details format can parse the response without Cloudflare-specific code. The JSON responses include standard RFC 9457 members alongside Cloudflare operational fields:

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

Breaking Change and Field Renames

The Markdown frontmatter field http_status has been renamed to status in both JSON and Markdown formats. Additionally, what_happened has been renamed to detail in JSON responses. Agents consuming Markdown frontmatter should update their parsers to use the new field names.

Content Negotiation

Responses honor standard HTTP content negotiation:

  • Accept: application/json returns JSON with application/json content type
  • Accept: application/problem+json returns JSON with application/problem+json content type
  • Accept: text/markdown returns the Markdown format
  • Default behavior (no specific header) returns HTML

This feature is available immediately for all Cloudflare-generated 1xxx errors.