Merge branch

http
POST /projects/{project_reference}/branches/{branch_id}/merge

Merge a branch into main or another branch, applying its file changes, deletions and the merge message to the target. Requires project.files.write.

Parameters

NameInRequiredDescription
project_referencepathYesProject slug, UUID, or domain that identifies the project.
branch_idpathYes

Request body

FieldTypeRequiredDescription
expected_versioninteger,nullOptional optimistic-concurrency precondition against the persisted source branch version. A stale value returns 412 before merge writes.
target_branch_idstring,nullTarget branch ID; omit for main. An unknown target returns not found. Merge eligibility and conflicts are checked again when the merge commits.
merge_messagestringMessage stored on the merge audit record.

Responses

StatusDescription
200Branch merged successfully.
400Bad request
401Unauthorized
403Forbidden
404Not found
409Conflict
412Precondition failed
413Payload too large
500Server error
503internal: authentication state is temporarily unavailable and the request was not processed; retry shortly.