API Reference›Databases
API Reference

Databases

Create and manage databases. Each database has its own default catalog and can attach other catalogs under an alias. A query sees only the catalogs of the database it names.

List databases

GET/v1/databases

List databases, newest first, one page at a time. If has_more is true, pass next_cursor as cursor to get the next page.

search matches names that contain the text. To get the one database with an exact name, use GET /v1/databases/by-name. batch lists only the databases a bulk create made.

Query parameters

NameTypeDescription
limitintegerDatabases per page, 1 to 100. Defaults to 100.
cursorstringnext_cursor from the previous page.
searchstringReturn only databases whose name contains this text, ignoring case.
batchstringReturn only databases from this bulk-create batch, ordered by ID.

Response 200 — One page of databases

NameTypeDescription
countintegerNumber of databases returned in this page.
databases (required)DatabaseSummary[]
has_morebooleanWhether more databases exist after this page.
limitintegerPage size used for this response.
next_cursorstringCursor for the next page. Present only when has_more is true.
Fields of databases
NameTypeDescription
databases[].created_atstringWhen the database was created.
databases[].default_catalog (required)stringName of the database's own catalog in SQL.
databases[].default_schema (required)stringSchema that unqualified table names resolve to.
databases[].expires_atstring
databases[].forked_fromForkedFromInfo
databases[].id (required)string
databases[].namestring
Example response
{
  "count": 0,
  "databases": [
    {
      "created_at": "2026-01-01T00:00:00Z",
      "default_catalog": "string",
      "default_schema": "string",
      "expires_at": "2026-01-01T00:00:00Z",
      "forked_from": {
        "database_id": "dbidk9p34y6n3wd25rq4f5zr37e3p3",
        "description": "string",
        "forked_at": "2026-01-01T00:00:00Z",
        "name": "string",
        "snapshot_id": 0
      },
      "id": "string",
      "name": "string"
    }
  ],
  "has_more": true,
  "limit": 0,
  "next_cursor": "string"
}

Create database

POST/v1/databases

Create a database. Each database gets its own default catalog with a main schema, so default.main.<table> works right away. You can declare more schemas and tables in schemas.

name is a label and does not have to be unique. Set if_not_exists to get back the database that already has this name (status 200) instead of creating a new one; the rest of the request is then ignored. Set expires_at to have the database deleted after that time. Deletion never happens earlier, but can happen later.

Request body

NameTypeDescription
default_catalogstringName of the database's own catalog in SQL. Defaults to default. Lowercase letters, digits and _, not starting with a digit. Some names are reserved, such as hotdata and information_schema.
default_schemastringSchema that unqualified table names resolve to. Defaults to the only schema in schemas if there is exactly one, otherwise main.
expires_atstringWhen the database expires: a future RFC 3339 timestamp, or a duration such as 90m, 24h or 7d. Omit for no expiry.
if_not_existsbooleanIf a database with this name exists, return it with 200 instead of creating another. Requires name; the rest of the request is ignored on a match.
namestringDisplay name. Need not be unique. Defaults to a name based on the database ID.
schemasDatabaseDefaultSchemaDecl[]Schemas and tables to create with the database.
Fields of schemas
NameTypeDescription
schemas[].name (required)string
schemas[].tablesDatabaseDefaultTableDecl[]Tables to create in the schema. You can also add tables later.
schemas[].tables[].constant_per_keystring[]Columns that always hold the same value for rows with the same key. Makes keyed loads faster, but if it is not true, keyed loads silently duplicate rows.
schemas[].tables[].keystring[]Columns that identify a row. Required for delete, update and upsert loads unless the load request gives its own key.
schemas[].tables[].layoutTableLayoutHow a table's data files are written. Set when the table is created and fixed after that. - analytical (default): data pages sized for scans. - point_lookup: small data pages, so fetching rows by ID is cheap, as vector search results do. Scans of the table read more pages.
schemas[].tables[].name (required)string
schemas[].tables[].partition_byTablePartitionKey[]Columns to partition the table by, in order. Cannot be changed later.
schemas[].tables[].sorted_byTableSortKey[]Columns to sort the table by, in order. Cannot be changed later, and a sorted table cannot be indexed.
Example request
{
  "schemas": [
    {
      "name": "sales"
    }
  ]
}

Response 200 — if_not_exists was set and a database with this name already exists. It is returned unchanged.

NameTypeDescription
createdbooleantrue if this call created the database; false if if_not_exists returned an existing one.
default_catalog (required)stringName of the database's own catalog in SQL.
default_connection_id (required)stringID of the connection behind the database's own catalog. Use it to load tables through the connection endpoints, or to attach this catalog to another database.
default_schema (required)stringSchema that unqualified table names resolve to.
expires_atstringWhen the database expires.
forked_fromForkedFromInfo
id (required)string
namestring
Example response
{
  "created": true,
  "default_catalog": "string",
  "default_connection_id": "string",
  "default_schema": "string",
  "expires_at": "2026-01-01T00:00:00Z",
  "forked_from": {
    "database_id": "dbidk9p34y6n3wd25rq4f5zr37e3p3",
    "description": "string",
    "forked_at": "2026-01-01T00:00:00Z",
    "name": "string",
    "snapshot_id": 0
  },
  "id": "string",
  "name": "string"
}

Response 201 — Database created

NameTypeDescription
createdbooleantrue if this call created the database; false if if_not_exists returned an existing one.
default_catalog (required)stringName of the database's own catalog in SQL.
default_connection_id (required)stringID of the connection behind the database's own catalog. Use it to load tables through the connection endpoints, or to attach this catalog to another database.
default_schema (required)stringSchema that unqualified table names resolve to.
expires_atstringWhen the database expires.
forked_fromForkedFromInfo
id (required)string
namestring
Example response
{
  "created": true,
  "default_catalog": "string",
  "default_connection_id": "string",
  "default_schema": "string",
  "expires_at": "2026-01-01T00:00:00Z",
  "forked_from": {
    "database_id": "dbidk9p34y6n3wd25rq4f5zr37e3p3",
    "description": "string",
    "forked_at": "2026-01-01T00:00:00Z",
    "name": "string",
    "snapshot_id": 0
  },
  "id": "string",
  "name": "string"
}

Errors

StatusDescription
400Invalid request
409if_not_exists was set and more than one database has this name.
500Internal server error

Create many databases at once

POST/v1/databases/bulk

Create many databases from one template, in the background. The response returns at once with a batch_id and a job to poll.

Pass schemas to declare the same tables in every database. List the databases a batch created with GET /v1/databases?batch=<batch_id>.

Request body

NameTypeDescription
count (required)integerHow many databases to create. Range: 1–10000
default_catalogstringName of each database's own catalog in SQL. Defaults to default.
default_schemastringSchema that unqualified table names resolve to in each database.
expires_atstringWhen the databases expire: a future RFC 3339 timestamp, or a duration such as 24h, 90m or 7d.
idempotency_keystringKey that makes the request safe to retry. A repeated key returns the original batch, even if the rest of the request differs.
name_templatestringName pattern for the databases. Must contain {index}, which becomes each database's zero-padded position (tenant-00 to tenant-99 for a count of 100); a batch suffix is added to each name.
schemasDatabaseDefaultSchemaDecl[]Schemas and tables to create in every database.
Fields of schemas
NameTypeDescription
schemas[].name (required)string
schemas[].tablesDatabaseDefaultTableDecl[]Tables to create in the schema. You can also add tables later.
schemas[].tables[].constant_per_keystring[]Columns that always hold the same value for rows with the same key. Makes keyed loads faster, but if it is not true, keyed loads silently duplicate rows.
schemas[].tables[].keystring[]Columns that identify a row. Required for delete, update and upsert loads unless the load request gives its own key.
schemas[].tables[].layoutTableLayoutHow a table's data files are written. Set when the table is created and fixed after that. - analytical (default): data pages sized for scans. - point_lookup: small data pages, so fetching rows by ID is cheap, as vector search results do. Scans of the table read more pages.
schemas[].tables[].name (required)string
schemas[].tables[].partition_byTablePartitionKey[]Columns to partition the table by, in order. Cannot be changed later.
schemas[].tables[].sorted_byTableSortKey[]Columns to sort the table by, in order. Cannot be changed later, and a sorted table cannot be indexed.
Example request
{
  "count": 100,
  "default_catalog": "default",
  "default_schema": "main",
  "expires_at": "7d",
  "idempotency_key": "3f6b1c1e-9a2b-4a5f-9a1e-2f0d6a7c8b91",
  "name_template": "tenant-{index}",
  "schemas": [
    {
      "name": "sales"
    }
  ]
}

Response 202 — Batch accepted. Databases are created in the background.

NameTypeDescription
batch_id (required)string
cancel_requested (required)booleanTrue once cancellation is requested. Databases already created are kept.
count (required)integerNumber of databases requested.
created_count (required)integerNumber of databases created so far.
expires_atstring
job_idstringID of the job creating the databases. Poll it for status.
status_urlstring
Example response
{
  "batch_id": "string",
  "cancel_requested": true,
  "count": 0,
  "created_count": 0,
  "expires_at": "2026-01-01T00:00:00Z",
  "job_id": "string",
  "status_url": "string"
}

Errors

StatusDescription
400Invalid count, template, or expiry
409A batch with this idempotency key is already running

Get a database batch

GET/v1/databases/bulk/{batch_id}

Get a batch: how many databases were requested and how many exist so far. Poll this to follow progress.

Path parameters

NameTypeDescription
batch_id (required)stringBatch ID

Response 200 — The batch

NameTypeDescription
batch_id (required)string
cancel_requested (required)booleanTrue once cancellation is requested. Databases already created are kept.
count (required)integerNumber of databases requested.
created_count (required)integerNumber of databases created so far.
expires_atstring
job_idstringID of the job creating the databases. Poll it for status.
status_urlstring
Example response
{
  "batch_id": "string",
  "cancel_requested": true,
  "count": 0,
  "created_count": 0,
  "expires_at": "2026-01-01T00:00:00Z",
  "job_id": "string",
  "status_url": "string"
}

Errors

StatusDescription
404Batch not found

Delete a database batch

DELETE/v1/databases/bulk/{batch_id}

Stop a batch and delete the databases it created, then the batch.

This works only while no database in the batch holds loaded data. Declared but unloaded tables are fine. If any database has data, the request returns 409; delete those databases one at a time.

Path parameters

NameTypeDescription
batch_id (required)stringBatch ID

Response 200 — Batch deleted

NameTypeDescription
batch_id (required)string
deleted_count (required)integerHow many databases were removed.
Example response
{
  "batch_id": "string",
  "deleted_count": 0
}

Errors

StatusDescription
404Batch not found
409Some databases in the batch hold loaded data

Look up a database by name

GET/v1/databases/by-name

Get the database with this exact name. Matching ignores case only for unaccented Latin letters; all other characters must match exactly.

Returns 409 if more than one database has the name. Use the database ID for those.

Query parameters

NameTypeDescription
name (required)stringFull name of the database. Case is ignored for ASCII letters only.

Response 200 — Database details

NameTypeDescription
attachments (required)DatabaseAttachmentInfo[]Catalogs attached from other connections or databases.
created_atstringWhen the database was created.
default_catalog (required)stringName of the database's own catalog in SQL.
default_connection_id (required)stringID of the connection behind the database's own catalog. Use it to load tables through the connection endpoints, or to attach this catalog to another database.
default_schema (required)stringSchema that unqualified table names resolve to.
expires_atstringWhen the database expires.
forked_fromForkedFromInfo
id (required)string
namestring
Fields of attachments
NameTypeDescription
attachments[].aliasstringName of the catalog in SQL. When absent, use the connection's name.
attachments[].connection_id (required)string
Example response
{
  "attachments": [
    {
      "alias": "string",
      "connection_id": "string"
    }
  ],
  "created_at": "2026-01-01T00:00:00Z",
  "default_catalog": "string",
  "default_connection_id": "string",
  "default_schema": "string",
  "expires_at": "2026-01-01T00:00:00Z",
  "forked_from": {
    "database_id": "dbidk9p34y6n3wd25rq4f5zr37e3p3",
    "description": "string",
    "forked_at": "2026-01-01T00:00:00Z",
    "name": "string",
    "snapshot_id": 0
  },
  "id": "string",
  "name": "string"
}

Errors

StatusDescription
400The name parameter is empty or too long
404No database has that name
409More than one database has that name

Count databases

GET/v1/databases/count

Count the databases in the workspace. search and batch filter the same way as on GET /v1/databases.

Query parameters

NameTypeDescription
searchstringCount only databases whose name contains this text, ignoring case.
batchstringCount only databases from this bulk-create batch.

Response 200 — Number of matching databases

NameTypeDescription
total (required)integerTotal databases matching the filters, across all pages.
Example response
{
  "total": 0
}

Get database

GET/v1/databases/{database_id}

Get a database by ID. To find one by name, use GET /v1/databases/by-name.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID

Response 200 — Database details

NameTypeDescription
attachments (required)DatabaseAttachmentInfo[]Catalogs attached from other connections or databases.
created_atstringWhen the database was created.
default_catalog (required)stringName of the database's own catalog in SQL.
default_connection_id (required)stringID of the connection behind the database's own catalog. Use it to load tables through the connection endpoints, or to attach this catalog to another database.
default_schema (required)stringSchema that unqualified table names resolve to.
expires_atstringWhen the database expires.
forked_fromForkedFromInfo
id (required)string
namestring
Fields of attachments
NameTypeDescription
attachments[].aliasstringName of the catalog in SQL. When absent, use the connection's name.
attachments[].connection_id (required)string
Example response
{
  "attachments": [
    {
      "alias": "string",
      "connection_id": "string"
    }
  ],
  "created_at": "2026-01-01T00:00:00Z",
  "default_catalog": "string",
  "default_connection_id": "string",
  "default_schema": "string",
  "expires_at": "2026-01-01T00:00:00Z",
  "forked_from": {
    "database_id": "dbidk9p34y6n3wd25rq4f5zr37e3p3",
    "description": "string",
    "forked_at": "2026-01-01T00:00:00Z",
    "name": "string",
    "snapshot_id": 0
  },
  "id": "string",
  "name": "string"
}

Errors

StatusDescription
404Database not found

Delete database

DELETE/v1/databases/{database_id}

Delete a database and its default catalog. Catalogs attached to it are detached, not deleted.

Returns 409 while another database has this database's catalog attached; detach it there first. After expires_at the database is deleted anyway, and the other database loses access.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID

Response 204 — Database deleted

Errors

StatusDescription
404Database not found
409Another database has this database's catalog attached

Attach catalog to database

POST/v1/databases/{database_id}/catalogs

Attach a catalog so its tables can be queried in this database. To query across two databases, pass the other database's default_connection_id as connection_id.

The catalog is read-only here and nothing is copied. It answers to alias, or to its own name if you omit it. That name cannot be default or a reserved name, so attaching another database's default catalog needs an alias. Attaching is not transitive: you do not see the attached catalog's own attachments.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID

Request body

NameTypeDescription
aliasstringName to use for the catalog in SQL. Defaults to the connection's name.
connection_id (required)string
Example request
{
  "alias": "warehouse",
  "connection_id": "connk9p34y6n3wd25rq4f5zr37e3p3"
}

Response 204 — Catalog attached

Errors

StatusDescription
400Invalid request
404Database or connection not found
409The catalog is already attached, or the alias is already in use

Detach catalog from database

DELETE/v1/databases/{database_id}/catalogs/{connection_id}

Detach a catalog from a database. The catalog and its data are not deleted.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID
connection_id (required)stringConnection ID

Response 204 — Catalog detached

Errors

StatusDescription
400Cannot detach a database's own default catalog
404Database or attachment not found

Fork database

POST/v1/databases/{database_id}/fork

Create a new database that starts as a copy of an existing one: same schemas, tables, data and attached catalogs. The two are independent after that; the source does not change.

Indexes come across and work at once, except vector indexes that use the ivf algorithm and indexes not up to date with the table's latest load. Create those again on the fork. A fork shares the source's storage at first, so it adds no stored bytes until it is written to or maintenance rewrites a table.

Path parameters

NameTypeDescription
database_id (required)stringSource database ID

Request body

NameTypeDescription
descriptionstringWhy the fork was taken, shown in the fork's lineage. Up to 4096 bytes.
expires_atstringWhen the fork expires: a future RFC 3339 timestamp, or a duration such as 24h or 7d. Defaults to the source's expiry, if it has one.
namestringDisplay name for the fork. Defaults to the source's name plus a short suffix.

All fields are optional. Send only the ones you want to set.

Response 201 — Database forked

NameTypeDescription
createdbooleantrue if this call created the database; false if if_not_exists returned an existing one.
default_catalog (required)stringName of the database's own catalog in SQL.
default_connection_id (required)stringID of the connection behind the database's own catalog. Use it to load tables through the connection endpoints, or to attach this catalog to another database.
default_schema (required)stringSchema that unqualified table names resolve to.
expires_atstringWhen the database expires.
forked_fromForkedFromInfo
id (required)string
namestring
Example response
{
  "created": true,
  "default_catalog": "string",
  "default_connection_id": "string",
  "default_schema": "string",
  "expires_at": "2026-01-01T00:00:00Z",
  "forked_from": {
    "database_id": "dbidk9p34y6n3wd25rq4f5zr37e3p3",
    "description": "string",
    "forked_at": "2026-01-01T00:00:00Z",
    "name": "string",
    "snapshot_id": 0
  },
  "id": "string",
  "name": "string"
}

Errors

StatusDescription
400The source database cannot be forked
404Source database not found
409The source database changed during the fork. Retry the request.

Get database lineage

GET/v1/databases/{database_id}/lineage

Show where a database was forked from and what was forked from it.

ancestors lists the fork chain up to the original, nearest first. forks lists databases forked directly from this one, newest first; fork_count is the full total when the list is cut short. Deleted databases stay in the record with exists set to false. A database with no forks returns empty lists and itself as root_id.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID

Query parameters

NameTypeDescription
forks_limitintegerNumber of direct forks to list, 1 to 100. Defaults to 25.

Response 200 — Database lineage

NameTypeDescription
ancestors (required)LineageAncestorInfo[]Databases this one descends from, nearest parent first. Deleted ones stay in the list with exists: false. Empty when this is not a fork.
ancestors_truncated (required)booleanTrue when ancestors stops before reaching root_id.
database_id (required)stringThe database this lineage describes.
fork_count (required)integerTotal number of databases forked directly from this one.
forks (required)LineageForkInfo[]Databases forked directly from this one, newest first, including deleted ones. Limited by forks_limit.
root_id (required)stringThe original database at the top of the fork chain. Equal to database_id when this database is not a fork.
Fields of ancestors
NameTypeDescription
ancestors[].database_id (required)string
ancestors[].descriptionstringWhy that fork was taken, if given.
ancestors[].exists (required)booleanFalse if the database has been deleted.
ancestors[].forked_atstringWhen the next database down the chain was forked from this one.
ancestors[].namestringThe database's current name, or its name at fork time if deleted.
ancestors[].snapshot_idintegerPoint in time of this database's data that the next database down the chain copied.
Fields of forks
NameTypeDescription
forks[].database_id (required)string
forks[].descriptionstringWhy the fork was taken, if given.
forks[].exists (required)booleanFalse if the fork has been deleted.
forks[].forked_atstringWhen the fork was taken.
forks[].namestringThe fork's name. Absent once the fork is deleted.
forks[].snapshot_idintegerPoint in time of this database's data that the fork copied.
Example response
{
  "ancestors": [
    {
      "database_id": "string",
      "description": "string",
      "exists": true,
      "forked_at": "2026-01-01T00:00:00Z",
      "name": "string",
      "snapshot_id": 0
    }
  ],
  "ancestors_truncated": true,
  "database_id": "string",
  "fork_count": 0,
  "forks": [
    {
      "database_id": "string",
      "description": "string",
      "exists": true,
      "forked_at": "2026-01-01T00:00:00Z",
      "name": "string",
      "snapshot_id": 0
    }
  ],
  "root_id": "string"
}

Errors

StatusDescription
404Database not found

Add schema to database default catalog

POST/v1/databases/{database_id}/schemas

Add a schema, and optionally its tables, to the database's default catalog. Names are stored in lowercase.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID

Request body

NameTypeDescription
name (required)string
tablesAddManagedTableDecl[]Tables to create in the schema. You can also add tables later.
Fields of tables
NameTypeDescription
tables[].constant_per_keystring[]Columns that always hold the same value for rows with the same key. Makes keyed loads faster, but if it is not true, keyed loads silently duplicate rows.
tables[].keystring[]Columns that identify a row. Required for delete, update and upsert loads unless the load request gives its own key.
tables[].layoutTableLayoutHow a table's data files are written. Set when the table is created and fixed after that. - analytical (default): data pages sized for scans. - point_lookup: small data pages, so fetching rows by ID is cheap, as vector search results do. Scans of the table read more pages.
tables[].name (required)string
tables[].partition_byTablePartitionKey[]Columns to partition the table by, in order. Cannot be changed later.
tables[].partition_by[].column (required)stringColumn the key reads.
tables[].partition_by[].transform (required)stringHow the key is derived from the column: identity (the value itself), year, month, day or hour.
tables[].sorted_byTableSortKey[]Columns to sort the table by, in order. Cannot be changed later, and a sorted table cannot be indexed.
tables[].sorted_by[].column (required)stringColumn to sort by.
tables[].sorted_by[].directionstringasc (default) or desc. Null in a response when it was not set.
tables[].sorted_by[].nullsstringWhere nulls go: first or last. Defaults to last for asc and first for desc; null in a response when it was not set.
Example request
{
  "name": "sales",
  "tables": [
    {
      "constant_per_key": [
        "event_date"
      ],
      "key": [
        "order_id"
      ],
      "layout": "analytical",
      "name": "orders"
    }
  ]
}

Response 201 — Schema added

NameTypeDescription
connection_id (required)stringID of the connection that holds the schema. For a database, this is its default_connection_id.
schema (required)string
tables (required)string[]
Example response
{
  "connection_id": "string",
  "schema": "string",
  "tables": [
    "string"
  ]
}

Errors

StatusDescription
400Invalid identifier
404Database not found
409Schema already exists

Add table to database default catalog

POST/v1/databases/{database_id}/schemas/{schema}/tables

Add an empty table to a schema in the database's default catalog. Names are stored in lowercase. You do not have to declare tables first: a load creates the table if it is missing.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID
schema (required)stringSchema name

Request body

NameTypeDescription
constant_per_keystring[]Columns that always hold the same value for rows with the same key. Makes keyed loads faster, but if it is not true, keyed loads silently duplicate rows.
keystring[]Columns that identify a row. Required for delete, update and upsert loads unless the load request gives its own key.
layoutTableLayoutHow a table's data files are written. Set when the table is created and fixed after that. - analytical (default): data pages sized for scans. - point_lookup: small data pages, so fetching rows by ID is cheap, as vector search results do. Scans of the table read more pages.
name (required)string
partition_byTablePartitionKey[]Columns to partition the table by, in order. Cannot be changed later.
sorted_byTableSortKey[]Columns to sort the table by, in order. Cannot be changed later, and a sorted table cannot be indexed.
Fields of partition_by
NameTypeDescription
partition_by[].column (required)stringColumn the key reads.
partition_by[].transform (required)stringHow the key is derived from the column: identity (the value itself), year, month, day or hour.
Fields of sorted_by
NameTypeDescription
sorted_by[].column (required)stringColumn to sort by.
sorted_by[].directionstringasc (default) or desc. Null in a response when it was not set.
sorted_by[].nullsstringWhere nulls go: first or last. Defaults to last for asc and first for desc; null in a response when it was not set.
Example request
{
  "constant_per_key": [
    "event_date"
  ],
  "key": [
    "order_id"
  ],
  "layout": "analytical",
  "name": "orders",
  "partition_by": [
    {
      "column": "created_at",
      "transform": "day"
    }
  ],
  "sorted_by": [
    {
      "column": "created_at",
      "direction": "asc",
      "nulls": "last"
    }
  ]
}

Response 201 — Table added

NameTypeDescription
connection_id (required)string
schema (required)string
table (required)string
Example response
{
  "connection_id": "string",
  "schema": "string",
  "table": "string"
}

Errors

StatusDescription
400Invalid identifier
404Database or schema not found
409Table already exists

Declare which columns are constant per key

PUT/v1/databases/{database_id}/schemas/{schema}/tables/{table}/constant-per-key

Set which columns never change for a given key. Keyed loads (delete, update, upsert) use this to search fewer files. You can change it at any time; it applies from the next load. Send an empty array to clear it.

Only declare columns that really are constant per key. If they are not, a keyed load can leave duplicate rows.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID
schema (required)stringSchema name
table (required)stringTable name

Request body

NameTypeDescription
constant_per_keystring[]Columns that always hold the same value for rows with the same key. Replaces the current list; send [] to clear it. If it is not true, keyed loads silently duplicate rows.
Example request
{
  "constant_per_key": [
    "event_date"
  ]
}

Response 200 — The table's declaration as it now stands

NameTypeDescription
connection_id (required)stringID of the connection that holds the table. For a database, this is its default_connection_id.
constant_per_key (required)string[]Columns now set as constant per key. Empty means none.
schema (required)stringSchema name, in lowercase.
table (required)stringTable name, in lowercase.
Example response
{
  "connection_id": "string",
  "constant_per_key": [
    "string"
  ],
  "schema": "string",
  "table": "string"
}

Errors

StatusDescription
400An invalid column name, or a table with no key
404Database, schema or table not found
409The setting changed at the same time. Retry.

Load database table from inline data, upload, or query result

POST/v1/databases/{database_id}/schemas/{schema}/tables/{table}/loads

Load data into a table in the database's default catalog. Give exactly one source: data (inline CSV, up to 2 MiB), upload_id (a CSV, JSON or Parquet file from POST /v1/uploads) or result_id (a saved query result). The table and its schema are created if they do not exist. mode sets how the rows apply.

Set async to run an upload or inline load as a background job; a result_id load always runs inline. If maintenance is running on the table, the load waits up to 60 seconds before it starts. If another write holds the table, you get 409 with RESOURCE_LOCKED and a Retry-After header.

Path parameters

NameTypeDescription
database_id (required)stringDatabase ID
schema (required)stringSchema name
table (required)stringTable name

Request body

NameTypeDescription
asyncbooleanRun the load in the background and return a job ID to poll. Default: false
async_after_msintegerWith async: true, wait up to this many milliseconds for the load before falling back to a job ID. Must be between 1000 and 30000. Min: 1000
columnsobjectColumn types for inline data, by column name. Must list every CSV column; omit to detect types from the data. Each value is a type name such as BIGINT or DECIMAL(10,2), or an object such as {"type": "DECIMAL", "precision": 10, "scale": 2}. Types: VARCHAR, TEXT, STRING, CHAR, BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, UTINYINT, USMALLINT, UINTEGER, UBIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, DATE, TIME, TIMESTAMP, TIMESTAMPTZ, BINARY, BLOB, UUID, JSON.
datastringCSV text with a header row, up to 2 MiB. Larger data fails with 413 (INLINE_DATA_TOO_LARGE); upload it and use upload_id instead.
formatstringFile format of the upload: csv, json (one object per line) or parquet. Defaults to detection from the upload's content type, then its contents. Inline data accepts only csv; not allowed with result_id.
idempotency_keystringYour own key, such as a UUID, that makes a load of inline data safe to retry: a retry with the same key returns the first result and loads nothing. Up to 255 characters. Reusing a key for different data returns 409 IDEMPOTENCY_KEY_CONFLICT; a retry while the first attempt still runs returns a different 409, so wait and retry.
keystring[]Key columns for delete, update and upsert, overriding the table's key. Use the same key on every load of a table.
mode (required)stringHow to apply the data. The first load into a table must be replace. - replace: the data becomes the table's contents. - append: adds the rows. They must include every existing column (use null for missing values); new columns are added. - delete: removes rows whose key matches a row in the data. - update: replaces rows whose key matches; other rows in the data are ignored. - upsert: like update, but inserts rows whose key does not match. delete, update and upsert need a key, from the table or from key.
result_idstringID of a saved query result. The rows are copied, so the table keeps them after the result expires.
upload_idstringID of a finalized upload. Two loads cannot use the same upload at once; the second gets 409.
Example request
{
  "mode": "replace",
  "data": "order_id,customer_id,amount\n1001,42,1999\n1002,7,4550\n",
  "format": "csv",
  "columns": {
    "order_id": "BIGINT",
    "customer_id": "BIGINT",
    "amount": {
      "type": "DECIMAL",
      "precision": 10,
      "scale": 2
    }
  }
}

Response 200 — Table loaded

NameTypeDescription
arrow_schema_json (required)stringThe table's schema, as a JSON string.
connection_id (required)stringID of the connection that holds the table.
row_count (required)integerTotal rows in the table after the load.
schema_name (required)stringSchema of the table.
table_name (required)stringTable that was loaded.
Example response
{
  "arrow_schema_json": "string",
  "connection_id": "string",
  "row_count": 0,
  "schema_name": "string",
  "table_name": "string"
}

Response 202 — The load is running in the background. Poll the returned job.

NameTypeDescription
id (required)stringJob ID.
status (required)JobStatusStatus of a background job. succeeded, partially_succeeded and failed are final; keep polling while it is pending or running. - pending: queued, or waiting to retry. - running: in progress. - succeeded: finished; all its work succeeded. - partially_succeeded: finished with a result, but some of its work failed (for example, some databases in a bulk creation). See error_message. - failed: failed and will not be retried. See error_message.
status_url (required)stringPath to poll for the job's status.
Example response
{
  "id": "string",
  "status": "pending",
  "status_url": "string"
}

Errors

StatusDescription
400Invalid request, such as a bad mode, not exactly one data source, data that cannot be parsed, or a result that failed to compute
404Database, upload, or result not found, or the table was deleted
409Conflict: the upload was already used or is in use, the result is not ready, or the data changes a column's type in a way that cannot be widened. The table is unchanged. With RESOURCE_LOCKED, another write holds the table; retry after the Retry-After delay.
413Inline data is over 2 MiB (INLINE_DATA_TOO_LARGE). Upload the file and load it by upload_id.
503The catalog is busy (CATALOG_BUSY). The load may already have written its data, so check the table or use an idempotency key before you retry after the Retry-After delay.