ServicesCatalogHTTP APIMerges

Revert a commit

POST
/api/catalog/projects/{project_id}/reverts

Publish a commit that reverses the changes of a commit, or examine the revert before you do it. To revert a merge commit, you must supply mainlineParent. The value 1 selects the first parent. When dryRun is true, the revert is not published. Conflicts are part of the response. You must have permission to revert in the project and to change each resource that the revert changes.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Path Parameters

project_id*string

Owning project identifier. Nonempty, at most 128 UTF-8 bytes, with no control characters. Project creation belongs to the project service.

Request Body

application/json
  1. body

Apply the inverse delta of commitId to a current target branch. mainlineParent is one-based and required for a merge commit. dryRun defaults to false. The original commit remains immutable; publication creates a successor of the target head. Message and retry bounds match PublishRequest.

commitId*catalog.CommitId

Immutable UUIDv7 project commit identity.

Formatuuid
dryRun?boolean|null
expectedTargetCommitId?|null
idempotencyKey*catalog.IdempotencyKey

Nonempty opaque retry key, at most 128 UTF-8 bytes, scoped to project and authenticated actor. Identical retries return the saved result; reuse for a different operation or request is rejected.

mainlineParent?|null
message?string|null
targetBranchId*catalog.BranchId

Stable UUIDv7 branch identity. Rename preserves identity; deletion tombstones it.

Formatuuid
transactionId*catalog.TransactionId

Caller-allocated UUIDv7 publication identity used to recover an uncertain result within a project and authenticated actor scope.

Formatuuid

Response Body

Success

application/json
  1. response
conflict*
type*unknown
curl -X POST 'https://api.spiraldb.dev/api/catalog/projects/string/reverts' \  -H 'Content-Type: application/json' \  -d '{  "commitId": "a1b223ee-0195-4e35-9b2a-72c93f345117",  "idempotencyKey": "string",  "targetBranchId": "c5fd579d-68b4-4cee-8a65-9894272db901",  "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc"}'
{  "conflict": {    "constraints": [      {        "ambiguousBinding": {          "name": "string",          "parent": {            "prefix": {              "path": [                "string"              ],              "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6"            },            "type": "prefix"          }        },        "type": "ambiguousBinding"      }    ],    "currentCommitId": "d860b6df-6923-4a82-a83e-5fa7b3ce8ada",    "namespace": [      {        "current": "b6f6f63e-cd8b-43b2-a95a-2087cb7f8e11",        "expected": "cc46ff75-488a-4f5d-9162-1798e46c1fcc",        "name": "string",        "parent": {          "prefix": {            "path": [              "string"            ],            "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6"          },          "type": "prefix"        }      }    ],    "resources": [      {        "current": "b6f6f63e-cd8b-43b2-a95a-2087cb7f8e11",        "expected": "cc46ff75-488a-4f5d-9162-1798e46c1fcc",        "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6"      }    ],    "revertedCommitId": "5a192261-efea-4ce8-95cc-1c82948f0fe3"  },  "type": "conflict"}