> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bland.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Rebase Agent Branch

> Rebase a branch onto the dev head with resolutions.

### 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](https://docs.bland.ai/api-v2/post/agents-id-branches-branch-id-rebase-preview.md) first to get `dev_head_version_id` and the conflict IDs. Once the rebase succeeds, [Merge Agent Branch](https://docs.bland.ai/api-v2/post/agents-id-branches-branch-id-merge.md) fast-forwards.

Requires an admin, owner, operator, or prompter role.

### Headers

**authorization** `string` *required*

Your API key for authentication.

### Path Parameters

**agent\_id** `string` *required*

The agent's unique identifier.

**branch\_id** `string` *required*

The branch's unique identifier. Must be an open branch on this agent.

### Body Parameters

**dev\_head\_version\_id** `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.

**resolutions** `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.

Any other shape returns `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](https://docs.bland.ai/api-v2/post/agents-id-branches-branch-id-rebase-preview.md), which returns the full conflict set. Omit when the preview reported no conflicts.

```json theme={null}
{
  "setting:systemPrompt": "theirs",
  "node:ae527fa3-25f4-4dbb-ba79-fe7b6aa6b075#data.rule": {
    "value": "Confirm the caller's name, then ask for the account number."
  }
}
```

### Response

**data.version** `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.

**version object**

**id** `string`

Unique identifier for the version.

**org\_id** `string`

The organization that owns the agent.

**agent\_id** `string`

The agent the version belongs to.

**branch\_id** `string`

The branch the version was saved to. Matches `{branch_id}`.

**snapshot** `object`

The merged agent configuration: `behavior` (nodes and edges), `settings`, `contact`, and `knowledge` when present. Same shape as the `snapshot` on any saved version.

**name** `null`

Always `null`; rebase versions are unnamed.

**created\_via** `string`

Always `manual` for a rebase version.

**revision** `integer`

Rewrite counter for the row. `0` on a newly written version.

**created\_by** `string | null`

ID of the user who ran the rebase, or `null` when run with an org-level key.

**created\_at** `string`

ISO 8601 timestamp of creation.

**errors** `null | array`

`null` on success, or a list of error objects if the request failed.

```json Response theme={null}
{
  "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
}
```

```json Unresolved Conflicts theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "UNRESOLVED_CONFLICTS",
      "message": "Every conflict needs a resolution"
    }
  ]
}
```

```json Stale theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "REBASE_STALE",
      "message": "Development changed since the preview — preview again"
    }
  ]
}
```

```json Invalid Resolutions theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "INVALID_RESOLUTIONS",
      "message": "resolutions must map conflict ids to 'ours', 'theirs', or { value }"
    }
  ]
}
```

```json Merge In Progress theme={null}
{
  "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](https://docs.bland.ai/llms.txt)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.