Database endpoints
Execute a query plan
Executes a read query plan and returns the matching rows.
POST /v1/tenants/{tenant}/query
- Build the read planDescribe operations in an op-tagged tree.
- Execute the planApply its scans, filters and other read operations.
- Read the matching rowsInterpret the result according to the chosen plan.
Before you start
Use your database bearer token.
Register the table your plan reads. The example scans demo.people; query plans on this endpoint are read-only.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
Query parameters
| Field | Type | Required |
|---|---|---|
explain | string | Optional |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Request body
application/json
Limits and accepted values
- A query plan node tagged by op (snake_case operator name) with operator-specific fields;
- nested plans use the same shape.
- Write operators are refused with 400.
| Field | Type | Required |
|---|---|---|
op | string | Required |
Read the result
The response is the rows returned by the read plan. The body is a plan tree tagged by op, not a SQL string. Write operators are rejected on this endpoint.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 404 | Check the resource ID and API route. |
| 408 | Reduce query work or adjust the timeout. |
| 409 | Resolve the conflict before retrying. |
| 413 | Split or reduce the request body. |
| 415 | Send the required Content-Type. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 499 | The client cancelled the request. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 502 | Check service availability and the write outcome. |
| 503 | Honor Retry-After when present; check write outcomes. |