Rebase Agent Branch
curl --request POST \
--url https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"dev_head_version_id": {},
"resolutions": {}
}
'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase"
payload = {
"dev_head_version_id": {},
"resolutions": {}
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({dev_head_version_id: {}, resolutions: {}})
};
fetch('https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase', 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}/rebase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dev_head_version_id' => [
],
'resolutions' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase"
payload := strings.NewReader("{\n \"dev_head_version_id\": {},\n \"resolutions\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
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}/rebase")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"dev_head_version_id\": {},\n \"resolutions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dev_head_version_id\": {},\n \"resolutions\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"version": {
"id": "f9b3ef64-22f7-4189-8a90-2a08a2e233fa",
"org_id": "739122d8-a8fb-4b92-b65c-718b25b73431",
"agent_id": "4f2abf11-7131-4935-9b8a-aa92cc4447c8",
"branch_id": "69e0956d-561e-4c3a-8b6b-d60a84c928b4",
"snapshot": {
"behavior": {
"nodes": [
{
"id": "39645cd3-c7a3-4261-9b62-4fbc8155fd76",
"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": "435b84b8-7237-4007-a95c-a9e4515d1255",
"created_at": "2026-09-10T18:02:37.518Z"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "UNRESOLVED_CONFLICTS",
"message": "Every conflict needs a resolution"
}
]
}
{
"data": null,
"errors": [
{
"error": "REBASE_STALE",
"message": "Development changed since the preview — preview again"
}
]
}
{
"data": null,
"errors": [
{
"error": "INVALID_RESOLUTIONS",
"message": "resolutions must map conflict ids to 'ours', 'theirs', or { value }"
}
]
}
{
"data": null,
"errors": [
{
"error": "MERGE_IN_PROGRESS",
"message": "Another merge or rebase is in progress for this agent, please retry"
}
]
}
Branches
Rebase Agent Branch
Rebase a branch onto the dev head with resolutions.
POST
/
v2
/
agents
/
{agent_id}
/
branches
/
{branch_id}
/
rebase
Rebase Agent Branch
curl --request POST \
--url https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"dev_head_version_id": {},
"resolutions": {}
}
'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase"
payload = {
"dev_head_version_id": {},
"resolutions": {}
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({dev_head_version_id: {}, resolutions: {}})
};
fetch('https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase', 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}/rebase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dev_head_version_id' => [
],
'resolutions' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase"
payload := strings.NewReader("{\n \"dev_head_version_id\": {},\n \"resolutions\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
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}/rebase")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"dev_head_version_id\": {},\n \"resolutions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/branches/{branch_id}/rebase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dev_head_version_id\": {},\n \"resolutions\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"version": {
"id": "f9b3ef64-22f7-4189-8a90-2a08a2e233fa",
"org_id": "739122d8-a8fb-4b92-b65c-718b25b73431",
"agent_id": "4f2abf11-7131-4935-9b8a-aa92cc4447c8",
"branch_id": "69e0956d-561e-4c3a-8b6b-d60a84c928b4",
"snapshot": {
"behavior": {
"nodes": [
{
"id": "39645cd3-c7a3-4261-9b62-4fbc8155fd76",
"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": "435b84b8-7237-4007-a95c-a9e4515d1255",
"created_at": "2026-09-10T18:02:37.518Z"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "UNRESOLVED_CONFLICTS",
"message": "Every conflict needs a resolution"
}
]
}
{
"data": null,
"errors": [
{
"error": "REBASE_STALE",
"message": "Development changed since the preview — preview again"
}
]
}
{
"data": null,
"errors": [
{
"error": "INVALID_RESOLUTIONS",
"message": "resolutions must map conflict ids to 'ours', 'theirs', or { value }"
}
]
}
{
"data": null,
"errors": [
{
"error": "MERGE_IN_PROGRESS",
"message": "Another merge or rebase is in progress for this agent, please retry"
}
]
}
Overview
Rebases the branch onto the dev head you previewed against: re-runs the three-way merge, applies your conflict resolutions, saves the merged configuration as a new version on the branch, and moves the branch’s base to that dev head. Run Preview Agent Branch Rebase first to getdev_head_version_id and the conflict IDs. Once the rebase succeeds, Merge Agent Branch fast-forwards.
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.
Body Parameters
string | null
required
The
dev_head_version_id returned by the preview, passed unchanged (including null when the preview returned null). If dev has gained a version since, the request returns 409 REBASE_STALE; preview again and retry. Omitting the field is treated as null and fails the same way whenever dev has any version.object
Map from conflict
id (as reported by the preview) to how to settle it. Each value is one of:"ours": keep the branch’s value."theirs": take dev’s value.{ "value": ... }: write this value in place of both. Any JSON value is accepted; the merged configuration is validated as a whole before it is saved.
400 INVALID_RESOLUTIONS and nothing is written. Every conflict the merge finds must be covered, or the request returns 400 UNRESOLVED_CONFLICTS and nothing is written. That error does not list which conflicts are outstanding, so build your resolutions from Preview Agent Branch Rebase, which returns the full conflict set. Omit when the preview reported no conflicts.{
"setting:systemPrompt": "theirs",
"node:ae527fa3-25f4-4dbb-ba79-fe7b6aa6b075#data.rule": {
"value": "Confirm the caller's name, then ask for the account number."
}
}
Response
object
The new branch version holding the merged configuration. When the branch is already based on dev’s head, nothing is written and the branch’s current head version is returned instead.
Show version object
Show version object
string
Unique identifier for the version.
string
The organization that owns the agent.
string
The agent the version belongs to.
string
The branch the version was saved to. Matches
{branch_id}.object
The merged agent configuration:
behavior (nodes and edges), settings, contact, and knowledge when present. Same shape as the snapshot on any saved version.null
Always
null; rebase versions are unnamed.string
Always
manual for a rebase version.integer
Rewrite counter for the row.
0 on a newly written version.string | null
ID of the user who ran the rebase, or
null when run 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": "f9b3ef64-22f7-4189-8a90-2a08a2e233fa",
"org_id": "739122d8-a8fb-4b92-b65c-718b25b73431",
"agent_id": "4f2abf11-7131-4935-9b8a-aa92cc4447c8",
"branch_id": "69e0956d-561e-4c3a-8b6b-d60a84c928b4",
"snapshot": {
"behavior": {
"nodes": [
{
"id": "39645cd3-c7a3-4261-9b62-4fbc8155fd76",
"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": "435b84b8-7237-4007-a95c-a9e4515d1255",
"created_at": "2026-09-10T18:02:37.518Z"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "UNRESOLVED_CONFLICTS",
"message": "Every conflict needs a resolution"
}
]
}
{
"data": null,
"errors": [
{
"error": "REBASE_STALE",
"message": "Development changed since the preview — preview again"
}
]
}
{
"data": null,
"errors": [
{
"error": "INVALID_RESOLUTIONS",
"message": "resolutions must map conflict ids to 'ours', 'theirs', or { value }"
}
]
}
{
"data": null,
"errors": [
{
"error": "MERGE_IN_PROGRESS",
"message": "Another merge or rebase is in progress for this agent, please retry"
}
]
}
Docs for agents: llms.txt
Was this page helpful?