Run a data API request from the console
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 In: header
Path Parameters
Database id
uuidBranch id
uuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
POST …/console/query's body.
The Postgres database; null is the branch's main database. The tree may name it instead (both must then agree).
The role to run as; null runs as the database's owner.
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": {} }'nullFix one item of a branch's review POST
The worker scans the branch again, checks `hash` against it, and runs one fix in the item's database in its own transaction with `lock_timeout` 5 s: `reassign` gives the item's function (a trigger's function; a rule's relation) to the owner (`ALTER … OWNER TO`), after which the Admin answers for its code and a SECURITY DEFINER function runs as the owner; `drop` drops the function, trigger or rule `RESTRICT` (never cascading). Answers with the SQL it ran and the review after it.
The schema the console can show, as the owner or a role GET
What the console may show for one Postgres database of a branch, in the data API schema's shape (schemas, tables with their primary keys and the role's privileges, functions, enums). Without `role`, everything the database's owner reaches; with it, what that role reaches, after the same check the console's queries pass (it exists and isn't owner-level; BYPASSRLS is allowed, Admin only).