---
title: "api docs - codefmt"
url: https://codefmt.dev/docs
updated: 2026-11-14
sources:
  - https://codefmt.dev/docs
licence: "© codefmt. Cite with attribution to https://codefmt.dev."
---

# api docs

the formatter is also an api: a json format endpoint, an mcp server, an a2a agent, and a question endpoint. this page covers how to call them. agents can read the same reference as markdown at </developers>.

## authentication

there is none. no accounts, api keys, or oauth, and you should not send an Authorization header. the machine-readable statement is at </auth.md>.

## limits

the format api takes code up to 51,200 characters, 50KB of ASCII (400 above it), request body up to 100KB, counted in bytes (413 above it).

rate limit: 60 requests per minute per ip across format api calls, mcp and a2a tool calls, and /ask (mcp handshakes and listings are not counted). the count is kept per server instance, so treat it as a ceiling to stay under rather than an exact budget. the format api reports where you stand in RateLimit headers and its 429 carries Retry-After; /ask answers a 429 with the message in answer, and an mcp tool call over the limit returns a tool result saying to try again in a minute.

## format api

POST json to `/api/format`. the body needs all four of code, platform, formatOptions, and lintOptions; the two option blocks have no server-side defaults. platform is one of zapier, n8n, pipedream, make, hubspot, hubl. retries are safe: formatting is a pure transformation, and the api accepts an Idempotency-Key header and echoes it back. the full schema, with python and hubl examples, is the [openapi spec](/api/openapi.json).

example request

```
curl -sS https://codefmt.dev/api/format \
  -H 'content-type: application/json' \
  --data @- <<'JSON'
{
  "code": "const name=inputData.name\nreturn {greeting:\"hi \"+name}",
  "platform": "zapier",
  "formatOptions": {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": false,
    "endOfLine": "lf",
    "semicolons": true,
    "quoteStyle": "single",
    "trailingCommas": "all",
    "bracketSpacing": true,
    "arrowParens": "always",
    "singleAttributePerLine": false,
    "objectWrap": "preserve",
    "quoteProperties": "as-needed",
    "jsxQuoteStyle": "double",
    "bracketSameLine": false,
    "organizeImports": false
  },
  "lintOptions": {
    "enabled": true,
    "severity": "default",
    "typescriptPlugin": false,
    "reactPlugin": false,
    "unicornPlugin": false,
    "promisePlugin": true,
    "nodePlugin": true,
    "securityPlugin": true,
    "perfCategory": false,
    "noConsole": false
  }
}
JSON
```

example response

```
{
  "code": "const name = inputData.name;\nreturn { greeting: 'hi ' + name };\n",
  "diagnostics": [],
  "diagnosticsFrame": "output",
  "duration": 42
}
```

## format api errors

code that does not parse is not an http error: you get a 200 with the original code and an error field saying what went wrong, so check the body, not just the status.

a rejected request comes back as `application/problem+json` (RFC 9457) with type, title, status, and detail. a 400 that fails the request schema names the failing field, and 400s, 403s, and 405s carry a short hint saying what to change. a 429 carries Retry-After. the mcp and a2a endpoints answer with json-rpc errors instead.

## endpoints

* [Format API (OpenAPI spec)](/api/openapi.json): POST json to /api/format to format and lint code for zapier, n8n, pipedream, make, hubspot, or hubl; markdown twin at https://codefmt.dev/api/openapi.json.md
* [MCP manifest](/.well-known/mcp.json): server name, icon, description, and tool list; the endpoint is POST https://codefmt.dev/api/mcp with tools format\_code, format\_json, ask\_codefmt
* [A2A agent card](/.well-known/agent-card.json): the endpoint is POST /api/a2a, json-rpc message/send
* [Ask endpoint (NLWeb)](/ask): grounded answers about codefmt with cited source urls
* [Agent auth statement](/auth.md): no authentication anywhere
* [Health check](/api/health): liveness

## more docs

request bodies for every platform, recipes, and troubleshooting are in [llms-full.txt](/llms-full.txt). the site-wide index for agents is [llms.txt](/llms.txt). looking for what codefmt supports on each platform rather than the api? that is on [platforms](/platforms).

## for agents (added to every page twin, not part of the page)

- format API: POST https://codefmt.dev/api/format (OpenAPI: https://codefmt.dev/api/openapi.json, code up to 51,200 characters, 50KB of ASCII (400 above it), request body up to 100KB, counted in bytes (413 above it), no authentication)
- MCP server: POST https://codefmt.dev/api/mcp (tools: format_code, format_json, ask_codefmt; manifest: https://codefmt.dev/.well-known/mcp.json)
- rate limit: 60 requests per minute per ip across format api calls, mcp and a2a tool calls, and /ask (mcp handshakes and listings are not counted). the count is kept per server instance, so treat it as a ceiling to stay under rather than an exact budget. the format api reports where you stand in RateLimit headers and its 429 carries Retry-After; /ask answers a 429 with the message in answer, and an mcp tool call over the limit returns a tool result saying to try again in a minute
- auth statement: https://codefmt.dev/auth.md (no accounts, api keys or oauth; send no authorization header)
- site index for agents: https://codefmt.dev/llms.txt
- full reference (request bodies for every language, a copy-paste curl command, platform globals, troubleshooting): https://codefmt.dev/llms-full.txt
