sqlfmt REST API Reference.
Send a POST /api/v1/analyze request to format and validate SQL from your CI pipeline, editor extension, or scripts.
Sign in to generate an API key and get programmatic access.
Sign inUsing the API
Send a POST request with your SQL and options.
cURL Request
curl https://www.sqlfmt.app/api/v1/analyze \
--request POST \
--header 'Authorization: Bearer YOUR_KEY' \
--header 'Content-Type: application/json' \
--data '{
"sql": "select id,name from users where active=1",
"options": {
"dialect": "postgresql"
}
}'200Response example
{
"formatted": "SELECT\n id,\n name\nFROM\n users\nWHERE\n active = 1",
"formatError": null,
"syntaxErrors": [],
"typoWarnings": [],
"lintWarnings": []
}