Table Schema
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/schema
This endpoint enables reading or updating the schema of a given table.
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 |
Get Table Schema
GEThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/schema
Status Code | Description | Example Response/Type Definition |
---|---|---|
200 | OK |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
5XX | Unexpected Error |
Update Table Schema
PUThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/schema
Request Body Type Definition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
type SetTableSchema = { columns: Column[]; }; type Column = { name: string; type: "bool" | "int" | "float" | "string" | "text" | "email" | "multiple" | "link" | "object" | "datetime"; link?: ColumnLink; notNull?: boolean; defaultValue?: string; unique?: boolean; columns?: Column[]; }; type ColumnLink = { table: string; };
Status Code | Description | Example Response/Type Definition |
---|---|---|
200 | Schema migration response with ID and migration status. |
|
204 | No Content | |
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
409 | Example response |
|
5XX | Unexpected Error |
Previous
Update table