api.sqlize.online is an online PHP & SQL execution sandbox. The REST API lets you save code snippets, run them against 30+ database engines, execute PHP across multiple runtime versions with an optional live database, and generate ER diagrams.
This API powers sqlize.online, phpize.online, and sqltest.online. To integrate it into another service, contact rozhnev@msn.com.
Base URL: https://api.sqlize.online/api ·
All request bodies must be Content-Type: application/json ·
All responses are JSON
MCP server
AI assistants (Claude, Cursor, VS Code Copilot and other Model Context Protocol clients) can run SQL here directly: on real engines, in fresh databases, with every result linked back to sqlize.online. No account or API key needed.
Connect
# Claude Code claude mcp add --transport http sqlize https://api.sqlize.online/mcp # claude.ai: Settings → Connectors → Add custom connector → URL above # Cursor (~/.cursor/mcp.json), Windsurf, other clients { "mcpServers": { "sqlize": { "url": "https://api.sqlize.online/mcp" } } } # VS Code (.vscode/mcp.json) { "servers": { "sqlize": { "type": "http", "url": "https://api.sqlize.online/mcp" } } }
Tools
| Tool | Arguments | What it does |
|---|---|---|
list_databases | — | Engines and versions with the sql_version id to pass to other tools; marks the preloaded sample databases |
run_sql | sql_version, code, calculate_cost? | Runs a script in a fresh database that is dropped afterwards; returns every result set as a table, errors per statement, and a sqlize.online link |
describe_database | sql_version | Tables, columns and foreign keys of a preloaded sample database (Sakila, AdventureWorks, HR, …) |
create_share_link | sql_version, code | Saves a script without running it and returns its sqlize.online link |
Example
POST /mcp
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": { "name": "run_sql",
"arguments": { "sql_version": "psql18", "code": "SELECT 1 AS one;" } } }
Limits
| Result | Up to 200 rows per result set, 30 KB per answer, 200 characters per cell; the rest is cut and marked |
| Script | Up to 100 KB of SQL per call |
| Rate | 100 requests per 10 seconds per IP; when the server is busy a call returns an error asking to retry |
| Data | Nothing persists between calls; the sample databases are read-only |
POST is supported: no SSE stream and no session id.Parameters
Meta
Response
{
"php_versions": { "php81": "PHP 8.1", "php82": "PHP 8.2", … },
"sql_versions": { "mysql80": "MySQL 8.0", "psql17": "PostgreSQL 17 + PostGIS", … },
"erd_support": ["mysql80", "psql14", …],
"preloaded": ["mysql80_sakila", "psql10demo", …]
}
Code
Request body
| Field | Type | Description | |
|---|---|---|---|
language | string | required | sql or php |
code | string | required* | Source code (* optional for preloaded DBs) |
sql_version | string | optional | Needed only when code is empty and DB is preloaded |
Response
{ "hash": "d41d8cd98f00b204e9800998ecf8427e" }
sqlses or phpses to the run endpoints.Parameters
Execution
Request body
| Field | Type | Description | |
|---|---|---|---|
sql_version | string | required | Key from sql_versions |
code | string | required | SQL to execute |
format | string | optional | json (default) or text |
calculate_cost | bool | optional | Include EXPLAIN cost |
Response
{ "columns": ["id","name"], "rows": [[1,"Alice"]], "cost": "…" }
Parameters
Request body
| Field | Type | Description | |
|---|---|---|---|
php_code | string | required | PHP source to execute |
php_version | string | optional | Default: php81 |
sql_version | string | optional | Provisions a DB; injects $pdo, $mysqli, $db |
sql_code | string | optional | SQL to run before PHP (schema/seed) |
Response
{ "result": "Hello World\n" }
php_version as a query parameter so nginx routes straight to the right PHP-FPM: /api/php/run?php_version=php84. Without it the request takes an extra internal hop.Parameters
Request body
| Field | Type | Description | |
|---|---|---|---|
sql_version | string | required | Key from sql_versions |
sqlses | string | required | Session hash from /api/hash |
format | string | optional | json (default) or text |
calculate_cost | bool | optional | Include EXPLAIN cost |
Response
{ "columns": ["id","name"], "rows": [[1,"Alice"]], "cost": "…" }
sql_version as a query parameter too so nginx can route Firebird versions to the correct PHP backend: /api/evaluatesql?sql_version=firebird5Parameters
Request body
| Field | Type | Description | |
|---|---|---|---|
phpses | string | required | PHP session hash from /api/hash |
php_version | string | optional | Default: php81 |
sql_version | string | optional | Provisions a DB; injects $pdo, $mysqli, $db |
sqlses | string | optional | SQL session hash to run as schema/seed before PHP |
Response
{ "result": "Hello World\n" }
php_version as a query parameter so nginx routes to the correct PHP-FPM: /api/evaluatephp?php_version=php84Parameters
ER Diagrams
Path parameters
| Parameter | Description |
|---|---|
sql_version | Must be in erd_support list |
session_hash | Hash from a previous /api/hash call |
Response
{ "erd": "<svg …>…</svg>" }
Path parameters
Error responses
{ "error": "Human-readable description" }
HTTP 422 — invalid or unsupported input
HTTP 404 — endpoint not found
HTTP 501 — not yet implemented
HTTP 500 — internal server error