Skip to main content
POST
Test-run 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/testRunDraft starts a test run of the workflow’s draft (kind: "test", no version), as the Console’s Test button does, and returns {runId, workflowId, kind}.

Authentication

External App credential or platform API key, or a Personal key. Requires permission workflows: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, and because a test run is a launch, workflows:use must be granted and reached by the credential’s scopes, as for a dispatch; a missing one answers 403 naming it. 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.

The run

A test run is a run: read it and cancel it with the runs routes. Its inputs (runtimeArgs) are validated against the draft’s input contract as on dispatch, and a file input needs files:read. runtimeContract (outcomesV1) asserts the draft’s run contract; a mismatch is refused. The run is still decided at the workflow’s home, as a dispatch is. A retired or paused workflow answers 409 invalid_state. Test runs are excluded from production analytics.

Idempotency

With an Idempotency-Key, a same-key retry returns the original run’s identity only while the caller may read that run (runs:read, the workflow dispatch rule); otherwise 409 idempotency_result_unavailable, and no second run starts.

Authorizations

Authorization
string
header
required

An External App: the JWT it obtains from POST /oauth/token with OAuth2 client_credentials. Pass as Authorization: Bearer <jwt>. An app's static companion key also authenticates as the app, but is deprecated and is not protected by Idempotency-Key.

Headers

Idempotency-Key
string

Optional logical intent key. A same-key retry within 24 hours returns the recorded result without writing again.

Required string length: 1 - 255

Path Parameters

workflowId
string
required

The workflow whose draft is run.

Minimum string length: 1

Body

application/json
runtimeArgs
object

The run's inputs, validated against the draft's input contract as on dispatch.

runtimeContract
string

Assert the draft's run contract; a mismatch is refused.

Allowed value: "outcomesV1"

Response

Success

data
object
required
meta
object
required