---
title: "Rebase A Branch Onto Main"
method: POST
path: "/v1/convai/agents/{agent_id}/branches/{branch_id}/rebase"
tags: ["Agents Platform"]
---

# Rebase A Branch Onto Main

`POST /v1/convai/agents/{agent_id}/branches/{branch_id}/rebase`

## Request

- Base URL: `https://api.elevenlabs.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.elevenlabs.io/v1/convai/agents/{agent_id}/branches/{branch_id}/rebase`
- Auth: none declared

Pull changes from a source branch (defaults to main) into this branch as a new version, preserving this branch's own changes on conflicts.

## Path parameters

- `agent_id` string, required: The id of an agent. This is returned on agent creation.
- `branch_id` string, required: Unique identifier for the source branch to merge from.

## Query parameters

- `source_branch_id` string, nullable: The ID of the branch to pull changes from. Defaults to the agent's main branch.

## Headers

- `xi-api-key` string, nullable: Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.

## Request body

- BodyRebaseABranchOntoMainV1ConvaiAgentsAgentIdBranchesBranchIdRebasePost

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-21** `f687767c026b`: 1 info
  - added optional request body
- **2026-10-19** `4bbdfda3e711`: 1 info
  - added the new optional `query` request parameter `source_branch_id`
- **2026-07-13** `009bd651509a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/elevenlabs/apis/elevenlabs-api-documentation/changes/v1/convai/agents/:agent_id/branches/:branch_id/rebase/post.md)

---

[API](https://skmtc.dev/elevenlabs/apis/elevenlabs-api-documentation.md) - [All operations](https://skmtc.dev/elevenlabs/apis/elevenlabs-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/elevenlabs/apis/elevenlabs-api-documentation/revisions/0e2bfc751634?raw)
