developer

Use this when a user pastes messy or minified SQL and wants it pretty-printed into a readable, canonical layout, or wants keyword casing normalized.

Use this when a user pastes messy or minified SQL and wants it pretty-printed into a readable, canonical layout, or wants keyword casing normalized. Deterministic: same input, same output. Each clause keyword (SELECT, FROM, WHERE, GROUP BY, ...) goes on its own line with its arguments indented beneath it, commas break columns onto new lines, JOIN/AND/OR start fresh lines, and short parenthesised groups stay inline. Optional dialect hint affects identifier quoting (e.g. tsql [brackets]); indent is a spaces count or "tab" (default 2); keywordCase is upper/lower/preserve (default upper). Example: "select id from t" -> formatted "SELECT\n id\nFROM\n t". Returns an error for empty or oversized (>200000 chars) input.

post/v1/format_sql

Request

  • Base URL: https://api.clean.tools
  • URL: https://api.clean.tools/v1/format_sql
  • Auth: none declared

Request body

sqlstring required

The SQL query text to format. Required, non-empty.

dialect'sql' | 'postgresql' | 'mysql' | 'tsql' | 'bigquery' | 'sqlite'

SQL dialect hint (affects identifier quoting, e.g. T-SQL [brackets]). Optional; defaults to standard 'sql'.

keywordCase'upper' | 'lower' | 'preserve'

How to case reserved keywords/functions: UPPER, lower, or preserve as-is. Optional; defaults to 'upper'.

Response

Structured tool result.

toolstring

Changes

No recorded changes to this operation across all 1 revision of this API.