Merge Agent Branch
curl --request POST \
--url https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge"
headers = {"authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": {
"version": {
"id": "06e7531f-d327-440f-b17c-cfef565935de",
"org_id": "eac199ff-428f-4c48-8835-b7831cadc2a2",
"agent_id": "a724172e-d676-42f3-8566-29f04e9c1a89",
"branch_id": null,
"snapshot": {
"behavior": {
"nodes": [
{
"id": "cf5b80db-9199-4cf8-af79-5f1e51adb6ef",
"position": { "x": 240, "y": 120 },
"data": {
"name": "Verify account",
"rule": "Confirm the caller's name, then ask for the account number."
}
}
],
"edges": []
},
"settings": {
"displayName": "Front desk",
"systemPrompt": "You are the front desk assistant for Northwind Dental. Keep answers under two sentences.",
"voice": "maya",
"languages": ["en-US"]
},
"contact": {
"inboundNumbers": []
}
},
"name": null,
"created_via": "manual",
"revision": 0,
"created_by": "3c1c51e0-e993-4bb5-a471-fe67db6e7006",
"created_at": "2026-09-10T18:09:52.204Z"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "BRANCH_BEHIND",
"message": "Development moved past this branch — rebase before merging"
}
]
}
{
"data": null,
"errors": [
{
"error": "NO_CHANGES",
"message": "The branch has no saved changes to merge"
}
]
}
{
"data": null,
"errors": [
{
"error": "MERGE_IN_PROGRESS",
"message": "Another merge or rebase is in progress for this agent, please retry"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent or branch not found"
}
]
}
Branches
Merge Agent Branch
Fast-forward a branch into the agent’s dev timeline.
POST
/
v2
/
agents
/
{agent_id}
/
branches
/
{branch_id}
/
merge
Merge Agent Branch
curl --request POST \
--url https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge"
headers = {"authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/merge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": {
"version": {
"id": "06e7531f-d327-440f-b17c-cfef565935de",
"org_id": "eac199ff-428f-4c48-8835-b7831cadc2a2",
"agent_id": "a724172e-d676-42f3-8566-29f04e9c1a89",
"branch_id": null,
"snapshot": {
"behavior": {
"nodes": [
{
"id": "cf5b80db-9199-4cf8-af79-5f1e51adb6ef",
"position": { "x": 240, "y": 120 },
"data": {
"name": "Verify account",
"rule": "Confirm the caller's name, then ask for the account number."
}
}
],
"edges": []
},
"settings": {
"displayName": "Front desk",
"systemPrompt": "You are the front desk assistant for Northwind Dental. Keep answers under two sentences.",
"voice": "maya",
"languages": ["en-US"]
},
"contact": {
"inboundNumbers": []
}
},
"name": null,
"created_via": "manual",
"revision": 0,
"created_by": "3c1c51e0-e993-4bb5-a471-fe67db6e7006",
"created_at": "2026-09-10T18:09:52.204Z"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "BRANCH_BEHIND",
"message": "Development moved past this branch — rebase before merging"
}
]
}
{
"data": null,
"errors": [
{
"error": "NO_CHANGES",
"message": "The branch has no saved changes to merge"
}
]
}
{
"data": null,
"errors": [
{
"error": "MERGE_IN_PROGRESS",
"message": "Another merge or rebase is in progress for this agent, please retry"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent or branch not found"
}
]
}
Overview
Lands the branch on dev as a fast-forward: the branch’s newest version becomes one new dev version, and the branch is closed. A fast-forward is only possible while the branch’s base is still dev’s newest version. If dev has moved, the request returns409 BRANCH_BEHIND; run Preview Agent Branch Rebase and Rebase Agent Branch, then merge again. Takes no body.
Requires an admin, owner, operator, or prompter role.
Headers
string
required
Your API key for authentication.
Path Parameters
string
required
The agent’s unique identifier.
string
required
The branch’s unique identifier. Must be an open branch on this agent, and must have at least one version saved to it; a branch with no saves of its own returns
400 NO_CHANGES.Response
object
The new dev version. Its
snapshot is the branch head’s configuration. The branch no longer appears in List Agent Branches.Show version object
Show version object
string
Unique identifier for the version. This is now dev’s newest version.
string
The organization that owns the agent.
string
The agent the version belongs to.
null
Always
null; the merged version lives on dev, not on the branch.object
The agent configuration:
behavior (nodes and edges), settings, contact, and knowledge when present. Same shape as the snapshot on any saved version.null
Always
null; merge versions are unnamed.string
Always
manual for a merge version.integer
Rewrite counter for the row.
0 on a newly written version.string | null
ID of the user who merged, or
null when merged with an org-level key.string
ISO 8601 timestamp of creation.
null | array
null on success, or a list of error objects if the request failed.{
"data": {
"version": {
"id": "06e7531f-d327-440f-b17c-cfef565935de",
"org_id": "eac199ff-428f-4c48-8835-b7831cadc2a2",
"agent_id": "a724172e-d676-42f3-8566-29f04e9c1a89",
"branch_id": null,
"snapshot": {
"behavior": {
"nodes": [
{
"id": "cf5b80db-9199-4cf8-af79-5f1e51adb6ef",
"position": { "x": 240, "y": 120 },
"data": {
"name": "Verify account",
"rule": "Confirm the caller's name, then ask for the account number."
}
}
],
"edges": []
},
"settings": {
"displayName": "Front desk",
"systemPrompt": "You are the front desk assistant for Northwind Dental. Keep answers under two sentences.",
"voice": "maya",
"languages": ["en-US"]
},
"contact": {
"inboundNumbers": []
}
},
"name": null,
"created_via": "manual",
"revision": 0,
"created_by": "3c1c51e0-e993-4bb5-a471-fe67db6e7006",
"created_at": "2026-09-10T18:09:52.204Z"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "BRANCH_BEHIND",
"message": "Development moved past this branch — rebase before merging"
}
]
}
{
"data": null,
"errors": [
{
"error": "NO_CHANGES",
"message": "The branch has no saved changes to merge"
}
]
}
{
"data": null,
"errors": [
{
"error": "MERGE_IN_PROGRESS",
"message": "Another merge or rebase is in progress for this agent, please retry"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent or branch not found"
}
]
}
Docs for agents: llms.txt
Was this page helpful?