For the complete documentation index, see llms.txt. This page is also available as Markdown.

Workspace Tables

Create, manage, and query workspace-owned custom data tables.

Workspace Tables let you create and manage custom data tables scoped to your workspace. You define table schemas through typed requests, alter them with structured operations, and run scoped queries - all through the Platform API.

Endpoints

Method
Path
Description

POST

/v1/{workspace_id}/tables

Create a new workspace table

GET

/v1/{workspace_id}/tables

List all workspace tables

GET

/v1/{workspace_id}/tables/{table_id}

Get table details including live schema

PATCH

/v1/{workspace_id}/tables/{table_id}

Alter a table with typed operations

DELETE

/v1/{workspace_id}/tables/{table_id}

Drop a table and remove its registry entry

POST

/v1/{workspace_id}/query

Execute a scoped SQL query

Authentication

All endpoints require a valid API key with the appropriate workspace permissions. Create and alter operations require Workspace.update permission. List and get operations require Workspace.view permission. Query execution requires Workspace.update permission.

Create a Table

Creates a new workspace-owned table with the specified columns, constraints, and indexes.

Create Workspace Table

post
Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
Body
table_namestring · min: 1 · max: 63RequiredPattern: ^[a-z][a-z0-9_]{0,62}$
primary_keystring[] · nullableOptional
Responses
201

Successful Response

application/json
idstring · uuidRequired
workspace_idstring · uuidRequired
table_namestringRequired
physical_namestringRequired
post/v1/{workspace_id}/tables

Supported Column Types

Type
Description

text

Variable-length text

int

32-bit integer

bigint

64-bit integer

numeric

Arbitrary precision number

boolean

True/false

uuid

Universally unique identifier

timestamptz

Timestamp with time zone

date

Calendar date

time

Time of day

jsonb

Structured object data

bytea

Binary data

Example

List Tables

Returns all tables owned by the workspace, ordered by creation time (most recent first).

List Workspace Tables

get
Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
Responses
200

Successful Response

application/json
get/v1/{workspace_id}/tables
200

Successful Response

Example

Get Table Details

Returns the table registry entry along with the live schema, indexes, and constraints read from the storage catalog. The returned shape always reflects the current state of the table.

Get Workspace Table

get
Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
table_idstring · uuidRequired
Responses
200

Successful Response

application/json
idstring · uuidRequired
workspace_idstring · uuidRequired
table_namestringRequired
physical_namestringRequired
created_atstring · date-timeRequired
get/v1/{workspace_id}/tables/{table_id}

Example

Alter a Table

Applies one or more typed alter operations to an existing table. Operations are applied in order within a single transaction.

Update Workspace Table

patch
Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
table_idstring · uuidRequired
Body
Responses
200

Successful Response

application/json
idstring · uuidRequired
workspace_idstring · uuidRequired
table_namestringRequired
physical_namestringRequired
patch/v1/{workspace_id}/tables/{table_id}

Alter Actions

Each action has an op field that determines its type:

add_column

Adds a new column to the table.

Field
Type
Description

op

"add_column"

column

Column

Column definition (same schema as create).

drop_column

Removes a column from the table.

Field
Type
Description

op

"drop_column"

name

string

Column name to drop.

rename_column

Renames an existing column.

Field
Type
Description

op

"rename_column"

from

string

Current column name.

to

string

New column name.

change_column_type

Changes the data type of an existing column.

Field
Type
Description

op

"change_column_type"

name

string

Column name.

new_type

string

New column type (same values as create).

set_column_nullable

Sets whether a column allows null values.

Field
Type
Description

op

"set_column_nullable"

name

string

Column name.

nullable

boolean

Whether the column allows nulls.

set_column_default

Sets or changes the default value for a column.

Field
Type
Description

op

"set_column_default"

name

string

Column name.

default

Default

New default specification.

drop_column_default

Removes the default value from a column.

Field
Type
Description

op

"drop_column_default"

name

string

Column name.

add_unique

Adds a unique constraint.

Field
Type
Description

op

"add_unique"

columns

string[]

1-32 column names.

constraint_name

string | null

Optional constraint name.

drop_constraint

Drops a named constraint.

Field
Type
Description

op

"drop_constraint"

name

string

Constraint name to drop.

add_index

Creates an index.

Field
Type
Description

op

"add_index"

index_name

string

Index name.

columns

string[]

1-32 column names.

drop_index

Drops a named index.

Field
Type
Description

op

"drop_index"

index_name

string

Index name to drop.

Example

Delete a Table

Drops the table and removes its registry entry. Both operations happen in a single transaction - if the drop fails, the registry entry is preserved.

Delete Workspace Table

delete
Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
table_idstring · uuidRequired
Responses
200

Successful Response

application/json
anyOptional
delete/v1/{workspace_id}/tables/{table_id}

No content

Example

Execute a Query

Runs a single SQL statement scoped to the workspace's tables. Only data manipulation statements are allowed: SELECT, INSERT, UPDATE, DELETE, and WITH ... SELECT. The platform rejects multi-statement batches, DDL, and session-state commands.

Execute Workspace Query

post
Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
Body
sqlstring · min: 1 · max: 16384Required

One SQL statement: SELECT / WITH ... SELECT / INSERT / UPDATE / DELETE. Multi-statement, DDL, and session-state commands (SET ROLE, RESET, SET SESSION AUTHORIZATION) reject with 422 at the Pydantic boundary. pg_* function calls reject with 400 at execute time (no grant).

Responses
200

Successful Response

application/json
columnsstring[]Required
row_countintegerRequired
post/v1/{workspace_id}/query

SQL Validation Rules

  • Only one statement per request.

  • Allowed statements: SELECT, WITH ... SELECT, INSERT, UPDATE, DELETE.

  • Rejected: DDL (CREATE, ALTER, DROP), session commands (SET ROLE, RESET, SET SESSION AUTHORIZATION), multi-statement batches.

  • Structural validation failures (multi-statement batches; session-state commands such as SET ROLE, RESET, SET SESSION AUTHORIZATION; unparseable SQL) are rejected with 422 at the request boundary. Errors raised by the database while running a valid statement are returned as 400 with the upstream message.

Example

Response Example

Error Handling

Status
Description

400

Query or alter execution error against the database (valid statement, runtime failure).

404

Table not found (for get, alter, delete operations).

422

Request validation failure, including SQL validation: multi-statement batch, DDL/session-state command, or unparseable SQL.

Last updated

Was this helpful?