---
title: "Create a branch"
method: POST
path: "/projects/{project_id}/branches"
tags: ["Branches"]
---

# Create a branch

`POST /projects/{project_id}/branches`

Create a new branch.

Branch project provisioning runs asynchronously, so the newly created branch is returned in a transitional state (typically `creating_branch`) and only reaches `success` once the underlying project has been set up. Poll the branch resource until its `state` becomes `success` before performing further operations on it.

Requires the Branching feature to be enabled on the account.

*Note: Creating a new branch may take several minutes depending on the project size.*

## Path parameters

- `project_id` string, required

## Headers

- `X-PhraseApp-OTP` string

## Request body

- object
  - `name` string, required — Name of the branch
  - `base` string — Name of an existing branch to use as the base for the new branch.

## Response `201`

Created

- Branch
  - `base_project_id` string
  - `branch_project_id` string
  - `name` string
  - `base` string, nullable — Name of the base branch this branch was created from. Only present for branches created with the newer branching system.
  - `created_at` string, date-time
  - `updated_at` string, date-time
  - `merged_at` string, date-time
  - `merged_by` UserPreview
    - `id` string
    - `username` string
    - `name` string
    - `gravatar_uid` string
  - `created_by` UserPreview
    - `id` string
    - `username` string
    - `name` string
    - `gravatar_uid` string
  - `state` 'creating_branch' | 'merging_branch' | 'syncing_branch' | 'merged' | 'success' | 'branch_error' | 'merge_conflict'
  - `child_branches` string[]

## Other responses

- `400` — Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry.
- `401` — Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry.
- `403` — Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions.
- `404` — Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry.
- `422` — Unprocessable entity. The request was well-formed but failed validation. The response body lists each offending field in the `errors` array, with its resource, field, and a human-readable message. Correct the listed fields and retry.
- `429` — Too many requests. The rate limit has been exceeded. Wait until the time indicated by the `X-Rate-Limit-Reset` response header before retrying.

---

[API](https://skmtc.net/phrase/apis/control-hub-service.md) · [All operations](https://skmtc.net/phrase/apis/control-hub-service/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phrase/control-hub-service/revisions/98ecac7ba2bf/schema)
