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: http://api.sqlize.online/api ·
All request bodies must be Content-Type: application/json ·
All responses are JSON
Meta
GET
/api/versions
List all supported PHP & SQL versions
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", …]
}
No parameters required.
Code
POST
/api/hash
Save code and return its hash
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" }
Pass the hash as
sqlses or phpses to the run endpoints.Parameters
Execution
POST
/api/sql/run
Execute a SQL query
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
POST
/api/php/run
Execute PHP code with optional SQL database
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" }
Parameters
POST
/api/evaluatesql
Execute a saved SQL session by hash
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": "…" }
Pass
sql_version as a query parameter too so nginx can route Firebird versions to the correct PHP backend: /api/evaluatesql?sql_version=firebird5Parameters
POST
/api/evaluatephp
Execute a saved PHP session by hash
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" }
Pass
php_version as a query parameter so nginx routes to the correct PHP-FPM: /api/evaluatephp?php_version=php84Parameters
ER Diagrams
GET
/api/erd/{sql_version}/{session_hash}
Generate an ER diagram for a session
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