Executing Workflows¶
Learn how to run workflows and manage executions.
Execution Methods¶
| Method | Description |
|---|---|
| CLI | Run from command line |
| API | Execute via REST API |
| Webhook | Trigger via HTTP request |
| Schedule | Automatic cron-based |
CLI Execution¶
Run from File¶
Run by ID¶
Run by Name¶
With Input Data¶
# Inline JSON
m9m run workflow.json --input '{"name": "John"}'
# From file
m9m run workflow.json --input @input.json
Raw Output¶
API Execution¶
Synchronous¶
Wait for completion:
curl -X POST http://localhost:8080/api/v1/workflows/{id}/execute \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"inputData": [{"json": {"key": "value"}}]}'
Response:
Asynchronous¶
Return immediately:
curl -X POST http://localhost:8080/api/v1/workflows/{id}/execute-async \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"inputData": [{"json": {"key": "value"}}]}'
Response:
Then check status:
Webhook Execution¶
Configure a webhook node and call it:
curl -X POST http://localhost:8080/webhook/my-endpoint \
-H "Content-Type: application/json" \
-d '{"event": "user_signup", "data": {...}}'
Scheduled Execution¶
Workflows with Cron nodes run automatically:
Manage via API:
# Create schedule
curl -X POST http://localhost:8080/api/v1/schedules \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"workflowId": "wf-123",
"cronExpression": "0 9 * * *"
}'
Execution Status¶
| Status | Description |
|---|---|
pending |
Queued, waiting |
running |
Currently executing |
success |
Completed successfully |
failed |
Completed with error |
cancelled |
Manually stopped |
Monitoring Executions¶
List Executions¶
Or via API:
Get Execution Details¶
Watch in Real-Time¶
Handling Failures¶
View Error Details¶
Shows:
Retry Failed Execution¶
Or via API:
Cancel Running Execution¶
Or via API:
Input Data¶
Structure¶
Multiple Items¶
Access in Workflow¶
First node receives input data:
Execution Output¶
Success Output¶
{
"id": "exec-123",
"status": "success",
"data": [
{
"json": {
"result": "processed",
"count": 5
}
}
],
"duration": 1234
}
Failed Output¶
{
"id": "exec-124",
"status": "failed",
"error": {
"message": "HTTP request failed",
"node": "Fetch Data"
}
}
Best Practices¶
- Test with sample data before production
- Use async for long-running workflows
- Monitor failures and set up alerts
- Add timeouts for external calls
- Log important data for debugging