Table Columns
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns
This endpoint allows working with a table's columns.
Expected Parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
db_branch_name | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | path | ✅ | string |
table_name | The Table name | path | ✅ | string |
List Table Columns
GEThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns
Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their full dot-separated path (flattened).
Status Code | Description | Example Response/Type Definition |
---|---|---|
200 | OK |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
5XX | Unexpected Error | |
default | Unexpected Error |
Create New Column
POSThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns
Adds a new column to the table. The body of the request should contain the column definition.
Request Body Example
{
"name": "columnName",
"type": "string"
}
Request Body Type Definition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/** * @example {"name":"columnName","type":"string"} */ type AddTableColumn = Column; type Column = { name: string; type: "bool" | "int" | "float" | "string" | "text" | "email" | "multiple" | "link" | "object" | "datetime" | "vector" | "file[]" | "file"; link?: ColumnLink; vector?: ColumnVector; file?: ColumnFile; ["file[]"]?: ColumnFile; notNull?: boolean; defaultValue?: string; unique?: boolean; columns?: Column[]; }; type ColumnLink = { table: string; }; type ColumnVector = { /* * @maximum 10000 * @minimum 2 */ dimension: number; }; type ColumnFile = { defaultPublicAccess?: boolean; };
Status Code | Description | Example Response/Type Definition |
---|---|---|
200 | Schema migration response with ID and migration status. |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
5XX | Unexpected Error | |
default | Unexpected Error |