Publish draft

View as Markdown
Publish the open draft on this branch as a new revision. The response is `200` with `state: "committed"` when the security scan finishes synchronously, and `202` with `state: "scanning"` when the scan is deferred. A `scanning` revision is visible in history but cannot be restored or made live until it becomes `committed`. If the scan fails, the revision is left in `scanning` state and this endpoint returns `409` on subsequent publishes until the scan is retried. Publishing on the live branch pushes to production immediately.

Authentication

AuthorizationBearer

API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

Path parameters

idstringRequiredformat: "^[a-f\d]{24}$"
The agent ID.
branchIdstringRequiredformat: "^[a-f\d]{24}$"
The branch ID.

Request

This endpoint expects an object.
labelstring or nullOptional<=200 characters
Optional label saved on the committed revision.

Response

Draft committed synchronously.
statusboolean
dataobject

Result of publish or restore.

  • state: "committed" (HTTP 200) is returned when the commit is synchronous. This happens for restore (the source revision has already been scanned) and for publishes whose content does not need a fresh scan. The response includes the new revision object under revision.
  • state: "scanning" (HTTP 202) is returned when a security scan is deferred. In this case the response body carries only state. revision is absent, and clients must list the branch’s revisions newest-first (GET /agent/{id}/branches/{branchId}/revisions?limit=1) to obtain the new revision ID. Then poll GET /agent/{id}/branches/{branchId}/revisions/{revisionId} until revision.status flips from any transient value to "published". On the revision doc the lifecycle field is status (not state), and the security-scan sub-lifecycle is on the nested securityCheck.status.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
423
Locked Error
500
Internal Server Error