remagicaDocs home
API referenceWorkflows

Cancel a run

POST
/workflow-runs/{runId}/cancel

Needs a key withworkflows:cancel

Stops a run: nothing new starts, and each open result's provider is asked where it is now. Results not yet rendering are cancelled and refunded. Results already rendering where the provider can't stop them are kept (stop: kept): they finish and are charged, and the run reads stopped, its error saying so ("Stopped — 1 result was already rendering and finished."). Otherwise it reads cancelled.

Requires scope workflows:cancel.

Authorization

apiKey
headerx-api-key<token>

An API key of your workspace (rmg_…), created in the web app. It acts for that workspace, not for a person, and keeps working when its creator leaves.

Path Parameters

runId*string
Length1 <= length <= 128

Response Body

The run.

application/json
  1. response

One run of nodes of a workflow.

completedAt*|null
count*integer
createdAt*string
Formatdate-time
creditsEstimated*integer

What the run was estimated to cost when it started: Σ per node of one result's price × count × items.

creditsSpent*integer

What its results have cost so far (refunds taken off).

error*string|null
id*string
nodeIds*array<string>

The nodes it runs, each after the ones of them it reads.

pageId*string
results?array<>

Its results so far (with the run on its own).

runType*string
Value in"node""selection""section"
status*string

running → completed (every result finished), failed (some really failed), cancelled (stopped, nothing kept) or stopped (stopped, or some results cancelled, with what was kept said in error: results already rendering finish and are charged).

Value in"running""completed""failed""cancelled""stopped"
workflowId*string
Example Request
curl -X POST 'https://api.remagica.com/api/v1/workflow-runs/8e41b2d7-0c5f-4a93-b6e2-1f7d9a3c5b08/cancel'
Example Response
{  "completedAt": "2026-10-21T12:00:00.000Z",  "count": 1,  "createdAt": "2026-10-21T12:00:00.000Z",  "creditsEstimated": 12,  "creditsSpent": 12,  "error": null,  "id": "8e41b2d7-0c5f-4a93-b6e2-1f7d9a3c5b08",  "nodeIds": [    "string"  ],  "pageId": "c5dd13a6-5b3d-4f60-8e2a-1d9c6b4f7e05",  "results": [    {      "createdAt": "string",      "credits": 12,      "error": null,      "id": "a5614527-5b3d-4f60-8e2a-1d9c6b4f7e05",      "outputs": {},      "provider": "string",      "runId": "599e5591-5b3d-4f60-8e2a-1d9c6b4f7e05",      "settings": {},      "status": "pending",      "stop": "kept",      "item": 1,      "nodeId": "7b79be4b-5b3d-4f60-8e2a-1d9c6b4f7e05",      "variation": 1    }  ],  "runType": "node",  "status": "running",  "workflowId": "cb35dcdb-5b3d-4f60-8e2a-1d9c6b4f7e05"}