Run a workflow
Run the nodes of a workflow your team built on the canvas, follow the run and collect its results.
A workflow is a canvas: pages of nodes (Prompt, Image, Video, Voice, Music, iterators and more) joined by edges. Your code can run any of its nodes, the same way the canvas's Run button does.
Needs workflows:read to read and follow, workflows:run to run and workflows:cancel to stop. Building or editing workflows needs workflows:write, which the Builder preset includes.
Find the workflow and its nodes
GET /workflows lists your workspace's workflows. GET /workflows/{workflowId} returns one, with its document: every page, node and edge, and each node's results.
The workflow's id is also in its URL when you open it in the app. Node ids are in the document, on each node.
Run nodes
curl https://api.remagica.com/api/v1/workflows/WORKFLOW_ID/runs \
-H "x-api-key: $REMAGICA_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "nodeIds": ["node_video_1"], "count": 2 }'nodeIdsare the nodes to run. Each makescountresults (1–20), orcountper item when an iterator or splitter feeds it.- Nodes upstream aren't run again. Each node reads the result its inputs currently show.
- The run's estimate is set aside from your credits when it starts. Send
priceVersionfromGET /pricingto be refused with409 PRICE_CHANGED, not charged more, if prices rose. - A run that can't start is refused with
409 RUN_REFUSED. Itsdata.codesays why (missing_input,already_running,out_of_credits, ...) anddata.nodeIdssays which nodes.
Follow it
- Stream:
GET /workflows/{workflowId}/eventssends server-sent events: aresultevent each time a node's result changes, and arunevent when a run ends. Nothing is replayed, so read the workflow when you connect. The stream ends after 15 minutes; reconnect to keep following. - Poll:
GET /workflow-runs/{runId}returns the run'sstatus(running, thencompleted,failed,cancelledorstopped), itsresults,creditsEstimatedandcreditsSpent. - Webhooks:
workflow_run.succeededandworkflow_run.failed. See Webhooks.
Each result's outputs hold its files, with download URLs.
Stop it
POST /workflow-runs/{runId}/cancel stops a run, and POST /workflows/{workflowId}/results/{resultId}/cancel stops one result. Results that already finished are kept.
Download its files
A Section (group) of the canvas downloads as one zip, and so does everything one node has made. See Downloads and exports.