Chelabase
ManagementData api

Run a data API request from the console

POST
/v1/databases/{id}/branches/{branch_id}/console/query

Runs one data API request (tree, the JSON POST /data/v1/query takes; every operation, batches included) on a branch, in one transaction with the data API's max_rows and statement timeout. role: null runs as the database's owner; any other role runs as that role, after a check that it exists and isn't owner-level (superuser, CREATEROLE, CREATEDB, REPLICATION or a member of neon_superuser); a role with BYPASSRLS passes (Admin only), and the console then reads and writes past row-level security. The answer is the data API's: its JSON on success, and its error body (invalid_query, unknown_table, permission_denied, conflict, …) when the request fails in the database. Every write is logged without its values.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

POST …/console/query's body.

database?|

The Postgres database; null is the branch's main database. The tree may name it instead (both must then agree).

role?|

The role to run as; null runs as the database's owner.

tree*

A data API request: the same JSON POST /data/v1/query takes.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches/497f6eca-6276-4993-bfeb-53cbbbba6f08/console/query" \  -H "Content-Type: application/json" \  -d '{    "tree": {}  }'
null