Database Branch by Name
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name
This path allows interacting with a given database branch, referenced by parameter db_branch_name
, which is expected in the format database_name:branch_name
.
Expected Parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
db_branch_name | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | path | ✅ | string |
Get Branch Schema and Metadata
GEThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name
Status Code | Description | Example Response/Type Definition |
---|---|---|
200 | OK |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
5XX | Unexpected Error |
Create Database Branch
PUThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name
Expected Parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
from | Name of source branch to branch the new schema from | query | - | 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
type CreateBranch = { /* * Select the branch to fork from. Defaults to 'main' */ from?: string; metadata?: BranchMetadata; }; /** * @example {"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]} */ type BranchMetadata = { /* * @minLength 1 */ repository?: string; branch?: BranchName; /* * @minLength 1 */ stage?: string; labels?: string[]; }; /** * @maxLength 255 * @minLength 1 * @pattern [a-zA-Z0-9_\-~]+ */ type BranchName = string;
Status Code | Description | Example Response/Type Definition |
---|---|---|
201 | Created |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
423 | Example response |
|
5XX | Unexpected Error |
Delete Database Branch
DELETEhttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name
Delete the branch in the database and all its resources
Status Code | Description | Example Response/Type Definition |
---|---|---|
200 | OK |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
409 | Example response |
|
5XX | Unexpected Error |