Admin Query
Run data queries directly on tenant databases. DDL statements are blocked. Schema changes must go through workspaces and blueprints.
POST /admin/query
Run a query directly on one or all tenant databases.
Request Body
FieldTypeDescription
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
JSON
{
  "tenant_id": "acme",
  "columns": ["id", "name", "email"],
  "rows": [
    [1, "Alice", "alice@acme.io"]
  ],
  "row_count": 1,
  "execution_time": "12ms"
}
Response — all tenants
JSON
{
  "results": [
    {
      "tenant_id": "acme",
      "columns": ["id", "name"],
      "rows": [[1, "Alice"]],
      "row_count": 1
    }
  ],
  "total_tenants": 1,
  "execution_time": "45ms"
}
Response — DDL blocked
HTTP 400
{
  "success": false,
  "http_status": 400,
  "code": "bad_request",
  "error": "DDL not allowed on tenant databases. Deploy schema through blueprints."
}
Schema changes (CREATE TABLE, ALTER TABLE, DROP TABLE, etc.) must go through your workspace. See Schema-First Architecture.