Skip to content

Get the branching model for a project

GET
/workspaces/{workspace}/projects/{project_key}/branching-model

Return the branching model set at the project level. This view is read-only. The branching model settings can be changed using the settings API.

The returned object:

  1. Always has a development property. development.name is the user-specified branch that can be inherited by an individual repository’s branching model.
  2. Might have a production property. production will not be present when production is disabled. production.name is the user-specified branch that can be inherited by an individual repository’s branching model.
  3. Always has a branch_types array which contains all enabled branch types.
project_key
required
string

The project in question. This is the actual key assigned to the project.

workspace
required
string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

The branching model object

Media type application/json
object
type
required
string
branch_types

The active branch types.

Array<object>
0 <= 4 items unique items
object
kind
required

The kind of branch.

string
Allowed values: feature bugfix release hotfix
prefix
required

The prefix for this branch type. A branch with this prefix will be classified as per kind. The prefix must be a valid prefix for a branch and must always exist. It cannot be blank, empty or null.

string
development
object
name
required

Name of the target branch. If inherited by a repository, it will default to the main branch if the specified branch does not exist.

string
use_mainbranch
required

Indicates if the setting points at an explicit branch (false) or tracks the main branch (true).

boolean
production
object
name
required

Name of the target branch. If inherited by a repository, it will default to the main branch if the specified branch does not exist.

string
use_mainbranch
required

Indicates if the setting points at an explicit branch (false) or tracks the main branch (true).

boolean
Examples
Example response
{
"development": {
"name": "master",
"use_mainbranch": true
},
"production": {
"name": "production",
"use_mainbranch": false
},
"branch_types": [
{
"kind": "release",
"prefix": "release/"
},
{
"kind": "hotfix",
"prefix": "hotfix/"
},
{
"kind": "feature",
"prefix": "feature/"
},
{
"kind": "bugfix",
"prefix": "bugfix/"
}
],
"type": "project_branching_model",
"links": {
"self": {
"href": "https://api.bitbucket.org/.../branching-model"
}
}
}

If the request was not authenticated

Media type application/json
Error

Base type for most resource objects. It defines the common type element that identifies an object’s type. It also identifies the element as Swagger’s discriminator.

object
type
required
string
error
object
message
required
string
detail
string
data

Optional structured data that is endpoint-specific.

object
key
additional properties
any
key
additional properties
any
Example generated
{
"type": "example",
"error": {
"message": "example",
"detail": "example",
"data": {}
}
}

If the authenticated user does not have read access to the project

Media type application/json
Error

Base type for most resource objects. It defines the common type element that identifies an object’s type. It also identifies the element as Swagger’s discriminator.

object
type
required
string
error
object
message
required
string
detail
string
data

Optional structured data that is endpoint-specific.

object
key
additional properties
any
key
additional properties
any
Example generated
{
"type": "example",
"error": {
"message": "example",
"detail": "example",
"data": {}
}
}

If the project does not exist

Media type application/json
Error

Base type for most resource objects. It defines the common type element that identifies an object’s type. It also identifies the element as Swagger’s discriminator.

object
type
required
string
error
object
message
required
string
detail
string
data

Optional structured data that is endpoint-specific.

object
key
additional properties
any
key
additional properties
any
Example generated
{
"type": "example",
"error": {
"message": "example",
"detail": "example",
"data": {}
}
}