Coelevate Documentation
API ReferenceContext Repository

Merge the change request

Publishes the approved ops: writes their bodies and makes the next release, which is what agents are served from then on.

POST /context/v1/changeset/merge

Publishes the approved ops: writes their bodies and makes the next release, which is what agents are served from then on. A merge touches assets only; a kit is written separately and directly, with the kits scope, and a merge never changes one. Ops nobody decided are not published; they carry over to a new changeset opened on the release this merge makes, and the response names it. Rejected ops stay on the merged changeset as the record. Nothing approved is a 422. The merge is a 409 when the changeset moved since you reviewed it (send expected_revision), or when another release was published after the changeset opened, in which case the changeset is settled invalidated and nothing is published. Needs the review scope.

Requires the context:review scope.

Request body

FieldTypeRequiredDescription
changeset_idstring or nullnoThe changeset you mean to merge. Omit for the open one.
expected_revisioninteger or nullnoThe changeset revision you reviewed. When it has moved the merge is a 409.
provenanceobject or nullnoWho merged and why, for the revision journal. Omit to have it filled in from the key.
tagsarray of string or nullnoRelease tags to put on the release this merge makes.

Responses

StatusMeaning
200The request succeeded.
401The token is missing, expired or invalid.
403The token does not carry the scope this operation requires.
404No such project, or the token belongs to a different project.

The 200 response body:

FieldTypeRequiredDescription
carried_op_idsarray of stringyesThe undecided ops that moved to that changeset.
carried_to_changeset_idstring or nullnoThe changeset that took over the ops nobody had decided, or null when there were none.
changed_asset_idsarray of stringyesThe assets the merge wrote or changed.
changeset_idstringyesThe changeset that was merged.
conflicted_op_idsarray of stringyesCarried ops that no longer apply cleanly and need review again.
deleted_asset_idsarray of stringyesThe assets the merge retired.
object_versionsmap of integeryesThe version of every object as the new release publishes it.
ops_publishedintegeryesHow many approved ops were published.
releaseintegeryesThe release the merge made.

Example

A request body (ids and values are placeholders), saved as body.json:

{
  "expected_revision": 3,
  "tags": [
    "production"
  ]
}
curl -sS -X POST "$API_URL/context/v1/changeset/merge" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d @body.json