DEV Community

Felipe L
Felipe L

Posted on Originally published at automationscookbook.com

Serve Markdown to AI Agents with Accept Headers

What Happened

AcceptMarkdown.com introduced a new HTTP header: Accept: text/markdown.

When an AI agent sends this header, the server returns data in Markdown instead of JSON or HTML.

Several API providers are already adopting the header, letting developers pull Markdown directly into agent pipelines.

The change is backward compatible. If a service doesn't support Markdown, it falls back to its default format.

Implementation requires only the header and a small server tweak, but it removes the need for extra parsing logic.

Why This Matters for Builders

  • Simplified debugging and monitoring: Markdown logs are easier to read than JSON. Developers spot issues faster.
  • Consistent UI rendering: Agent platforms that render Markdown natively can skip client‑side formatting, cutting latency and code complexity.
  • Enhanced data provenance: Markdown preserves the original data structure, clarifying source values—valuable when chaining multiple APIs in an n8n workflow.
  • Lower maintenance overhead: A single header replaces custom serializers for each API, reducing boilerplate and bugs.

FAQ

Q: Does the server need to be rewritten to support Markdown?

A: No. The server only needs to add a Content-Type: text/markdown response when it sees Accept: text/markdown. Existing JSON or HTML endpoints stay unchanged.

Q: Will Markdown work with all AI agents?

A: Most modern agents that can parse text will handle Markdown fine. If an agent expects structured data, it can still request JSON by omitting the header.

Q: How do I test this in an n8n workflow?

A: Add an HTTP Request node, set the Accept header to text/markdown, and observe the response. Feed that output into downstream nodes or render it in a UI node.


Originally published on Automations Cookbook.

Top comments (0)