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

# Create a branch

`POST /projects/{project_id}/branches`

Create a new branch

## Path parameters

- `project_id` integer, required

## Request body

- Branch
  - `id` integer
  - `created` string, date-time
  - `name` string
  - `branch_name` string
  - `project_id` integer
  - `project_name` string
  - `forking_model` string
  - `stages` Stage[]
    - `id` integer
    - `name` string, required
    - `branch_id` integer
    - `branch_name` string
    - `schema` object
      - `parent` string
      - `triggers` object
        - `parent` boolean
      - `parameters` object[]
        - `name` string
        - `default` string
    - `schema_code` string
    - `enabled` boolean
  - `flows` object
  - `retention_policy` RetentionPolicy
    - `ci_logs` integer
    - `dev_logs` integer
    - `ci_artifacts` integer
    - `dev_artifacts` integer
  - `env_vars` object

## Response `201`

Successfully created run

## Changes

> 50 revisions in range; 1 could not be searched.

- **2023-04-02** `663cd77f4c7a` — 1 info
  - added the new optional request property `created`
- **2023-02-18** `7796ef19a4c9` — 1 info
  - added the new optional request property `retention_policy`
- **2021-07-09** `6f4f98f500b0` — 2 info
  - added the new optional request property `forking_model`
  - the request property `name` became optional
- **2021-01-31** `ecd12e02213d` — 1 info
  - added optional request body
- **2021-01-31** `6dffc3a4de00` — 1 breaking
  - removed the request body

[Change history](https://skmtc.dev/kraken-ci/apis/server-api/changes/projects/:project_id/branches/post.md)

---

[API](https://skmtc.dev/kraken-ci/apis/server-api.md) · [All operations](https://skmtc.dev/kraken-ci/apis/server-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kraken-ci/server-api/revisions/1f2ae877f985/schema)
