API & MCP
Last updated:
Turn a payload into a Prettify link, or transform data, from your own code or an AI coding tool. Two surfaces: a REST endpoint and an MCP server.
The share link (https://prettify.tools/s/…) opens the exact content in Prettify's interactive viewer: tree, table, chart, or diagram.
REST API
A single endpoint turns raw content into a share link.
POST https://prettify-api.alexi-81a.workers.dev/api/v1/view
Content-Type: application/json
Authorization: Bearer <licenseKey> # optional; raises limits
Request
{
"content": "{\n \"hello\": \"world\"\n}",
"format": "json"
}
| Field | Required | Notes |
|---|---|---|
content | yes | Raw document text. |
format | no | json (default), yaml, csv, xml, or mermaid. |
licenseKey | no | Alternative to the Authorization header. |
Response
{
"url": "https://prettify.tools/s/1a2b3c4d5e6f",
"shareId": "1a2b3c4d5e6f",
"expiresAt": "2026-08-05T12:00:00.000Z"
}
Example
curl -X POST https://prettify-api.alexi-81a.workers.dev/api/v1/view \
-H "Content-Type: application/json" \
-d '{"content":"{\"hello\":\"world\"}","format":"json"}'
Limits
| Tier | Size cap | Rate limit | Link lifetime |
|---|---|---|---|
| Anonymous | 128 KB | 5 / min + 50 / day per IP | 30 days |
| Pro (license key) | 10 MB | 60 / min per key | 1 year |
Identical content is de-duplicated to one link. Only the origin, format, and byte size are recorded for analytics; never the content itself.
MCP server
prettify-mcp wraps the API as an MCP server, so AI coding tools can turn a payload into a link and transform data. Runnable via npx, anonymous by default.
Install
Claude Desktop: add to claude_desktop_config.json:
{
"mcpServers": {
"prettify": { "command": "npx", "args": ["-y", "prettify-mcp"] }
}
}
Claude Code
claude mcp add prettify -- npx -y prettify-mcp
Cursor: add to ~/.cursor/mcp.json:
{
"mcpServers": {
"prettify": { "command": "npx", "args": ["-y", "prettify-mcp"] }
}
}
Set PRETTIFY_LICENSE_KEY in the server's env to raise limits with a Pro key.
Tools
| Tool | Purpose | Returns |
|---|---|---|
prettify_view | Open a payload in Prettify | share link |
prettify_query | Run a jq filter over the data | result + link |
prettify_convert | Convert between json/yaml/csv/xml | converted text + link |
prettify_diff | Structural diff (RFC 6902 JSON Patch) | patch + link |
prettify_infer_types | Types from a sample (TypeScript/Go/Kotlin/Rust/JSON Schema) | code |
The transform tools return the data result plus a Prettify link to view it.
Privacy
Content you send to a share link is compressed and stored behind a short, content-addressed id so the viewer can load it. The link expires after the lifetime shown above. Analytics record only the origin, format, and byte size, never the content.