Skip to content

Create a database branch

post/v1/projects/{ref}/branches

Creates a database branch from the specified project.

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

  • branch_name
    Required
    string
  • git_branch
    Optional
    string
  • is_default
    Optional
    boolean
  • persistent
    Optional
    boolean
  • region
    Optional
    string
  • desired_instance_size
    Optional
    enum
  • release_channel
    Optional
    enum
  • postgres_engine
    Optional
    enum
  • secrets
    Optional
    object
  • with_data
    Optional
    boolean
  • notify_url
    Optional
    string

Response codes

  • 201
  • 401
  • 403
  • 429
  • 500

Response (201)

{
"id": "00000000-0000-0000-0000-000000000000",
"name": "lorem",
"project_ref": "lorem",
"parent_project_ref": "lorem",
"is_default": true,
"git_branch": "lorem",
"pr_number": -9007199254740991,
"latest_check_run_id": 42,
"persistent": true,
"status": "CREATING_PROJECT",
"created_at": "4404-02-29T04:24Z",
"updated_at": "4404-02-29T04:24Z",
"review_requested_at": "4404-02-29T04:24Z",
"with_data": true,
"notify_url": "https://github.com/NeuraLegion/brokencrystals",
"deletion_scheduled_at": "4404-02-29T04:24Z",
"preview_project_status": "INACTIVE"
}
{
"type": "object",
"properties": {
"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)$"
},
"name": {
"type": "string"
},
"project_ref": {
"type": "string"
},
"parent_project_ref": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"git_branch": {
"type": "string"
},
"pr_number": {
"type": "integer",
"format": "int32",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"latest_check_run_id": {
"description": "This field is deprecated and will not be populated.",
"deprecated": true,
"type": "number"
},
"persistent": {
"type": "boolean"
},
"status": {
"type": "string",
"enum": [
"CREATING_PROJECT",
"RUNNING_MIGRATIONS",
"MIGRATIONS_PASSED",
"MIGRATIONS_FAILED",
"FUNCTIONS_DEPLOYED",
"FUNCTIONS_FAILED"
],
"description": "This field is deprecated. List action runs to get branch status instead.",
"deprecated": true
},
"created_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"updated_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"review_requested_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"with_data": {
"type": "boolean"
},
"notify_url": {
"type": "string",
"format": "uri"
},
"deletion_scheduled_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"preview_project_status": {
"type": "string",
"enum": [
"INACTIVE",
"ACTIVE_HEALTHY",
"ACTIVE_UNHEALTHY",
"COMING_UP",
"UNKNOWN",
"GOING_DOWN",
"INIT_FAILED",
"REMOVED",
"RESTORING",
"UPGRADING",
"PAUSING",
"RESTORE_FAILED",
"RESTARTING",
"PAUSE_FAILED",
"RESIZING"
]
}
},
"required": [
"id",
"name",
"project_ref",
"parent_project_ref",
"is_default",
"persistent",
"status",
"created_at",
"updated_at",
"with_data"
]
}