# Create branch policy

```http
POST /projects/{project_reference}/branch-policies
```

Create a merge policy for branches matching a pattern. Requires project.settings.manage.

## Parameters

| Name                | In   | Required | Description                                                |
| ------------------- | ---- | -------- | ---------------------------------------------------------- |
| `project_reference` | path | Yes      | Project slug, UUID, or domain that identifies the project. |

## Request body

| Field                   | Type        | Required | Description                                                                                           |
| ----------------------- | ----------- | -------- | ----------------------------------------------------------------------------------------------------- |
| `name`                  | string      | Yes      |                                                                                                       |
| `is_enabled`            | boolean     |          |                                                                                                       |
| `target_branch_pattern` | string,null |          | Branch-name pattern the policy applies to. Omit or send null to apply it to every branch.             |
| `required_approvals`    | integer     |          | Required approval count. Defaults to 0; MCP create\_branch\_policy defaults to 1.                     |
| `allow_self_approval`   | boolean     |          | Allow the merger’s approval to count. Defaults to true; MCP create\_branch\_policy defaults to false. |
| `required_reviewer_ids` | array       |          |                                                                                                       |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 201    | Policy created.                                                                                             |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Forbidden                                                                                                   |
| 404    | Not found                                                                                                   |
| 413    | Payload too large                                                                                           |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
