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.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.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:
BranchCreationDetails:
description: Details required when creating a new branch
type: object
properties:
name:
description: Human-readable name for the new branch
type: string
description:
description: Optional description for the branch purpose or contents (max 50 characters)
type: string
maxLength: 50
pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9- ]*$
scaleToZero:
$ref: '#/components/schemas/ScaleToZeroConfiguration'
backupConfiguration:
$ref: '#/components/schemas/BackupConfiguration'
mode:
description: The mode used to discriminate between types of branches.
type: string
enum:
- inherit
- custom
discriminator:
propertyName: mode
mapping:
inherit: '#/components/schemas/BranchFromParent'
custom: '#/components/schemas/BranchFromConfiguration'
oneOf:
- $ref: '#/components/schemas/BranchFromParent'
- $ref: '#/components/schemas/BranchFromConfiguration'
required:
- name
- mode
LogEntry:
type: object
properties:
timestamp:
type: string
format: date-time
instanceID:
type: string
level:
$ref: '#/components/schemas/LogLevel'
message:
type: string
process:
description: Name of the PostgreSQL process that emitted the log
type: string
required:
- timestamp
- instanceID
- message
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
BranchMetricsRequest:
type: object
properties:
start:
description: Start time
type: string
format: date-time
end:
description: End time
type: string
format: date-time
metrics:
description: List of metric names to query.
type: array
items:
$ref: '#/components/schemas/BranchMetricName'
maxItems: 15
minItems: 1
instances:
description: List of instance IDs to query
type: array
items:
type: string
aggregations:
description: List of aggregations to get, this is how the data-points within the interval are aggregated. Each one will generate a separate time-series per metric in the response.
type: array
items:
type: string
enum:
- avg
- max
- min
required:
- start
- end
- metrics
- aggregations
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
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
ScaleToZeroConfiguration:
description: Configuration for scaling branches to zero when not in use
type: object
properties:
enabled:
description: Whether scale to zero is enabled
type: boolean
inactivityPeriodMinutes:
description: Duration in minutes after which branches will be hibernated if not accessed
type: integer
default: 30
required:
- enabled
- inactivityPeriodMinutes
BackupConfiguration:
description: Details about the branch continuous backup configuration
type: object
properties:
retentionPeriod:
description: how long are we keeping the backups around for
type: integer
format: int32
default: 2
maximum: 35
minimum: 2
backupTime:
description: time of day/week when we are taking a full backup
type: string
pattern: ^(\*|[0-6]):(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])$
x-excluded: true
x-internal: true
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
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
- 'null'
connectionString:
description: Database connection string for accessing this branch
type:
- string
- 'null'
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
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
- 'null'
required:
- start
- end
- logs
- nextCursor
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
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
PostgresConfigParameter:
description: Detailed information about a single PostgreSQL configuration parameter
type: object
properties:
name:
description: The name of the PostgreSQL parameter
type: string
type:
description: The data type of the parameter
type: string
enum:
- string
- int
- float
- bytes
- enum
- duration
- boolean
description:
description: Human-readable description of what the parameter controls
type: string
section:
description: The section/category this parameter belongs to
type: string
acceptableRange:
description: Information about the acceptable range of values for this parameter
type: object
properties:
minValue:
description: Minimum allowed value (if applicable)
type: string
maxValue:
description: Maximum allowed value (if applicable)
type: string
enumValues:
description: List of allowed enum values (if applicable)
type: array
items:
type: string
defaultValue:
description: The default value for this parameter
type: string
defaultValueSource:
description: The source of the default value
type: string
enum:
- postgres
- instance_type
currentValue:
description: The current value of this parameter in the branch
type: string
documentationLink:
description: Link to PostgreSQL documentation for this parameter
type: string
recommendation:
description: Optional recommendation for this parameter (currently empty)
type: string
restartRequired:
description: Whether a database restart is required for this parameter change to take effect
type: boolean
required:
- name
- type
- description
- defaultValue
- defaultValueSource
- currentValue
- documentationLink
- recommendation
- section
ClusterLifecycle:
description: Information about the current lifecycle state of a database cluster
type: object
properties:
state:
description: Current operational state of the cluster (ready, creating, updating, etc.)
enum:
- ready
- creating
- updating
- upgrading
- unknown
title: Current state in the cluster lifecycle
reason:
description: Reason for the current lifecycle state, especially useful for non-ready states
type: string
phase:
description: Current phase within the lifecycle process
type: string
deprecated: true
required:
- state
- phase
BranchMetricName:
description: Name of a branch metric exposed by the API.
type: string
enum:
- cpu
- memory
- disk
- connections_active
- connections_idle
- network_ingress
- network_egress
- iops_read
- iops_write
- latency_read
- latency_write
- throughput_read
- throughput_write
- wal_sync_time
- replication_lag_time
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
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
- aggre
# --- 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