Markdown for Agents
Markdown has quickly become the lingua franca for agents and AI systems as a whole. The format’s explicit structure makes it ideal for AI processing, ultimately resulting in better results while minimizing token waste.
Cloudflare's network supports real-time content conversion at the source, for enabled zones using content negotiation ↗ headers. When AI systems request pages from any website that uses Cloudflare and has Markdown for Agents enabled, they can express the preference for text/markdown in the request and our network will automatically and efficiently convert the HTML to Markdown, when possible, on the fly.
Read the announcement ↗ in our blog for more information.
To fetch the Markdown version of any page from a zone with Markdown for Agents enabled, the client needs to add the Accept negotiation header with text/markdown as one of the options. Cloudflare will detect this, fetch the original HTML version from the origin, and convert it to Markdown before serving it to the client.
Here's a curl example with the Accept negotiation header requesting this page from our developer documentation:
curl https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/ \ -H "Accept: text/markdown"Or if you’re building an AI Agent using Workers, you can use TypeScript:
const r = await fetch( `https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/`, { headers: { Accept: "text/markdown", }, },);const tokenCount = r.headers.get("x-markdown-tokens");const markdown = await r.text();const r = await fetch( `https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/`, { headers: { Accept: "text/markdown", }, },);const tokenCount = r.headers.get("x-markdown-tokens");const markdown = await r.text();The response to this request is now formatting in markdown:
HTTP/2 200date: Wed, 11 Feb 2026 11:44:48 GMTcontent-type: text/markdown; charset=utf-8content-length: 2899vary: acceptx-markdown-tokens: 725content-signal: ai-train=yes, search=yes, ai-input=yes
---title: Markdown for Agents · Cloudflare Agents docs---
## What is Markdown for Agents
Markdown has quickly become the lingua franca for agents and AI systemsas a whole. The format’s explicit structure makes it ideal for AI processing,ultimately resulting in better results while minimizing token waste....Note that we include an x-markdown-tokens header with the converted response that indicates the estimated number of tokens in the markdown document. You can use this value in your flow, for example to calculate the size of a context window or to decide on your chunking strategy.
Content Signals ↗ is a framework that allows anyone to express their preferences for how their content can be used after it has been accessed.
By default Markdown for Agents converted responses include the Content-Signal: ai-train=yes, search=yes, ai-input=yes header signaling that the content can be used for AI Training, Search results and AI Input, which includes agentic use. Markdown for Agents will provide options to define custom Content Signal policies in the future.
To enable Markdown for Agents for your zone in the dashboard:
- Log into the Cloudflare dashboard ↗ and select your account (you need a Pro or Business plan).
- Select the zone you want to configure.
- Look for Quick Actions.
- Toggle the Markdown for Agents button to enable.
To enable Markdown for Agents for your zone using APIs, send a PATCH to /client/v4/zones/{zone_tag}/settings/content_converter with the payload {"value": "on"} to the Cloudflare API.
You will need to create an API token with the Zone Settings edit permissions enabled.
Example:
curl -X PATCH 'https://api.cloudflare.com/client/v4/zones/{zone_tag}/settings/content_converter' \ --header 'Content-Type: application/json' \ --header "Authorization: Bearer {api_token}" --data-raw '{"value": "on"}'If you are using Cloudflare for SaaS and want to enable Markdown for Agents for your custom hostnames, you have two options:
To enable Markdown for Agents for all custom hostnames on your SaaS zone:
- Log into the Cloudflare dashboard ↗ and select your account.
- Select your SaaS zone.
- Look for Quick Actions.
- Toggle the Markdown for Agents button to enable.
Enabling Markdown for Agents for specific custom hostnames requires an advanced subscription with access to custom metadata.
When creating or updating a custom hostname via API, add content_converter to the custom_metadata object:
curl --request PATCH \ --url "https://api.cloudflare.com/client/v4/zones/{zone_id}/custom_hostnames/{custom_hostname_id}" \ --header "Authorization: Bearer {api_token}" \ --header "Content-Type: application/json" \ --data '{ "custom_metadata": { "content_converter": "enabled" } }'Create a Configuration Rule on your SaaS zone that matches custom hostnames with the metadata and enables content conversion:
curl --request PUT \ --url "https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/phases/http_config_settings/entrypoint" \ --header "Authorization: Bearer {api_token}" \ --header "Content-Type: application/json" \ --data '{ "rules": [{ "expression": "lookup_json_string(cf.hostname.metadata, \"content_converter\") eq \"enabled\"", "action": "set_config", "action_parameters": { "content_converter": true }, "description": "Enable content converter for opted-in custom hostnames" }] }'This will enable the feature on custom hostnames that have the content_converter custom metadata tag set.
Markdown for Agents is available to Pro, Business and Enterprise plans, and SSL for SaaS customers at no cost.
We have enabled this feature in our Developer Documentation ↗ and our Blog ↗, inviting all AI crawlers and agents to consume our content using markdown instead of HTML.
curl https://blog.cloudflare.com/markdown-for-agents/ \ -H "Accept: text/markdown"- We only convert from HTML, other types of documents may be included in the future.
- We don't support compressed responses from the origin.
- Markdown for Agents is a zone level setting. If you need different settings for different sub-domains of a zone, you need to decouple them to separate zones.
If you’re building AI systems that require arbitrary document conversion from outside Cloudflare or Markdown for Agents is not available from the content source, we provide other ways to convert documents to Markdown for your applications:
- Workers AI AI.toMarkdown() ↗ supports multiple document types and summarization.
- Browser Rendering /markdown ↗ REST API supports markdown conversion if you need to render a dynamic page or application in a real browser before converting it.