Run Workflows
Run any workflow you own as an API: send only its input values to POST /api/v1/workflows/{id}/run, then poll or get a webhook with the result.
To run a saved workflow from code, send its input values to POST /api/v1/workflows/{id}/run. The server loads the saved workflow, injects your inputs and executes the full pipeline, so you never send the node graph. This is how you turn a visual workflow into a programmable API.
The Run endpoint works on any workflow you own. To start runs, your API key needs the workflows:execute scope, or Full access. See Authentication.
Describe Inputs
GET /api/v1/workflows/{id}/run
Returns the input schema for a workflow so you know what to pass.
Request
curl https://www.wireflow.ai/api/v1/workflows/YOUR_WORKFLOW_ID/run \
-H "Authorization: Bearer $WIREFLOW_API_KEY"
Response 200 OK (trimmed)
{
"data": {
"workflowId": "cm1abc123",
"workflowName": "Video Analyzer",
"inputs": [
{
"nodeId": "node-tiktok",
"label": "TikTok Import",
"type": "url",
"required": true,
"description": "TikTok video URL"
},
{
"nodeId": "node-theme",
"label": "Analysis Theme",
"type": "text",
"required": false,
"default": "Break down the visual storytelling techniques"
}
],
"endpoint": "/api/v1/workflows/cm1abc123/run",
"method": "POST"
}
}
The full response also has an example field: a request body built from these inputs that you can copy.
Input Types
type tells you what the input FEEDS, not which node holds it. It comes from the declared type of the port the input is wired into. Wireflow's Image Input node is the universal importer. It carries sound and video just as happily, so the node it lives on is not evidence of what the value is for. When an input is wired to nothing, type falls back to the node's own kind.
| Type | Description | Wired to |
|---|---|---|
text |
Free-form text input | TEXT ports; unwired Text Input / Prompt nodes |
image |
HTTPS image URL | IMAGE ports; unwired Image Input / Media Upload |
audio |
HTTPS audio URL | AUDIO ports, for example a render node's audio_2 |
video |
HTTPS video URL | VIDEO ports |
url |
Any media URL | ports of conflicting media kinds; unwired import nodes |
number |
Numeric value | Number, Seed nodes |
boolean |
True/false toggle | Toggle nodes |
select |
Choice from options | List Selector nodes |
So four sound effects imported through Image Input nodes and wired into a render node's audio_2 / audio_3 / audio_4 ports report audio. When consumers disagree on the media kind, type is url and description names the conflict.
required: false means the input already resolves without you: it holds a value (see default) or every port it feeds declares itself optional. A port that declares no required at all counts as unknown, never optional, so required: true can be conservative.
Back-compat.
audioandvideoare recent additions to this union. If you switch ontype, add cases for them: an input that used to reportimageorurlmay now reportaudioorvideo. This is advertisement only. It does not change how a run injects your value, what it costs, or which values are refused.
To use a file from your computer as an image, audio or video input, upload it first with Media Uploads and pass the returned url.
How Inputs Are Detected
- If the workflow has published input settings (
exposedInputs), only those nodes are exposed - Otherwise, all input-category nodes and utility import nodes without incoming connections are automatically exposed
Run a Workflow
POST /api/v1/workflows/{id}/run
Executes the workflow with your input values. Returns 202 with an execution ID for polling.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
inputs |
object |
No | Map of nodeId to value. Omit to run with saved defaults. |
webhook |
object |
No | { url, secret? }. Wireflow POSTs the result here when the run finishes. See Webhooks. |
metadata |
object |
No | Any JSON object, echoed back in the completion webhook so you can match it to your own job. |
Request
curl -X POST https://www.wireflow.ai/api/v1/workflows/cm1abc123/run \
-H "Authorization: Bearer $WIREFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": {
"node-tiktok": "https://www.tiktok.com/t/ZP8bar3Dk/"
}
}'
Response 202 Accepted
{
"data": {
"executionId": "exec_789",
"status": "running",
"poll": "/api/v1/workflows/executions/exec_789/poll"
}
}
The Location header also points to the poll URL.
Get the result by polling, or skip polling by passing a webhook block and letting Wireflow POST the result to you.
Poll for results using the Poll endpoint:
curl https://www.wireflow.ai/api/v1/workflows/executions/exec_789/poll \
-H "Authorization: Bearer $WIREFLOW_API_KEY"
Get the result by webhook
Add a webhook block, and optionally metadata, to the run body:
curl -X POST https://www.wireflow.ai/api/v1/workflows/cm1abc123/run \
-H "Authorization: Bearer $WIREFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": { "node-prompt": "A cat wearing a top hat" },
"metadata": { "jobId": "job_42" },
"webhook": {
"url": "https://yourapp.com/api/webhooks/wireflow",
"secret": "YOUR_WEBHOOK_SECRET"
}
}'
When the run reaches a terminal state, Wireflow POSTs an execution.completed or execution.failed event to your URL. With a secret, every delivery carries an HMAC-SHA256 signature in X-Wireflow-Signature. Failed deliveries are retried for up to 12 attempts. Details in Webhooks.
Retries and idempotency
If a call to /run times out or returns a 5xx, the run may still have started. Send an Idempotency-Key header with your run request, and send the same key when you retry: /run then replays the original run. A retry without the same key bills a second run. You can also check GET /api/v1/workflows/{id}/executions before you retry.
curl -X POST https://www.wireflow.ai/api/v1/workflows/cm1abc123/run \
-H "Authorization: Bearer $WIREFLOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: YOUR_UNIQUE_KEY" \
-d '{"inputs": {"node-prompt": "A cat wearing a top hat"}}'
Complete Example
Build a workflow in the editor, then call it from code:
const WIREFLOW_HOST = 'https://www.wireflow.ai';
const WIREFLOW_API = `${WIREFLOW_HOST}/api/v1`;
const API_KEY = process.env.WIREFLOW_API_KEY;
const workflowId = 'YOUR_WORKFLOW_ID';
// 1. Discover the inputs
const schema = await fetch(`${WIREFLOW_API}/workflows/${workflowId}/run`, {
headers: { Authorization: `Bearer ${API_KEY}` },
}).then((r) => r.json());
console.log('Available inputs:', schema.data.inputs);
// 2. Run the workflow
const { data } = await fetch(`${WIREFLOW_API}/workflows/${workflowId}/run`, {
method: 'POST',
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
inputs: {
'node-tiktok': 'https://www.tiktok.com/t/ZP8bar3Dk/',
},
}),
}).then((r) => r.json());
// 3. Poll until complete
let result;
while (true) {
const poll = await fetch(`${WIREFLOW_HOST}${data.poll}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
}).then((r) => r.json());
if (poll.status === 'COMPLETED') {
result = poll;
break;
}
if (['FAILED', 'CANCELLED', 'TIMEOUT'].includes(poll.status)) throw new Error(poll.error || poll.status);
await new Promise((r) => setTimeout(r, 2000));
}
console.log('Results:', result.nodeResults);
Credits
The API key owner's credits are charged for each AI model node that runs. Text input and utility nodes are free. API access is on every plan, including Free, but runs still use credits. If the balance is too low, the API returns 402:
{
"error": "Insufficient credits. Required: 10, Available: 3",
"insufficientCredits": true,
"requiredCredits": 10,
"availableCredits": 3,
"breakdown": [
{ "nodeId": "node-1", "nodeLabel": "Text to Image", "credits": 10 }
]
}
See Credits & Billing for plans and model prices.
Comparison with Execute
/run |
/execute |
|
|---|---|---|
| Input | Just the values you want to override | Full nodes + edges arrays |
| Workflow source | Loaded from saved state | Sent in request body |
| Best for | Programmatic use, integrations, automation | Editor (frontend sends live canvas state) |
| Auth | API key or session | API key, session, or internal |
Retry with the same Idempotency-Key |
Replays the original run | Starts and bills a second run |
Related
- Run a workflow from your app
To run an AI workflow from your app, send its inputs to POST /api/v1/workflows/{id}/run with your API key, poll the run, then download each output file.
- Polling or webhooks
Know when an AI image or video job is done: poll the run until a final status, or add a webhook to /run and get a signed POST when it ends.
- Executions
Execute AI workflows, poll for results, and view execution history via the Wireflow API.
- Webhooks
Get a signed POST to your server when a workflow run finishes, instead of polling.
- Media uploads
Get a local file onto the Wireflow CDN so you can wire it into a workflow. Inline for small files, presigned direct-to-R2 for anything up to 25MB, or 100MB for video.