Skip to content

Create a worktree

POST
/api/panes/{pane_id}/worktree
Code sample: Shell / cURL
curl --request POST \
--url http://127.0.0.1:8004/api/panes/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/worktree \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "branch": "example", "select": true }'

Creates a Git worktree for branch beside the pane’s repository (the worktree-path setting) and opens a window in it.

pane_id
required
string format: uuid

Pane ID

Media typeapplication/json
object
branch
required
string
select

Make its window the active one.

boolean | null
default: true

The new worktree and its window’s pane

Media typeapplication/json
object
session_id
required
string format: uuid
pane_id
required
string format: uuid
path
required
string
branch
required
string

Example generated

{
"session_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"pane_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"path": "example",
"branch": "example"
}

An invalid branch name, or no such remote branch; or a malformed ID or JSON body

Media typetext/plain
string

Missing or wrong access token

Media typetext/plain
string

The request’s Host or Origin isn’t allowed, or the caller can’t use this route (a guest token, or btmux connect)

No such pane

Media typetext/plain
string

The pane isn’t in a local Git repository, the worktree’s path exists, or the branch tracks another remote branch

Media typetext/plain
string

A body over the size limit

Media typetext/plain
string

No Content-Type: application/json

Media typetext/plain
string

A body that doesn’t match its schema

Media typetext/plain
string

Git failed

Media typetext/plain
string