Single Table Column
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns/column_nameThis endpoint allows working with a single column from a given table.
Expected parameters
| Name | Description | In | Required | Schema |
|---|---|---|---|---|
db_branch_name | The DBBranchName matches the pattern | path | ✅ | string |
table_name | The Table name | path | ✅ | string |
column_name | The Column name | path | ✅ | string |
Get Column Information
GEThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns/column_nameGet the definition of a single column.
Responses
type GetColumn = {
name: string;
type: "bool" | "int" | "float" | "string" | "text" | "email" | "multiple" | "link" | "object" | "datetime" | "vector" | "file[]" | "file" | "json";
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;
};
type Column = {
name: string;
type: "bool" | "int" | "float" | "string" | "text" | "email" | "multiple" | "link" | "object" | "datetime" | "vector" | "file[]" | "file" | "json";
link?: ColumnLink;
vector?: ColumnVector;
file?: ColumnFile;
["file[]"]?: ColumnFile;
notNull?: boolean;
defaultValue?: string;
unique?: boolean;
columns?: Column[];
};type GetColumn = {
id?: string;
message: string;
};{
"message": "invalid API key"
}type GetColumn = {
id?: string;
message: string;
};type GetColumn = void;type GetColumn = void;Update Column
PATCHhttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns/column_nameUpdate column with partial data. Can be used for renaming the column by providing a new "name" field.
Request Body Type Definition
/**
* @example {"name":"newName","description":"Sample new description"}
*/
type UpdateColumn = {
/**
* @minLength 1
*/
name: string;
};Responses
type UpdateColumn = {
/**
* @minLength 1
*/
migrationID: string;
parentMigrationID: string;
status: MigrationStatus;
};
type MigrationStatus = "completed" | "pending" | "failed";type UpdateColumn = {
id?: string;
message: string;
};{
"message": "invalid API key"
}type UpdateColumn = {
id?: string;
message: string;
};type UpdateColumn = void;type UpdateColumn = void;Delete Column
DELETEhttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/columns/column_nameDeletes the specified column.
Responses
type DeleteColumn = {
/**
* @minLength 1
*/
migrationID: string;
parentMigrationID: string;
status: MigrationStatus;
};
type MigrationStatus = "completed" | "pending" | "failed";type DeleteColumn = {
id?: string;
message: string;
};{
"message": "invalid API key"
}type DeleteColumn = {
id?: string;
message: string;
};type DeleteColumn = void;type DeleteColumn = void;