---
title: "Remove worktree"
method: DELETE
path: "/api/worktree"
tags: ["worktree"]
---

# Remove worktree

`DELETE /api/worktree`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/worktree`
- Auth: none required

Load the project's canonical configuration and remove a saved worktree using its recorded strategy.

## Request body

- WorktreeRemoveInput
  - `projectID` string, required
  - `directory` string, required
  - `force` boolean, required

## Response `204`

<No Content>

## Other responses

- `400`: WorktreeError | InvalidRequestError
- `401`: UnauthorizedError
- `404`: ProjectNotFoundError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
