remagicaDocs home
API referenceWorkflows

Create a workflow

POST
/workflows

Needs a key withworkflows:write

Creates a workflow, empty (one page) or from a document.

Requires scope workflows:write.

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.

Request Body

application/json
  1. body
document?

The document (schemaVersion: 2): pages of nodes and edges in React Flow's shape, and the workflow's variables. A node's settings are in data.settings (see GET /node-types); edges join handles by key. Nodes' results and status are the server's: they're filled in when you read the workflow and ignored when you save it. A node shows and sends on the result at data.selectedResultIndex, or its newest when that's left out. One empty page when left out.

name*string
Length1 <= length <= 200

Response Body

The new workflow.

application/json
  1. response
createdAt*string
Formatdate-time
id*string
name*string
nodeCount*integer
updatedAt*string
Formatdate-time
version*integer
activeRuns*array<>

The runs still going.

creditsSpent*integer

The credits all the workflow's runs have spent.

document*

The document (schemaVersion: 2): pages of nodes and edges in React Flow's shape, and the workflow's variables. A node's settings are in data.settings (see GET /node-types); edges join handles by key. Nodes' results and status are the server's: they're filled in when you read the workflow and ignored when you save it. A node shows and sends on the result at data.selectedResultIndex, or its newest when that's left out.

files*

Download URLs of the workspace's files the document points at (Import files, batch uploads, media variables), by storage key, to show them before anything runs.

Example Request
curl -X POST 'https://api.remagica.com/api/v1/workflows' \  -H 'Content-Type: application/json' \  -d '{  "name": "Autumn campaign"}'
Example Response
{  "createdAt": "2026-10-21T12:00:00.000Z",  "id": "a5614527-5b3d-4f60-8e2a-1d9c6b4f7e05",  "name": "Autumn campaign",  "nodeCount": 1,  "updatedAt": "2026-10-21T12:00:00.000Z",  "version": 3,  "activeRuns": [    {      "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"    }  ],  "creditsSpent": 12,  "document": {    "pages": [      {        "id": "page-1",        "name": "Page 1",        "edges": [],        "nodes": []      }    ],    "schemaVersion": 2,    "variables": []  },  "files": {}}