Run a query directly on one or all tenant databases.
Request Body
| Field | Type | | Description |
| blueprint |
string |
required |
Blueprint name. Used to resolve database type and route to tenant databases. |
| query |
string |
required |
The SQL/MongoDB/Redis query to execute. DDL statements are blocked. |
| tenant_id |
string |
optional* |
Target a specific tenant. Provide this or all_tenants. |
| all_tenants |
boolean |
optional* |
Run query on all tenants. Provide this or tenant_id. |
Either tenant_id or all_tenants: true must be provided. Not available for control mode workspaces. Use workspace query instead.
Response — single tenant
{
"tenant_id": "acme",
"columns": ["id", "name", "email"],
"rows": [
[1, "Alice", "alice@acme.io"]
],
"row_count": 1,
"execution_time": "12ms"
}
Response — all tenants
{
"results": [
{
"tenant_id": "acme",
"columns": ["id", "name"],
"rows": [[1, "Alice"]],
"row_count": 1
}
],
"total_tenants": 1,
"execution_time": "45ms"
}
Response — DDL blocked
{
"success": false,
"http_status": 400,
"code": "bad_request",
"error": "DDL not allowed on tenant databases. Deploy schema through blueprints."
}