Workflows
Publish a workflow draft
Publish a workflow’s draft as a new active version, through every Console publish gate.
POST
Publish a workflow draft
The reference panel describes the current v3 operation. The notes below describe its v2 compatibility API. Follow the v3 request schema for current calls: v3 can move identifiers from the body or query into the URL. Keep the v2 method, path, and payload together when using the compatibility API.
v2 compatibility notes
POST /api/v2/workflows/publishDraft publishes the workflow’s draft as a new immutable version (version is the last plus one) and makes it active. It returns {workflowId, versionId, version, judgeGate}.
Authentication
External App credential or platform API key, or a Personal key. Requires permissionworkflows:manage (an elevated permission) held at the platform scope, as the Console decides it; a key or app granted only at some org units receives 403, recorded, and nothing is written. Forge agents can never hold workflows:manage. Because the success answers a read, the credential’s scopes must include workflows:read as well (otherwise 403 naming it), and the workflow must be readable at its home (otherwise 404). A Personal key acts as its owner, narrowed by its scopes; an External App or platform key acts as itself. The change is stored and audited with that actor (for an app or platform key, with who granted it), under the Console’s own audit events.
Before you publish
Every Console publish gate runs on the draft as it is now: wiring, output policy, notifications, capability gaps, schema references, the Architect judge gate and the input contract. Validate first with validateDraft; edits made after that call are published.expectedActiveVersionId is required: the version you expect to be active now, or null when none is published yet. A different active version answers 409 conflict naming the current one, so two callers never publish over each other. A retired workflow answers 409 invalid_state.
The version’s agents and bound companies are decided for the caller as at a Console publish: agents:use for the agents it runs and credentials:use at each bound company. A key or app opts into each with its own scope, agents:use (Use agents) and credentials:use (Use credentials), beside workflows:manage; without them a draft that binds agents or companies is refused. A refusal is 422, naming the gate’s code.
overrideCapabilityGaps and overrideJudgeVerdict (each {reason}, 1 to 500 characters) publish past those two gates; each reason is audited. publishNote (1 to 500 characters) is optional. Unknown fields answer 400.
Idempotency
Send anIdempotency-Key to make a retry safe: a same-key retry of a completed call within 24 hours returns the recorded result only while the caller still holds workflows:read and workflows:manage at the platform scope and the workflow still exists; otherwise 409 idempotency_result_unavailable, and the write never runs twice (see Idempotency). If an outcome is unknown, repeat with the same key or read the workflow; never retry under a new key.Authorizations
Headers
Path Parameters
Body
application/json

