---
title: "Update the branching model config for a project"
method: PUT
path: "/workspaces/{workspace}/projects/{project_key}/branching-model/settings"
tags: ["Branching model"]
---

# Update the branching model config for a project

`PUT /workspaces/{workspace}/projects/{project_key}/branching-model/settings`

Update the branching model configuration for a project.

The `development` branch can be configured to a specific branch or to
track the main branch. Any branch name can be supplied, but will only
successfully be applied to a repository via inheritance if that branch
exists for that repository. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
`development` property will leave the development branch unchanged.

The `production` branch can be a specific branch, the main
branch or disabled. Any branch name can be supplied, but will only
successfully be applied to a repository via inheritance if that branch
exists for that repository. The `enabled` property can be used to enable (`true`)
or disable (`false`) it. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
`production` property will leave the production branch unchanged.

The `branch_types` property contains the branch types to be updated.
Only the branch types passed will be updated. All updates will be
rejected if it would leave the branching model in an invalid state.
For branch types this means that:

1. The prefixes for all enabled branch types are valid. For example,
   it is not possible to use '*' inside a Git prefix.
2. A prefix of an enabled branch type must not be a prefix of another
   enabled branch type. This is to ensure that a branch can be easily
   classified by its prefix unambiguously.

It is possible to store an invalid prefix if that branch type would be
left disabled. Only the passed properties will be updated. The
properties not passed will be left unchanged. Each branch type must
have a `kind` property to identify it.

The `default_branch_deletion` property is a string. The value of `true`
indicates to delete branches by default. The value of `false` indicates
that branches will not be deleted by default. A request without a
`default_branch_deletion` property will leave it unchanged. Other values
would be ignored.

## Response `200`

The updated branching model configuration

- BranchingModelSettings — A repository's branching model settings
  - `type` string, required
  - `links` object
    - `self` object — A link to a resource related to this object.
      - `href` string, uri
      - `name` string
  - `branch_types` object[]
    - `enabled` boolean — Whether the branch type is enabled or not. A disabled branch type may contain an invalid `prefix`.
    - `kind` 'feature' | 'bugfix' | 'release' | 'hotfix', required — The kind of the branch type.
    - `prefix` string — The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The `prefix` of an enabled branch type must be a valid branch prefix.Additionally, it cannot be blank, empty or `null`. The `prefix` for a disabled branch type can be empty or invalid.
  - `development` object
    - `is_valid` boolean — Indicates if the configured branch is valid, that is, if the configured branch actually exists currently. Is always `true` when `use_mainbranch` is `true` (even if the main branch does not exist). This field is read-only. This field is ignored when updating/creating settings.
    - `name` string — The configured branch. It must be `null` when `use_mainbranch` is `true`. Otherwise it must be a non-empty value. It is possible for the configured branch to not exist (e.g. it was deleted after the settings are set). In this case `is_valid` will be `false`. The branch must exist when updating/setting the `name` or an error will occur.
    - `use_mainbranch` boolean — Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`). When `true` the `name` must be `null` or not provided. When `false` the `name` must contain a non-empty branch name.
  - `production` object
    - `is_valid` boolean — Indicates if the configured branch is valid, that is, if the configured branch actually exists currently. Is always `true` when `use_mainbranch` is `true` (even if the main branch does not exist). This field is read-only. This field is ignored when updating/creating settings.
    - `name` string — The configured branch. It must be `null` when `use_mainbranch` is `true`. Otherwise it must be a non-empty value. It is possible for the configured branch to not exist (e.g. it was deleted after the settings are set). In this case `is_valid` will be `false`. The branch must exist when updating/setting the `name` or an error will occur.
    - `use_mainbranch` boolean — Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`). When `true` the `name` must be `null` or not provided. When `false` the `name` must contain a non-empty branch name.
    - `enabled` boolean — Indicates if branch is enabled or not.

## Other responses

- `400` — If the request contains an invalid branching model configuration
- `401` — If the request was not authenticated
- `403` — If the authenticated user does not have admin access to the project
- `404` — If the project does not exist

---

[API](https://skmtc.dev/atlassian/apis/bitbucket-api.md) · [All operations](https://skmtc.dev/atlassian/apis/bitbucket-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/atlassian/bitbucket-api/revisions/5748cb124a33/schema)
