# Deleting a Branch

### About this export

| Field | Value |
| --- | --- |
| **content_type** | lesson |
| **platform** | contentstack-academy |
| **source_url** | https://www.contentstack.com/academy/courses/branches-foundations/deleting-a-branch |
| **course_slug** | branches-foundations |
| **lesson_slug** | deleting-a-branch |
| **markdown_file_url** | /academy/md/courses/branches-foundations/deleting-a-branch.md |
| **generated_at** | 2026-04-28T06:55:36.305Z |

> Part of **[Branches Foundations](https://www.contentstack.com/academy/courses/branches-foundations)** on Contentstack Academy. **Academy MD v3** — structured for retrieval; no quiz or assessment keys.

<!-- ai_metadata: {"lesson_id":"05","type":"text","duration_minutes":1,"topics":["Deleting","Branch"]} -->

#### Lesson text

# **Deleting Branches Using the CLI**

## **1\. Identify the Branch ID:**

Retrieve the ID of the branch you want to delete.

## **2\. Use the CLI Command:**

Delete a branch

USAGE  
  $ csdx cm:branches:delete \[-uid \] \[-k \]  
  $ csdx cm:branches:delete \[--uid \] \[--stack-api-key \]

FLAGS  
  -k, --stack-api-key=  Stack API key  
  -y, --yes                    Force the deletion of the branch by skipping the confirmation  
  --uid=                Branch UID to be deleted

DESCRIPTION  
  Delete a branch

EXAMPLES  
  $ csdx cm:branches:delete

  $ csdx cm:branches:delete --uid main -k bltxxxxxxxx

  $ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx

  $ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx --yes

![BranchesFoundations-L5-img-1.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt78563255bd9268cc/67dd7e810c6f5553861fcef1/BranchesFoundations-L5-img-1.png)

## **3\. Verify Deletion:**

Confirm the successful deletion by checking the list of branches or using the appropriate CLI command to list branches.

csdx cm:branches -k

![BranchesFoundations-L5-img-2.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt667ca21ead42a562/67dd7ea2c5b83e650e924b8e/BranchesFoundations-L5-img-2.png)

## **Conclusion:**

Following these step-by-step instructions, you can seamlessly delete branches in Contentstack using the CLI tool.  

# **Deleting Branches Using API Calls**

## **1\. Identify API Key and authtoken and Branch ID:**

*   Obtain the API KEY of the stack for the branch you wish to delete.
    
*   Obtain the authtoken for the user.
    
*   Obtain the unique ID of the branch you wish to delete.
    

## **2\. Make API Call:**

DELETE /v3/stacks/branches/{branch\_id}

Replace {branch\_id} with the ID of the branch you want to delete.  
  
  
curl --location --request DELETE 'https://api.contentstack.io/v3/stacks/branches/dev?force=true' \\  
  
\--header 'api\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*' \\  
  
\--header 'authtoken: \*\*\*\*\*\*\*\*\*\*\*\*\*' \\  
  
\--header 'Content-Type: application/json' \\  
  
\--data ''

## **3\. Response:**

Upon successful deletion, the response will confirm the removal of the specified branch.

{  
  
    "notice": "Your request to delete branch is in progress. Please check organization bulk task queue for more details.",  
  
    "branch": {  
  
        "uid": "dev",  
  
        "source": "main",  
  
        "created\_by": "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*",  
  
        "updated\_by": "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*",  
  
        "created\_at": "2024-01-23T09:13:09.739Z",  
  
        "updated\_at": "2024-01-23T09:13:10.714Z",  
  
        "deleted\_at": false,  
  
        "alias": \[\]  
  
    }  
  
}

![BranchesFoundations-L5-img-3.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltc2f10243ea60bd3f/67dd7ebbc566ee10565e0075/BranchesFoundations-L5-img-3.png)

# **Deleting Branches Using UI**

## **1\. Navigate to Branch Settings:**

*   Log in to your Contentstack account.
    
*   Access the settings panel.
    
*   Choose "Branches" to view a list of existing branches.  
      
    ![BranchesFoundations-L5-img-4.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt0c0aed4460902b62/67dd7ed3983a65c6393b7c44/BranchesFoundations-L5-img-4.png)
    

## **2\. Select Branch for Deletion:**

*   Locate the branch you want to delete from the list.
    
*   Click on the branch to select it.  
      
    ![BranchesFoundations-L5-img-5.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltf713e8213a26cb19/67dd7ee9782bfb67eb6f5634/BranchesFoundations-L5-img-5.png)
    

## **3\. Delete Branch:**

*   Once the branch is selected, look for the option to delete the branch (usually represented by a trash/bin icon).
    
*   Confirm the deletion when prompted.  
      
    
    ![BranchesFoundations-L5-img-6.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltdba319de396dc790/67dd7efe0c6f5566621fcf14/BranchesFoundations-L5-img-6.png)  
      
    
    ![BranchesFoundations-L5-img-7.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blte6fc933625df28b1/67dd7f134a89c3933aa3030b/BranchesFoundations-L5-img-7.png)  
      
    
    ![BranchesFoundations-L5-img-8.png](https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt36345100a21a082c/67dd7f36782bfb67156f5641/BranchesFoundations-L5-img-8.png)
    

# **Further Reference**

*   [Deleting a branch](https://www.contentstack.com/docs/developers/branches/delete-a-branch) [using CLI](https://www.contentstack.com/docs/developers/branches/delete-a-branch)
    
*   [Deleting a branch using API](https://www.contentstack.com/docs/developers/apis/content-management-api#delete-a-branch)
    
*   [Deleting a branch using UI](https://www.contentstack.com/docs/developers/branches/delete-a-branch)

#### Key takeaways

- Connect **Deleting a Branch** back to your stack configuration before moving to the next module.
- Capture one concrete artifact (screenshot, Postman call, or code snippet) that proves the step works in your environment.
- Re-read the delivery versus management boundary for anything you changed in the entry model.

## Supplement for indexing

### Content summary

Deleting a Branch. Deleting Branches Using the CLI 1\. Identify the Branch ID: Retrieve the ID of the branch you want to delete. 2\. Use the CLI Command: Delete a branch USAGE $ csdx cm:branches:delete \ -uid \ \ -k \ $ csdx cm:branches:delete \ --uid \ \ --stack-api-key \ FLAGS -k, --stack-api-key= Stack API key -y, --yes Force the deletion of the branch by skipping the confirmation --uid= Branch UID to be deleted DESCRIPTION Delete a branch EXAMPLES $ csdx cm:branches:delete $ csdx cm:branches:delete --uid main -k bltxxxxxxxx $ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx $ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx --yes ! BranchesFoundations-L5-img-1.png (https://image

### Retrieval tags

- Deleting
- Branch
- branches-foundations
- lesson 05
- Deleting a Branch
- branches-foundations lesson

### Indexing notes

Index this lesson as a primary chunk tagged with lesson_id "05" and topics: [Deleting, Branch].
Parent course slug: branches-foundations. Use asset_references URLs as thumbnail hints in search results when present.
Never surface LMS quiz content or assessment answers from this file.

### Asset references

| Label | URL |
| --- | --- |
| BranchesFoundations-L5-img-1.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt78563255bd9268cc/67dd7e810c6f5553861fcef1/BranchesFoundations-L5-img-1.png` |
| BranchesFoundations-L5-img-2.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt667ca21ead42a562/67dd7ea2c5b83e650e924b8e/BranchesFoundations-L5-img-2.png` |
| BranchesFoundations-L5-img-3.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltc2f10243ea60bd3f/67dd7ebbc566ee10565e0075/BranchesFoundations-L5-img-3.png` |
| BranchesFoundations-L5-img-4.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt0c0aed4460902b62/67dd7ed3983a65c6393b7c44/BranchesFoundations-L5-img-4.png` |
| BranchesFoundations-L5-img-5.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltf713e8213a26cb19/67dd7ee9782bfb67eb6f5634/BranchesFoundations-L5-img-5.png` |
| BranchesFoundations-L5-img-6.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltdba319de396dc790/67dd7efe0c6f5566621fcf14/BranchesFoundations-L5-img-6.png` |
| BranchesFoundations-L5-img-7.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blte6fc933625df28b1/67dd7f134a89c3933aa3030b/BranchesFoundations-L5-img-7.png` |
| BranchesFoundations-L5-img-8.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt36345100a21a082c/67dd7f36782bfb67156f5641/BranchesFoundations-L5-img-8.png` |

### External links

| Label | URL |
| --- | --- |
| Contentstack Academy home | `https://www.contentstack.com/academy/` |
| Training instance setup | `https://www.contentstack.com/academy/training-instance` |
| Academy playground (GitHub) | `https://github.com/contentstack/contentstack-academy-playground` |
| Contentstack documentation | `https://www.contentstack.com/docs/` |
| BranchesFoundations-L5-img-1.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt78563255bd9268cc/67dd7e810c6f5553861fcef1/BranchesFoundations-L5-img-1.png` |
| BranchesFoundations-L5-img-2.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt667ca21ead42a562/67dd7ea2c5b83e650e924b8e/BranchesFoundations-L5-img-2.png` |
| BranchesFoundations-L5-img-3.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltc2f10243ea60bd3f/67dd7ebbc566ee10565e0075/BranchesFoundations-L5-img-3.png` |
| BranchesFoundations-L5-img-4.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt0c0aed4460902b62/67dd7ed3983a65c6393b7c44/BranchesFoundations-L5-img-4.png` |
| BranchesFoundations-L5-img-5.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltf713e8213a26cb19/67dd7ee9782bfb67eb6f5634/BranchesFoundations-L5-img-5.png` |
| BranchesFoundations-L5-img-6.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/bltdba319de396dc790/67dd7efe0c6f5566621fcf14/BranchesFoundations-L5-img-6.png` |
| BranchesFoundations-L5-img-7.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blte6fc933625df28b1/67dd7f134a89c3933aa3030b/BranchesFoundations-L5-img-7.png` |
| BranchesFoundations-L5-img-8.png | `https://images.contentstack.io/v3/assets/bltebc53cfaf0dd6403/blt36345100a21a082c/67dd7f36782bfb67156f5641/BranchesFoundations-L5-img-8.png` |
| Deleting a branch | `https://www.contentstack.com/docs/developers/branches/delete-a-branch` |
| Deleting a branch using API | `https://www.contentstack.com/docs/developers/apis/content-management-api#delete-a-branch` |
