← All tool references

Developer Tools · not_available

SQL Formatter

Format SQL statements with readable keyword breaks and indentation for common SELECT, INSERT, UPDATE, DELETE, and DDL syntax.

Open public tool

Overview

Category
Developer Tools
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/sql-formatter

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/sql-formatter/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

sql · string · required
Paste one or more SQL statements.
indent · number · required
Enter the indent spaces used in the calculation.
keyword_case · string · required
Choose the keyword case that matches the calculation. Accepted values: upper, lower, preserve.
{
    "type": "object",
    "properties": {
        "sql": {
            "type": "string",
            "description": "Paste one or more SQL statements."
        },
        "indent": {
            "type": "number",
            "description": "Enter the indent spaces used in the calculation.",
            "minimum": 0,
            "maximum": 8
        },
        "keyword_case": {
            "type": "string",
            "description": "Choose the keyword case that matches the calculation.",
            "enum": [
                "upper",
                "lower",
                "preserve"
            ]
        }
    },
    "required": [
        "sql",
        "indent",
        "keyword_case"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

formatted_sql · string
Formatted SQL produced by the calculation.
statement_count · number
Statement count produced by the calculation.
line_count · number
Formatted line count produced by the calculation.
{
    "type": "object",
    "properties": {
        "formatted_sql": {
            "type": "string",
            "description": "Formatted SQL produced by the calculation."
        },
        "statement_count": {
            "type": "number",
            "description": "Statement count produced by the calculation."
        },
        "line_count": {
            "type": "number",
            "description": "Formatted line count produced by the calculation."
        }
    },
    "additionalProperties": false
}

SQL Formatter example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/sql-formatter/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "sql": "select id,name,email from users where active=1 order by name;",
    "indent": 2,
    "keyword_case": "upper"
}'
{
    "ok": true,
    "data": {
        "slug": "sql-formatter",
        "result": {
            "values": {
                "formatted_sql": "SELECT id,\n  name,\n  email \nFROM users \nWHERE active=1 \nORDER BY name;",
                "statement_count": 1,
                "line_count": 6
            },
            "display": {
                "display": "SELECT id,\n  name,\n  email \nFROM users \nWHERE active=1 \nORDER BY name;"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.