Output Formatting
JSON in, any format out. Zero client code. Virtual API responses are JSON by default. Output formatting lets you convert responses to Markdown, CSV, or YAML — configured in your Virtual API Configuration, requested via URL extension, or negotiated through the HTTPAccept header. Especially useful for AI agents that present data to humans, or for feeding governed data directly into spreadsheets and configuration tools.
Output formatting runs after input normalization and the ordered controls pipeline. It only changes how the final governed payload is rendered. See Data Pipeline for the full request flow.
Quick start
Adddefault_output_format to any Virtual API Configuration:
Supported output formats
Requesting a format
Usedefault_output_format to set a default, or request a format per call with a URL extension or Accept header.
- Spec default
- URL extension
- Accept header
Set
default_output_format in the Virtual API Configuration when one format should be returned by default.default_output_format: json is also valid when you want to make the contract explicit without changing behavior.Precedence
Format selection follows a four-tier precedence (highest to lowest):
The first match wins.
How each format renders
Markdown
Markdown output is structure-driven.
Example:
CSV
CSV output follows RFC 4180.
Values containing commas, quotes, or newlines are automatically quoted. Objects with different key sets are handled by using the union of all keys in the header row.
YAML
YAML output uses standard YAML 1.2 formatting.Response headers
The responseContent-Type reflects the selected output format, and Vary: Accept is always included so caches differentiate negotiated responses correctly.
Advanced HTTP negotiation
AI agents and Accept headers
AI agents and Accept headers
Many AI agents already send
Accept headers that prefer Markdown. For example, Claude Code typically sends Accept: text/markdown, text/html, */*, which means DataHarbor can return Markdown without any spec or URL changes.This behavior also carries through MCP delivery when the agent’s Accept header is forwarded to the lease endpoint.Quality values (q-values)
Quality values (q-values)
The DataHarbor picks the supported format with the highest q-value.
Accept header supports quality values (q) to express preference.406 responses and caching
406 responses and caching
When the
Accept header explicitly excludes all supported formats and contains no wildcard fallback, DataHarbor returns 406 Not Acceptable.When Accept is */* or missing, DataHarbor falls through to the spec default or JSON behavior instead. Responses always include Vary: Accept for cache correctness.Next steps
Connect Sources
Start with how upstream formats enter DataHarbor
Input Normalization
See how upstream JSON, CSV, YAML, and Markdown are parsed
Markdown Input
Learn how Markdown sources normalize before controls run
REST API Delivery
Request formatted responses over fetch and relay endpoints

