# Remove one task's branch from the server's git mirror.

> As `DELETE /crews/{id}/branches`, for one task.
> https://koi.dog/docs/api/tasks/delete-task-branch/

`DELETE /api/v1/tasks/{id}/branch` · Scopes: `crews`, `approve`

Refused while the task's agent is still working (`409 task_live`). GitHub is never touched. The timeline records the key ID, action and outcome.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The task's id. |

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Response.

200 OK · JSON object

## Request.

```sh
curl -X DELETE "https://api.koi.dog/api/v1/tasks/$ID/branch" \
    -H "Authorization: Bearer $KOIDOG_API_KEY"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/tasks/${process.env.ID}/branch`, {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
  },
});
console.log(await res.json());
```

```python
import os

import requests

r = requests.delete(
    f"https://api.koi.dog/api/v1/tasks/{os.environ['ID']}/branch",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "crewId": "string",
  "taskId": "string",
  "deleted": [],
  "missing": [],
  "github": "not_touched",
  "note": "string",
  …
}
```
