Delete a branch
Deletes a branch from the repository. The deployment branch cannot be deleted. Requires editor or admin role.
curl -X POST "https://api.documentationai.app/api/v1/branches/delete" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"branchName": "John Doe"
}'
import requests
import json
url = "https://api.documentationai.app/api/v1/branches/delete"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"branchName": "John Doe"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.documentationai.app/api/v1/branches/delete", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"branchName": "John Doe"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"branchName": "John Doe"
}`)
req, err := http.NewRequest("POST", "https://api.documentationai.app/api/v1/branches/delete", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.documentationai.app/api/v1/branches/delete')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"branchName": "John Doe"
}'
response = http.request(request)
puts response.body
{
"deleted": "example_string"
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
/branches/delete
Target server for requests. Edit to use your own host.
API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Authorization: Bearer dai_...The media type of the request body
Branch name to delete
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Body
Branch name to delete
Responses
Name of the deleted branch