Create Branch
Create a new branch from an existing branch or ref. This is useful for agent workflows, ephemeral previews, or server-side automation where you do not want to clone the repo first.
JWT claims
Required scopes: git:write
Requires per repo scope: Yes
Deprecated: Use /api/repos/{repo_name}/branches/create instead.
Authorizations
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
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.
Destination branch name.
"feature/new-onboarding"
Deprecated: use base_ref. Preferred source branch name.
"main"
Whether the base branch should be resolved from the ephemeral namespace.
false
Optional source ref or revision. Provide base_ref or the deprecated base_branch.
Allow non-fast-forward updates when recreating an existing branch.
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.
Whether the new branch should be created in the ephemeral namespace.
false
Response
Branch creation result.
Result of creating a branch, including the resulting ref state.
Human-readable result message.
"branch created"
Destination branch name.
"feature/new-onboarding"
Whether the created branch is ephemeral.
false
Resolved commit SHA at the new branch tip.
"abc123def4567890abc123def4567890abc123de"