---
title: "deleteRepoBranch"
---

> Documentation Index
> Fetch the complete documentation index at: https://buildrforge.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# deleteRepoBranch

Path: Forge API › branches

`DELETE /repos/{repo_id}/branches/{branch}`

Soft-delete a branch; restore brings it back.

## Path parameters

- `repo_id` (`deleteRepoBranch.path.repo_id`; string, required)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `branch` (`deleteRepoBranch.path.branch`; string, required)
  - minLength: `1`

## Code samples

### cURL

```bash
curl --request DELETE \
  --url '<base-url>/repos/<repo_id>/branches/<branch>'
```

### TypeScript

```typescript
const url = '<base-url>/repos/<repo_id>/branches/<branch>';
const options = {method: 'DELETE'};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/repos/<repo_id>/branches/<branch>"

response = requests.delete(url)

print(response.text)
```

## Responses

### 204

<No Content>

### 400

InvalidRequest

#### Example

```json
{
  "_tag": "InvalidRequest",
  "part": "path",
  "issues": [
    {
      "path": [
        "string"
      ],
      "message": "string"
    }
  ]
}
```

- `_tag` (`deleteRepoBranch.response.400._tag`; string, required)
  - one of `"InvalidRequest"`
- `part` (`deleteRepoBranch.response.400.part`; string, required)
  - one of `"path"`, `"query"`, `"headers"`, `"body"`
- `issues` (`deleteRepoBranch.response.400.issues`; array of object, required)
  - `path` (`deleteRepoBranch.response.400.issues.path`; array\<any of\>, required)
    - any of the following: `string`, `integer`
  - `message` (`deleteRepoBranch.response.400.issues.message`; string, required)

### 401

InvalidCredentials

#### Example

```json
{
  "_tag": "InvalidCredentials"
}
```

- `_tag` (`deleteRepoBranch.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 403

Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "Forbidden",
  "message": "string"
}
```

Any of the following:

- `ForbiddenEncoded`
  - `_tag` (`ForbiddenEncoded._tag`; string, required)
    - one of `"Forbidden"`
  - `message` (`ForbiddenEncoded.message`; string, required)
- `ForbiddenOriginEncoded`
  - `_tag` (`ForbiddenOriginEncoded._tag`; string, required)
    - one of `"ForbiddenOrigin"`
- `RequiresPersonalSessionEncoded`
  - `_tag` (`RequiresPersonalSessionEncoded._tag`; string, required)
    - one of `"RequiresPersonalSession"`
- `RunBranchRequiredEncoded`
  - `_tag` (`RunBranchRequiredEncoded._tag`; string, required)
    - one of `"RunBranchRequired"`
  - `branch` (`RunBranchRequiredEncoded.branch`; string, required)
    - minLength: `1`
  - `message` (`RunBranchRequiredEncoded.message`; string, required)

### 404

BranchNotFound | RepoNotFound

#### Example

```json
{
  "_tag": "BranchNotFound",
  "branch": "string"
}
```

Any of the following:

- `BranchNotFoundEncoded`
  - `_tag` (`BranchNotFoundEncoded._tag`; string, required)
    - one of `"BranchNotFound"`
  - `branch` (`BranchNotFoundEncoded.branch`; string, required)
    - minLength: `1`
- `RepoNotFoundEncoded`
  - `_tag` (`RepoNotFoundEncoded._tag`; string, required)
    - one of `"RepoNotFound"`

### 409

ProtectedBranch | OpenChangeRequestExists | RepoArchived

#### Example

```json
{
  "_tag": "ProtectedBranch",
  "branch": "string"
}
```

Any of the following:

- `ProtectedBranchEncoded`
  - `_tag` (`ProtectedBranchEncoded._tag`; string, required)
    - one of `"ProtectedBranch"`
  - `branch` (`ProtectedBranchEncoded.branch`; string, required)
    - minLength: `1`
- `OpenChangeRequestExistsEncoded`
  - `_tag` (`OpenChangeRequestExistsEncoded._tag`; string, required)
    - one of `"OpenChangeRequestExists"`
  - `branch` (`OpenChangeRequestExistsEncoded.branch`; string, required)
    - minLength: `1`
  - `number` (`OpenChangeRequestExistsEncoded.number`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`
- `RepoArchivedEncoded`
  - `_tag` (`RepoArchivedEncoded._tag`; string, required)
    - one of `"RepoArchived"`

### 413

WriteTooLarge

#### Example

```json
{
  "_tag": "WriteTooLarge",
  "message": "string"
}
```

- `_tag` (`deleteRepoBranch.response.413._tag`; string, required)
  - one of `"WriteTooLarge"`
- `message` (`deleteRepoBranch.response.413.message`; string, required)

### 429

RateLimited

#### Example

```json
{
  "_tag": "RateLimited"
}
```

- `_tag` (`deleteRepoBranch.response.429._tag`; string, required)
  - one of `"RateLimited"`

### 500

RepoFailure

#### Example

```json
{
  "_tag": "RepoFailure",
  "reason": "string"
}
```

- `_tag` (`deleteRepoBranch.response.500._tag`; string, required)
  - one of `"RepoFailure"`
- `reason` (`deleteRepoBranch.response.500.reason`; string, required)

### 503

RepoBusy | SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "RepoBusy",
  "message": "string"
}
```

Any of the following:

- `RepoBusyEncoded`
  - `_tag` (`RepoBusyEncoded._tag`; string, required)
    - one of `"RepoBusy"`
  - `message` (`RepoBusyEncoded.message`; string, required)
- `SessionUnavailableEncoded`
  - `_tag` (`SessionUnavailableEncoded._tag`; string, required)
    - one of `"SessionUnavailable"`
- `RateLimitUnavailableEncoded`
  - `_tag` (`RateLimitUnavailableEncoded._tag`; string, required)
    - one of `"RateLimitUnavailable"`


Source: https://buildrforge.com/docs/api/delete-repo-branch/index.md
