Merge branches
Merges one branch into another. If the target branch is the deployment branch, this triggers a live deployment.
curl -X POST "https://api.documentationai.app/api/v1/branches/merge" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"base": "main",
"head": "feature/new-docs",
"commitMessage": "example_string"
}'
import requests
import json
url = "https://api.documentationai.app/api/v1/branches/merge"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"base": "main",
"head": "feature/new-docs",
"commitMessage": "example_string"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.documentationai.app/api/v1/branches/merge", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"base": "main",
"head": "feature/new-docs",
"commitMessage": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"base": "main",
"head": "feature/new-docs",
"commitMessage": "example_string"
}`)
req, err := http.NewRequest("POST", "https://api.documentationai.app/api/v1/branches/merge", 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/merge')
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 = '{
"base": "main",
"head": "feature/new-docs",
"commitMessage": "example_string"
}'
response = http.request(request)
puts response.body
{
"commitSha": "example_string",
"status": 42
}
{
"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
}
POST
/branches/merge
POST
Bearer Token
Bearer Tokenstring
RequiredAPI key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as
Authorization: Bearer dai_...Content-Typestring
RequiredThe media type of the request body
Options: application/json
basestring
RequiredTarget branch to merge into
Min length: 1
headstring
RequiredSource branch to merge from
Min length: 1
commitMessagestring
Merge commit message
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token. API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Body
application/json
basestring
RequiredTarget branch to merge into
headstring
RequiredSource branch to merge from
commitMessagestring
Merge commit message
Responses
commitShastring
statusinteger
statusCodeinteger
errorstring
messagestring
statusCodeinteger
errorstring
messagestring
statusCodeinteger
errorstring
messagestring
Was this page helpful?
Last updated 2 days ago
Built with Documentation.AI