Skip to content

List worktrees

GET
/api/v1/projects/{projectId}/{agentType}/worktrees

Returns all worktrees for the given project, including terminal connection state, Claude attention status, and git branch information.

projectId
required
string

Project ID

OK

Array<object>
object
branch

Branch is the git branch checked out in this worktree.

string
exitCode

ExitCode is the agent’s exit code when in shell state. Nil means the agent is still running (or no exit code captured).

integer
id

ID is the worktree identifier — directory name for git worktrees, “main” for project root.

string
needsInput

NeedsInput is true when Claude is blocked waiting for user attention.

boolean
notificationType

NotificationType indicates why Claude needs attention.

string
Allowed values: permission_prompt idle_prompt auth_success elicitation_dialog
path

Path is the filesystem path inside the container.

string
projectId

ProjectID is the container ID this worktree belongs to.

string
state

State is the terminal connection state (connected, shell, background, stopped).

string
Allowed values: connected shell background stopped

Bad Request

object
code
string
Allowed values: INVALID_BODY INVALID_CONTAINER_ID INVALID_CONTAINER_NAME INVALID_WORKTREE_ID INVALID_WORKTREE_NAME REQUIRED_FIELD INVALID_PATH INVALID_NETWORK_CONFIG NOT_A_DIRECTORY NOT_FOUND NAME_TAKEN NOT_CONFIGURED STALE_MOUNTS BUDGET_EXCEEDED PROXY_ERROR INTERNAL
error
string

Not Found

object
code
string
Allowed values: INVALID_BODY INVALID_CONTAINER_ID INVALID_CONTAINER_NAME INVALID_WORKTREE_ID INVALID_WORKTREE_NAME REQUIRED_FIELD INVALID_PATH INVALID_NETWORK_CONFIG NOT_A_DIRECTORY NOT_FOUND NAME_TAKEN NOT_CONFIGURED STALE_MOUNTS BUDGET_EXCEEDED PROXY_ERROR INTERNAL
error
string

Internal Server Error

object
code
string
Allowed values: INVALID_BODY INVALID_CONTAINER_ID INVALID_CONTAINER_NAME INVALID_WORKTREE_ID INVALID_WORKTREE_NAME REQUIRED_FIELD INVALID_PATH INVALID_NETWORK_CONFIG NOT_A_DIRECTORY NOT_FOUND NAME_TAKEN NOT_CONFIGURED STALE_MOUNTS BUDGET_EXCEEDED PROXY_ERROR INTERNAL
error
string