Merge a branch (merge-by-replay)
const url = 'https://api.aerandil.com/v1/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.aerandil.com/v1/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge \ --header 'Authorization: Bearer <token>'Merge an open branch into main by replaying its action journal through the engine against the current main state — validators and all — in one atomic transaction. A fast-fail staleness check runs first: any copy-on-first-write row whose base has moved (or been deleted) since the fork aborts the merge with a structured conflict (409), never a row-level three-way merge. On success the branch is marked merged (recording the umbrella merge_correlation_id), its delta rows are deleted, and a branch.merged event lands on the main log. Accepts Idempotency-Key. Because the replay may fire any journaled action, this requires the actions:apply catch-all scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Opaque idempotency token (Stripe-shape). Repeated POSTs with the same key replay the original response within the cache TTL rather than creating a duplicate object.
Responses
Section titled “Responses”Merged. replayed lists each journal entry’s fresh main-log correlation id.
object
object
object
Examplegenerated
{ "branch_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "merge_correlation_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "replayed": [ { "action": "example", "correlation_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "ordinal": 1 } ], "warnings": [ {} ]}No such branch under this tenant.
Branch is not open, or the staleness check found conflicts against main.