Xata Branches API
Operations for managing database branches within projects, including creation, configuration, and deletion
Operations for managing database branches within projects, including creation, configuration, and deletion
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/xata-branches-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
openapi: 3.0.0
info:
title: Xata API Keys Branches API
description: Xata API
version: '1.0'
contact:
name: help@xata.io
servers:
- url: https://api.xata.tech
description: Xata API
tags:
- name: Branches
description: Operations for managing database branches within projects, including creation, configuration, and deletion
x-displayName: Branches
paths:
/organizations/{organizationID}/projects/{projectID}/branches:
summary: Branch Management
description: Endpoints for listing and creating branches within a project.
get:
operationId: listBranches
summary: List all branches
description: Retrieves a list of all branches within the specified project, including their metadata, region, and access settings.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project to list branches from
required: true
schema:
type: string
responses:
'200':
description: List of branches within the project
content:
application/json:
schema:
type: object
properties:
branches:
description: Array of branch objects with their metadata
type: array
items:
$ref: '#/components/schemas/BranchListMetadata'
required:
- branches
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:read
tags:
- Branches
post:
operationId: createBranch
summary: Create a new branch
description: Creates a new branch within the specified project. Branches can be created from scratch or derived from an existing parent branch.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project to create the branch in
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BranchCreationDetails'
responses:
'201':
description: Branch successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/BranchShortMetadata'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
'412':
$ref: '#/components/responses/PreconditionFailedError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:write
tags:
- Branches
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}:
summary: Branch Operations
description: Endpoints for retrieving, updating, and deleting a specific branch by ID.
get:
operationId: describeBranch
summary: Get branch details
description: Retrieves detailed information about a specific branch by its ID, including status, connection string, and configuration.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project containing the branch
required: true
schema:
type: string
- name: branchID
in: path
description: Unique identifier of the branch to retrieve details for
required: true
schema:
type: string
responses:
'200':
description: Branch details retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/BranchMetadata'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:read
tags:
- Branches
patch:
operationId: updateBranch
summary: Update branch details
description: Updates the configuration of a specific branch by its ID, such as changing its name, description, or resource allocation.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project containing the branch
required: true
schema:
type: string
- name: branchID
in: path
description: Unique identifier of the branch to update
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BranchUpdateDetails'
responses:
'200':
description: Branch successfully updated
content:
application/json:
schema:
$ref: '#/components/schemas/BranchShortMetadata'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:write
tags:
- Branches
delete:
operationId: deleteBranch
summary: Delete a branch
description: Permanently deletes a specific branch by its ID and all associated data. This action cannot be undone.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project containing the branch
required: true
schema:
type: string
- name: branchID
in: path
description: Unique identifier of the branch to delete
required: true
schema:
type: string
responses:
'204':
description: Branch successfully deleted
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:write
tags:
- Branches
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/credentials:
get:
operationId: getBranchCredentials
summary: Retrieve branch credentials
parameters:
- name: organizationID
in: path
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
required: true
schema:
type: string
- name: branchID
in: path
required: true
schema:
type: string
- name: username
in: query
description: Username that the credentials requested for
required: false
schema:
type: string
responses:
'200':
description: Credentials for the branch retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/BranchCredentials'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- credentials:read
tags:
- Branches
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/credentials/rotate:
post:
operationId: rotateBranchCredentials
summary: Rotate branch credentials
description: Triggers a credential rotation for the branch database user. The new credentials can be retrieved via the credentials endpoint after rotation completes.
parameters:
- name: organizationID
in: path
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
required: true
schema:
type: string
- name: branchID
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RotateCredentialsRequest'
responses:
'204':
description: Credential rotation initiated successfully
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- credentials:write
tags:
- Branches
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/metrics:
post:
operationId: branchMetrics
summary: Retrieve branch metrics
description: Returns time-series data for one or more metrics of a branch.
parameters:
- name: organizationID
in: path
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
required: true
schema:
type: string
- name: branchID
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BranchMetricsRequest'
responses:
'200':
description: Metrics for a branch
content:
application/json:
schema:
$ref: '#/components/schemas/BranchMetrics'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- metrics:read
tags:
- Branches
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/restore:
summary: Restore from backup
description: Endpoint for restoring from a backup.
post:
operationId: restoreFromBackup
summary: Create a new branch from a backup of another branch
description: Creates a new backup branch within the specified project.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project containing the source branch
required: true
schema:
type: string
- name: branchID
in: path
description: Unique identifier of the source branch of the backup
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RestoreDetails'
responses:
'201':
description: Branch successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/BranchShortMetadata'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:write
tags:
- Branches
x-excluded: true
x-internal: true
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/logs:
post:
operationId: branchLogs
summary: Retrieve branch logs
parameters:
- name: organizationID
in: path
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
required: true
schema:
type: string
- name: branchID
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BranchLogsRequest'
responses:
'200':
description: Logs for a branch
content:
application/json:
schema:
$ref: '#/components/schemas/BranchLogs'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- logs:read
tags:
- Branches
/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/postgres-config:
get:
operationId: getBranchPostgresConfig
summary: Get PostgreSQL configuration details
description: Retrieves detailed information about the current PostgreSQL configuration parameters for a branch, including parameter types, descriptions, acceptable ranges, default values, and current values.
parameters:
- name: organizationID
in: path
description: Unique identifier of the organization containing the project
required: true
schema:
$ref: '#/components/schemas/OrganizationID'
- name: projectID
in: path
description: Unique identifier of the project containing the branch
required: true
schema:
type: string
- name: branchID
in: path
description: Unique identifier of the branch to retrieve PostgreSQL configuration for
required: true
schema:
type: string
responses:
'200':
description: PostgreSQL configuration details retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/PostgresConfigDetails'
'400':
$ref: '#/components/responses/GenericError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/GenericError'
5XX:
description: Unexpected Error
default:
description: Unexpected Error
security:
- xata:
- branch:read
tags:
- Branches
components:
schemas:
BranchMetricResult:
description: Time-series for a single metric.
type: object
properties:
metric:
description: Name of the queried metric.
type: string
unit:
description: Unit of the metric (percentage, bytes, ms, etc.)
type: string
series:
type: array
items:
$ref: '#/components/schemas/MetricSeries'
required:
- metric
- unit
- series
BranchFromConfiguration:
type: object
properties:
mode:
type: string
enum:
- custom
configuration:
$ref: '#/components/schemas/ClusterConfiguration'
required:
- mode
- configuration
BranchCredentials:
description: Credentials for accessing a branch, username and password
type: object
properties:
username:
description: Username for accessing the branch database
type: string
password:
description: Password for accessing the branch database
type: string
required:
- username
- password
x-internal: true
RestoreDetails:
description: Metadata about a backup, used in request to create a restore. If configuration is not provided, the branch will inherit the source branch configuration.
type: object
properties:
name:
description: Human-readable name of the branch
type: string
description:
description: Optional description of the branch purpose or contents
type: string
scaleToZero:
$ref: '#/components/schemas/ScaleToZeroConfiguration'
backupConfiguration:
$ref: '#/components/schemas/BackupConfiguration'
configuration:
$ref: '#/components/schemas/ClusterConfiguration'
required:
- name
x-excluded: true
x-internal: true
BranchStatus:
description: Detailed status information about a branch and its underlying database cluster
type: object
properties:
status:
description: Status indicator for the branch according to CNPG
type: string
title: Current status of the cluster
statusType:
description: Type of status of the branch
enum:
- STATUS_TYPE_UNSPECIFIED
- STATUS_TYPE_HEALTHY
- STATUS_TYPE_TRANSIENT
- STATUS_TYPE_FAULT
- STATUS_TYPE_HIBERNATED
message:
description: Human-readable message explaining the current status
type: string
deprecated: true
title: Summary of the cluster status
lifecycle:
$ref: '#/components/schemas/ClusterLifecycle'
instanceCount:
description: Total number of database instances in the cluster
type: integer
maximum: 5
minimum: 1
title: Number of instances in the cluster
instanceReadyCount:
description: Number of database instances that are ready and operational
type: integer
maximum: 5
minimum: 0
title: Number of instances ready in the cluster
instances:
description: Details about each individual database instance in the cluster
type: array
items:
$ref: '#/components/schemas/InstanceStatus'
title: List of instances in the cluster
required:
- status
- statusType
- instanceCount
- instanceReadyCount
- instances
BranchListMetadata:
description: Metadata about a branch used when listing branches in a project
type: object
properties:
id:
description: Unique identifier for the branch
type: string
name:
description: Human-readable name of the branch
type: string
description:
description: Optional description of the branch purpose or contents
type: string
createdAt:
description: Timestamp when the branch was created
type: string
format: date-time
updatedAt:
description: Timestamp when the branch was last updated
type: string
format: date-time
parentID:
description: Identifier of the parent branch if this is a derived branch, null otherwise
type: string
nullable: true
region:
description: Geographic region where the branch is deployed
type: string
publicAccess:
description: Whether the branch allows public access without authentication
type: boolean
backupsEnabled:
description: Whether the branch is in a region that supports backups
type: boolean
required:
- id
- name
- createdAt
- updatedAt
- region
- publicAccess
- backupsEnabled
BranchShortMetadata:
description: Basic metadata about a branch, used in response to create/update operations
type: object
properties:
id:
description: Unique identifier for the branch
type: string
name:
description: Human-readable name of the branch
type: string
description:
description: Optional description of the branch purpose or contents
type: string
createdAt:
description: Timestamp when the branch was created
type: string
format: date-time
updatedAt:
description: Timestamp when the branch was last updated
type: string
format: date-time
parentID:
description: Identifier of the parent branch if this is a derived branch, null otherwise
type: string
nullable: true
connectionString:
description: Database connection string for accessing this branch
type: string
nullable: true
region:
description: Geographic region where the branch is deployed
type: string
publicAccess:
description: Whether the branch allows public access without authentication
type: boolean
required:
- id
- name
- createdAt
- updatedAt
- region
- publicAccess
BranchMetrics:
description: A collection of metrics (cpu, memory, disk,...) for each of the instances of a branch
type: object
properties:
start:
type: string
format: date-time
end:
type: string
format: date-time
results:
description: One entry per requested metric, in the order the metrics were requested.
type: array
items:
$ref: '#/components/schemas/BranchMetricResult'
required:
- start
- end
- results
BranchLogs:
description: A collection of logs for each of the instances of a branch
type: object
properties:
start:
type: string
format: date-time
end:
type: string
format: date-time
logs:
type: array
items:
$ref: '#/components/schemas/LogEntry'
nextCursor:
description: Pagination cursor for the next page
type: string
nullable: true
required:
- start
- end
- logs
- nextCursor
LogLevel:
description: Log level enumeration
type: string
enum:
- debug
- info
- warning
- error
RotateCredentialsRequest:
description: Request to rotate credentials for a branch database user
type: object
properties:
username:
description: Database username to rotate credentials for
type: string
required:
- username
BranchMetadata:
description: Detailed metadata about a branch, including its status and configuration
type: object
properties:
id:
description: Unique identifier for the branch
type: string
name:
description: Human-readable name of the branch
type: string
description:
description: Optional description of the branch purpose or contents
type: string
createdAt:
description: Timestamp when the branch was created
type: string
format: date-time
updatedAt:
description: Timestamp when the branch was last updated
type: string
format: date-time
parentID:
description: Identifier of the parent branch if this is a derived branch, null otherwise
type: string
nullable: true
region:
description: Geographic region where the branch is deployed
type: string
status:
$ref: '#/components/schemas/BranchStatus'
connectionString:
description: Database connection string for accessing this branch
type: string
nullable: true
publicAccess:
description: Whether the branch allows public access without authentication
type: boolean
backupsEnabled:
description: Whether the branch is in a region that supports backups
type: boolean
scaleToZero:
$ref: '#/components/schemas/ScaleToZeroConfiguration'
configuration:
$ref: '#/components/schemas/ClusterConfiguration'
backupConfiguration:
$ref: '#/components/schemas/BackupConfiguration'
required:
- id
- name
- createdAt
- updatedAt
- region
- status
- connectionString
- configuration
- publicAccess
- backupsEnabled
- scaleToZero
LogFilter:
description: A single filter on log entries.
type: object
properties:
field:
description: Log attribute to filter on.
type: string
enum:
- instance
- level
- process
- body
op:
description: Match operator.
type: string
enum:
- in
- contains
- icontains
- regex
- iregex
values:
description: 'Used with `op: in`.'
type: array
items:
type: string
value:
description: Used with the body operators.
type: string
required:
- field
- op
ClusterConfiguration:
description: Configuration details for a database cluster backing a branch
type: object
properties:
region:
description: Geographic region where the cluster will be deployed
type: string
storage:
description: Branch storage in GiB (gigabytes)
type: integer
format: int32
maximum: 250
instanceType:
description: The instance type according to the xata instance types available
type: string
image:
description: PostgreSQL image to use for the database instances
type: string
replicas:
description: Number of replicas in the branch. Every child branch is created with no replicas. This can be updated.
type: integer
format: int32
maximum: 4
minimum: 0
postgresConfigurationParameters:
description: Arbitrary PostgreSQL configuration parameters for the cluster
type: object
additionalProperties:
type: string
preloadLibraries:
description: List of PostgreSQL extensions and libraries to preload
type: array
items:
type: string
required:
- image
- region
- instanceType
- replicas
BranchLogsRequest:
type: object
properties:
start:
description: Start time
type: string
format: date-time
end:
description: End time
type: string
format: date-time
filters:
description: Filters applied to log entries. Multiple filters are combined with AND.
type: array
items:
$ref: '#/components/schemas/LogFilter'
limit:
type: integer
default: 100
maximum: 200
minimum: 1
cursor:
description: Pagination cursor from a previous response
type: string
required:
- start
- end
MetricSeries:
description: The metric series
type: object
properties:
instanceID:
description: ID of the instance
type: string
aggregation:
description: The aggregation used to generate this time-series
type: string
enum:
- avg
- max
- min
values:
type: array
items:
type: object
properties:
timestamp:
type: string
format: date-time
value:
type: number
required:
- timestamp
- value
required:
- instanceID
- aggregation
- values
PostgresConfigDetails:
description: Detailed information about PostgreSQL configuration parameters for a branch
type: object
properties:
parameters:
description: Array of PostgreSQL configuration parameters with detailed information
items:
$ref: '#/components/schemas/PostgresConfigParameter'
type: array
required:
- parameters
BranchUpdateDetails:
description: Details that can be updated for an existing branch
type: object
properties:
name:
description: New name for the branch
type: string
description:
description: New description for the branch (max 50 characters)
type: string
maximum: 50
pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9- ]*$
replicas:
description: Number of database replicas to scale to
type: integer
format: int32
maximum: 4
minimum: 0
storage:
description: Branch storage in GiB (gigabytes)
type: integer
format: int32
maximum: 250
instanceType:
description: New instance type for the branch
type: string
backupConfiguration:
$ref: '#/components/schemas/BackupConfiguration'
hibernate:
description: Enabled when the branch should be hibernated, disabled if it needs to be reactivated.
type: boolean
scaleToZero:
$ref: '#/components/schemas/ScaleToZeroConfiguration'
postgresConfigurationParameters:
description: Arbitrary PostgreSQL configuration parameters for the cluster
type: object
additionalProperties:
type: string
preloadLibraries:
description: List of PostgreSQL extensions and libraries to preload
type: array
items:
type: string
image:
description: PostgreSQL image to use for the database instances
type: string
PostgresConfigParameter:
description: Detailed information about a single PostgreSQL configuration parameter
type: object
properties:
name:
description: The name of the PostgreSQL parameter
type: string
type:
# --- truncated at 32 KB (43 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/xata/refs/heads/main/openapi/xata-branches-api-openapi.yml