Skip to content

Get worktree diff

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

Returns uncommitted changes (tracked and untracked files) for a worktree as a unified diff with per-file statistics.

projectId
required
string

Project ID

wid
required
string

Worktree ID

OK

object
files

Files lists per-file change statistics.

Array<object>
object
additions

Additions is the number of lines added.

integer
deletions

Deletions is the number of lines removed.

integer
isBinary

IsBinary is true when the file is a binary file.

boolean
oldPath

OldPath is the previous path for renamed files.

string
path

Path is the file path relative to the worktree root.

string
status

Status is the change type: “added”, “modified”, “deleted”, or “renamed”.

string
rawDiff

RawDiff is the unified diff output from git.

string
totalAdditions

TotalAdditions is the sum of additions across all files.

integer
totalDeletions

TotalDeletions is the sum of deletions across all files.

integer
truncated

Truncated is true when the raw diff exceeded the size limit and was capped.

boolean

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