Branch Metadata

https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/metadata

This path allows interacting with the metadata of a specific database branch.

Expected Parameters

NameDescriptionInRequiredSchema
db_branch_nameThe DBBranchName matches the pattern `{db_name}:{branch_name}`. pathstring

Update Branch Metadata

PUT
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/metadata

Update the branch metadata

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
type UpdateBranchMetadata = 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 CodeDescriptionExample Response/Type Definition
204No Content
400Bad Request
type UpdateBranchMetadata = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type UpdateBranchMetadata = {
    id?: string;
    message: string;
};
5XXUnexpected Error
defaultUnexpected Error

Get Branch Metadata

GET
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/metadata
Status CodeDescriptionExample Response/Type Definition
200OK
{
  "repository": "github.com/my/repository",
  "branch": "feature-login",
  "stage": "testing",
  "labels": [
    "epic-100"
  ]
}
400Bad Request
type GetBranchMetadata = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type GetBranchMetadata = {
    id?: string;
    message: string;
};
5XXUnexpected Error
defaultUnexpected Error