The schema as the key's role sees it
The tables, views, columns, functions and enums the secret key's role can reach in the database (without privileges), and the databases the key may reach. chelabase gen types reads it.
Authorization
bearer A data API key (chk_pub_… or chk_sec_…) as Authorization: Bearer <key>
In: header
Query Parameters
The Postgres database to describe; the key's main database when left out. It must be served and, when the key has a database list, on it.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/data/v1/schema"{ "app_users": { "schema": "string", "table": "string" }, "default_schema": "string", "schemas": { "property1": { "enums": { "property1": [ "string" ], "property2": [ "string" ] }, "functions": { "property1": [ { "args": [ { "array": true, "has_default": true, "name": "string", "type": "string" } ], "returns": { "array": true, "set": true, "type": "string" } } ], "property2": [ { "args": [ { "array": true, "has_default": true, "name": "string", "type": "string" } ], "returns": { "array": true, "set": true, "type": "string" } } ] }, "tables": { "property1": { "columns": { "property1": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" }, "property2": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" } }, "kind": "table", "primary_key": [ "string" ], "privileges": { "property1": [ "select" ], "property2": [ "select" ] }, "rls": true, "security_invoker": true }, "property2": { "columns": { "property1": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" }, "property2": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" } }, "kind": "table", "primary_key": [ "string" ], "privileges": { "property1": [ "select" ], "property2": [ "select" ] }, "rls": true, "security_invoker": true } } }, "property2": { "enums": { "property1": [ "string" ], "property2": [ "string" ] }, "functions": { "property1": [ { "args": [ { "array": true, "has_default": true, "name": "string", "type": "string" } ], "returns": { "array": true, "set": true, "type": "string" } } ], "property2": [ { "args": [ { "array": true, "has_default": true, "name": "string", "type": "string" } ], "returns": { "array": true, "set": true, "type": "string" } } ] }, "tables": { "property1": { "columns": { "property1": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" }, "property2": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" } }, "kind": "table", "primary_key": [ "string" ], "privileges": { "property1": [ "select" ], "property2": [ "select" ] }, "rls": true, "security_invoker": true }, "property2": { "columns": { "property1": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" }, "property2": { "array": true, "enum": "string", "generated": true, "has_default": true, "nullable": true, "type": "string" } }, "kind": "table", "primary_key": [ "string" ], "privileges": { "property1": [ "select" ], "property2": [ "select" ] }, "rls": true, "security_invoker": true } } } }, "version": "string", "databases": [ "string" ]}Run a query POST
Runs one operation (select, insert, update, delete or a function call), or a batch of them in order, in one transaction as the key's role. With a public key and a `Chelabase-User` token it runs as `authenticated` with the user's claims. Row-level security applies throughout.
The generated types for the key's schema GET
What `chelabase gen types` writes for the same secret key and options, byte for byte: the TypeScript module (`Database` and the runtime `types` map for `@chelabase/client`), or with `format=json` the runtime `types` map alone. It is built from exactly what `GET /data/v1/schema` gives the key. The `ETag` is the body's hash: send it back as `If-None-Match` for a 304 while the schema is unchanged. Not cached (`Cache-Control: no-store`): the schema follows the key.