Skip to main content
POST
/
api
/
repos
/
{repo_name}
/
branches
/
create
Create Branch
curl --request POST \
  --url https://api.{cluster}.code.storage/api/repos/{repo_name}/branches/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "base_branch": "main",
  "base_is_ephemeral": false,
  "target_branch": "feature/new-onboarding",
  "target_is_ephemeral": false
}
'
{
  "commit_sha": "abc123def4567890abc123def4567890abc123de",
  "message": "branch created",
  "target_branch": "feature/new-onboarding",
  "target_is_ephemeral": false
}

Documentation Index

Fetch the complete documentation index at: https://code.storage/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

repo_name
string
required

Repository name. Names that contain / or any other character that is not safe in a URL path segment must be URL encoded so the value occupies a single path segment. For example pierre/example is sent as pierre%2Fexample. Plain names such as example can be sent as-is. The server URL-decodes the value before resolving the repository.

Body

application/json

Create a branch from another branch or ref. The source and destination can live in the default namespace or the ephemeral namespace.

Create-branch request body describing the new branch and its base ref.

target_branch
string
required

Destination branch name.

Example:

"feature/new-onboarding"

base_branch
string

Preferred source branch name. Use base_ref when you need an exact ref.

Example:

"main"

base_is_ephemeral
boolean

Whether the base branch should be resolved from the ephemeral namespace.

Example:

false

base_ref
string

Optional source ref or revision. This supersedes base_branch when provided.

force
boolean

Allow non-fast-forward updates when recreating an existing branch.

preferred_base
string

Optional fallback base branch name used by the backend when it needs another starting point.

target_is_ephemeral
boolean

Whether the new branch should be created in the ephemeral namespace.

Example:

false

Response

Branch creation result.

Result of creating a branch, including the resulting ref state.

message
string
required

Human-readable result message.

Example:

"branch created"

target_branch
string
required

Destination branch name.

Example:

"feature/new-onboarding"

target_is_ephemeral
boolean
required

Whether the created branch is ephemeral.

Example:

false

commit_sha
string

Resolved commit SHA at the new branch tip.

Example:

"abc123def4567890abc123def4567890abc123de"