ServicesCatalogHTTP APIBranches

Create a branch

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

Create a branch at the commit that the target selector identifies. The selector is resolved one time. To retry, send the same request with the same idempotency key. You must have permission to create branches.

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
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.

name*catalog.BranchName

Slash-separated branch name, at most 255 UTF-8 bytes. Empty, dot, trailing-dot, .lock, and control segments are rejected by the service.

target*||

A commit identity or a movable branch/immutable tag resolved exactly once per request. Relative expressions such as main~3 are not supported.

Response Body

Success

application/json
  1. response
branchId*catalog.BranchId

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

Formatuuid
createdAtMicros*|
deletedAtMicros?||null
headCommitId*catalog.CommitId

Immutable UUIDv7 project commit identity.

Formatuuid
lastBranchEventId*catalog.BranchEventId

Immutable UUIDv7 branch event identity.

Formatuuid
name*catalog.BranchName

Slash-separated branch name, at most 255 UTF-8 bytes. Empty, dot, trailing-dot, .lock, and control segments are rejected by the service.

curl -X POST 'https://api.spiraldb.dev/api/catalog/projects/string/branches' \  -H 'Content-Type: application/json' \  -d '{  "idempotencyKey": "string",  "name": "string",  "target": {    "branch": {      "branch": "string"    },    "type": "branch"  }}'
{  "branchId": "712f308d-801e-48bc-b072-9c404734ceb7",  "createdAtMicros": "string",  "deletedAtMicros": "string",  "headCommitId": "ccbbf3ab-15f4-491f-bfd0-0193cd890679",  "lastBranchEventId": "26c3ae27-e158-44c2-95aa-45b0c7e8349c",  "name": "string"}