Create a branch

View as Markdown

Fork a new branch from an existing branch. The source branch must have at least one committed revision. Branch names are unique per agent; the name Main is reserved for the default branch. Creating from a branch whose latest draft is still scanning returns 409 source_scanning.

Authentication

AuthorizationBearer

API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

Path parameters

idstringRequiredformat: "^[a-f\d]{24}$"
The agent ID.

Request

This endpoint expects an object.
sourceBranchIdstringRequiredformat: "^[a-f\d]{24}$"
Branch to fork from. Its head revision must exist.
namestringRequired1-100 characters

New branch name. Unique per agent among active branches. main is reserved.

Response

Branch created.
statusboolean
dataobject

An AgentBranch document. An editable copy of an agent with its own draft slot and revision chain.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
423
Locked Error
500
Internal Server Error