Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

SQL Formatter API

Format or minify SQL.

POST /api/v1/tools/sql-formatterMCP sql_formatterDeveloper Tools

Format messy SQL into readable, indented queries for PostgreSQL, MySQL, SQL Server, SQLite, BigQuery and more. Change keyword case, or minify SQL onto one line.

Input

Send these as a JSON object. Unknown fields are rejected.

input
The SQL. (string, required)
mode
format or minify. (string, one of format, minify, default "format")
curl https://pithlab.com/api/v1/tools/sql-formatter \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"input":"select id, name from users where active = true order by name"}'
Example response
{
  "ok": true,
  "result": {
    "output": "SELECT\n  id,\n  name\nFROM\n  users\nWHERE\n  active = TRUE\nORDER BY\n  name"
  }
}