Skip to main content
POST
Create Branch

Authorizations

Authorization
string
header
required

JWT bearer token signed with your organization's registered signing key. There is no OAuth authorization server; you mint tokens yourself and the token's scopes claim carries the granted permission scopes. Public scopes: git:read (read repository contents), git:write (write branches, commits, tags, and notes), repo:write (create and manage repositories), org:read (list an organization's repositories). Each operation's security requirement names the scopes it requires. See https://code.storage/docs/getting-started/authentication for how to mint tokens.

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
deprecated

Deprecated: use base_ref. Preferred source branch name.

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. Provide base_ref or the deprecated base_branch.

force
boolean

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

preferred_base
string

Optional pack hint. A branch name the backend prefers as the delta base when it builds the thin pack. It does not change the source or the result.

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"