Skip to content

Create a database branch

post/v2/projects/{ref}/branches

Creates a database branch from the specified project. Compute and disk size can be set here so the branch is provisioned at the requested size, instead of being resized after creation.

OAuth scopes

  • environment:write

The fine-grained token must include the following permissions to access this endpoint:

  • branching_development_create
  • or
  • branching_production_create

Path parameters

  • ref
    Required
    string

    Project ref

Body

  • data
    Required
    object

Response codes

  • 201
  • 400
  • 401
  • 402
  • 403
  • 429
  • 500

Response (201)

{
"data": {
"type": "branch",
"id": "00000000-0000-0000-0000-000000000000",
"attributes": {
"name": "lorem",
"project_ref": "lorem",
"parent_project_ref": "lorem",
"is_default": true,
"persistent": true,
"with_data": true,
"git_branch": "lorem",
"notify_url": "https://github.com/NeuraLegion/brokencrystals",
"created_at": "2021-12-31T23:34:00Z",
"updated_at": "2021-12-31T23:34:00Z"
}
}
}
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Resource type.",
"enum": [
"branch"
]
},
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
"description": "ID of the branch."
},
"attributes": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the branch."
},
"project_ref": {
"type": "string",
"description": "Ref of the project backing this branch."
},
"parent_project_ref": {
"type": "string",
"description": "Ref of the project it branches from."
},
"is_default": {
"type": "boolean",
"description": "Whether this is the default branch of the project."
},
"persistent": {
"type": "boolean",
"description": "Whether the branch is kept when its git branch is deleted or its PR is merged."
},
"with_data": {
"type": "boolean",
"description": "Whether the branch is seeded from the project's data."
},
"git_branch": {
"description": "Git branch being tracked.",
"type": "string"
},
"notify_url": {
"description": "HTTP endpoint receiving branch status updates.",
"type": "string",
"format": "uri"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Creation timestamp."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Last update timestamp."
}
},
"required": [
"name",
"project_ref",
"parent_project_ref",
"is_default",
"persistent",
"with_data",
"created_at",
"updated_at"
]
}
},
"required": [
"type",
"id",
"attributes"
]
}
},
"required": [
"data"
]
}