# Delete branch

```http
DELETE /projects/{project_reference}/branches/{branch_id}
```

Delete a branch and its uncommitted changes. Requires project.files.write; API keys also need delete scope.

## Parameters

| Name                | In   | Required | Description                                                                                                           |
| ------------------- | ---- | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `project_reference` | path | Yes      | Project slug, UUID, or domain that identifies the project.                                                            |
| `branch_id`         | path | Yes      | Branch to delete. Only a branch with a base branch can be deleted, excluding main. Its associated content is removed. |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 200    | Branch deleted successfully.                                                                                |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Forbidden. API keys also require delete scope.                                                              |
| 404    | Not found                                                                                                   |
| 409    | Conflict                                                                                                    |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
