← back to the formatter

Vitti SQL Formatter — API

Format any SQL into the Vitti "river" style over HTTP — the same engine as the web app and the browser extension. No key, CORS open, rate-limited (~20 req/s).

Base URL: https://identar.lucas.mat.br/api/format

EnglishPortuguês (pt-BR)

English

POST (recommended)

curl -s -X POST https://identar.lucas.mat.br/api/format \
  -H 'Content-Type: application/json' \
  -d '{"sql":"select a, b from t where x = 1","options":{"useTabs":false}}'

Response:

{"formatted":"select      a\n            ,b\n\nfrom        t\n\nwhere       1=1\nand         x = 1\n"}
Options go nested under options. A flat useTabs next to sql is ignored.

GET (quick test / browser)

curl -s "https://identar.lucas.mat.br/api/format?sql=select%20a,b%20from%20t&useTabs=false&format=text"

On GET, options are flat query params, and format=text returns the raw SQL instead of JSON.

Options

keyvaluesnote
useTabstrue / falsefalse = spaces — use when pasting into Databricks
keywordCaselower / upper / preserve
tabWidth / riverWidthintegerindent size / operand column (default 12)
aliasColumn / joinColumn / filterColumninteger (0 = auto/off)the alignment rulers
where11true / falseopen every where with 1=1

Notes

Response: {"formatted": "…"} (JSON), or raw SQL when format=text.
Health: GET /api/health{"ok":true}.
Errors: {"error":"bad_json",…} with HTTP 400 for malformed input.
• Open, no auth, rate-limited — fine to call from a notebook or a script.

Python

import requests
r = requests.post("https://identar.lucas.mat.br/api/format",
                  json={"sql": "select a, b from t", "options": {"useTabs": False}})
print(r.json()["formatted"])

Português (pt-BR)

Formata qualquer SQL no estilo "rio" do Vitti via HTTP — o mesmo motor do site e da extensão de navegador. Sem chave, CORS aberto, com limite de taxa (~20 req/s). URL base: https://identar.lucas.mat.br/api/format

POST (recomendado)

curl -s -X POST https://identar.lucas.mat.br/api/format \
  -H 'Content-Type: application/json' \
  -d '{"sql":"select a, b from t where x = 1","options":{"useTabs":false}}'

Retorna:

{"formatted":"select      a\n            ,b\n\nfrom        t\n\nwhere       1=1\nand         x = 1\n"}
As opções vão aninhadas em options. Um useTabs solto ao lado de sql é ignorado.

GET (teste rápido / navegador)

curl -s "https://identar.lucas.mat.br/api/format?sql=select%20a,b%20from%20t&useTabs=false&format=text"

No GET, as opções são parâmetros de query, e format=text devolve o SQL puro em vez de JSON.

Opções

chavevaloresobservação
useTabstrue / falsefalse = espaços — use ao colar no Databricks
keywordCaselower / upper / preserve
tabWidth / riverWidthinteirotamanho do recuo / coluna do operando (padrão 12)
aliasColumn / joinColumn / filterColumninteiro (0 = auto/desliga)as réguas de alinhamento
where11true / falseabre todo where com 1=1

Observações

Resposta: {"formatted": "…"} (JSON), ou SQL puro quando format=text.
Health: GET /api/health{"ok":true}.
Erros: {"error":"bad_json",…} com HTTP 400 para entrada malformada.
• Aberto, sem autenticação, com limite de taxa — ok para chamar de um notebook ou script.

Python

import requests
r = requests.post("https://identar.lucas.mat.br/api/format",
                  json={"sql": "select a, b from t", "options": {"useTabs": False}})
print(r.json()["formatted"])

Raw markdown: api.md · Formatting rules: the rules ↗