Flow Endpoints
Complete API reference for flow operations
This page documents all available operations for creating, managing, and monitoring flows on the Mirra platform.
Create a new flow with a cron schedule trigger.
POST /api/sdk/v1/flows/createTimeFlow
{
"title": "Daily Report Generator",
"description": "Generates daily analytics report and sends via email",
"schedule": "0 9 * * *",
"scriptId": "script_abc123",
"scope": "user"
}
title *Flow name for identification and organization.
description *Detailed description of what the flow does and when it runs.
schedule *Cron expression defining when the flow executes. Must be a valid cron pattern.
scriptId *The ID of the script to execute. All flows are script-based.
scopeExecution scope. One of: "user" (default), "team", "global".
{
"success": true,
"data": {
"id": "693439915ceadf632e2cfc9a",
"userId": "507f1f77bcf86cd799439011",
"title": "Daily Report Generator",
"description": "Generates daily analytics report and sends via email",
"status": "active",
"scope": "user",
"trigger": {
"type": "time",
"config": {
"cronExpression": "0 9 * * *"
}
},
"scriptId": "script_abc123",
"executionCount": 0,
"executionResults": [],
"createdAt": "2025-12-06T14:11:29.385Z",
"updatedAt": "2025-12-06T14:11:29.385Z"
}
}
Create a new flow that executes when matching events occur.
POST /api/sdk/v1/flows/createEventFlow
{
"title": "Urgent Message Handler",
"description": "Auto-respond to urgent messages in Telegram",
"eventType": "telegram.message",
"conditions": {
"operator": "AND",
"conditions": [
{
"field": "text",
"operator": "contains",
"value": "urgent"
},
{
"field": "isGroupChat",
"operator": "equals",
"value": false
}
]
},
"prompt": "Acknowledge the urgent message and create a high-priority reminder",
"recommendedTools": ["telegram", "memory"],
"scope": "user",
"executionType": "llm"
}
title *Flow name for identification and organization.
description *Detailed description of what the flow does and which events trigger it.
eventType *Type of event to subscribe to (e.g., "telegram.message", "gmail.email_received", "calendar.event_created").
conditions *Condition tree defining when the flow executes. Supports nested AND/OR logic with field comparisons.
prompt *Natural language instructions for the AI agent (when using LLM execution mode).
recommendedToolsArray of tool names the flow should prioritize.
scopeExecution scope. One of: "user" (default), "team", "global".
executionTypeHow the flow executes. One of: "llm" (default), "direct".
{
"success": true,
"data": {
"id": "693439aa5ceadf632e2cfcb2",
"userId": "507f1f77bcf86cd799439011",
"title": "Urgent Message Handler",
"description": "Auto-respond to urgent messages in Telegram",
"status": "active",
"scope": "user",
"trigger": {
"type": "event",
"config": {
"eventType": "telegram.message",
"rootCondition": {
"operator": "AND",
"conditions": [
{
"field": "text",
"operator": "contains",
"value": "urgent"
},
{
"field": "isGroupChat",
"operator": "equals",
"value": false
}
]
}
}
},
"executionType": "llm",
"prompt": "Acknowledge the urgent message and create a high-priority reminder",
"recommendedTools": ["telegram", "memory"],
"executionCount": 0,
"executionResults": [],
"createdAt": "2025-12-06T14:15:42.100Z",
"updatedAt": "2025-12-06T14:15:42.100Z"
}
}
Retrieve all flows for the authenticated user.
POST /api/sdk/v1/flows/listFlows
{
"status": "active",
"limit": 20,
"offset": 0
}
statusFilter by flow status. One of: "active", "paused", "completed". Omit to include all statuses.
limitMaximum number of flows to return. Default: 50. Max: 100.
offsetNumber of flows to skip for pagination. Default: 0.
{
"success": true,
"data": [
{
"id": "693439915ceadf632e2cfc9a",
"title": "Daily Report Generator",
"description": "Generates daily analytics report",
"status": "active",
"trigger": {
"type": "time",
"config": {
"cronExpression": "0 9 * * *"
}
},
"executionCount": 45,
"lastExecutedAt": "2025-12-06T09:00:00Z",
"createdAt": "2025-11-01T10:00:00Z"
}
],
"meta": {
"total": 12,
"limit": 20,
"offset": 0
}
}
Retrieve detailed information about a specific flow.
POST /api/sdk/v1/flows/getFlow
{
"assignmentId": "693439915ceadf632e2cfc9a"
}
{
"success": true,
"data": {
"id": "693439915ceadf632e2cfc9a",
"userId": "507f1f77bcf86cd799439011",
"title": "Daily Report Generator",
"description": "Generates daily analytics report and sends via email",
"status": "active",
"scope": "user",
"trigger": {
"type": "time",
"config": {
"cronExpression": "0 9 * * *"
}
},
"executionType": "llm",
"prompt": "Generate yesterday's analytics report and send it via Gmail",
"recommendedTools": ["memory", "gmail"],
"executionCount": 45,
"executionResults": [
{
"timestamp": "2025-12-06T09:00:00Z",
"status": "success",
"duration": 3421,
"cost": 0.042
}
],
"lastExecutedAt": "2025-12-06T09:00:00Z",
"createdAt": "2025-11-01T10:00:00Z",
"updatedAt": "2025-12-06T09:00:05Z"
}
}
Update a flow's configuration, schedule, or execution parameters.
POST /api/sdk/v1/flows/updateFlow
{
"assignmentId": "693439915ceadf632e2cfc9a",
"title": "Updated Daily Report",
"description": "Updated description",
"schedule": "0 10 * * *",
"prompt": "Updated execution prompt",
"recommendedTools": ["memory", "gmail", "telegram"]
}
assignmentId *ID of the flow to update.
titleUpdated flow name.
descriptionUpdated description.
scheduleUpdated cron expression (for time-based flows).
promptUpdated execution prompt.
recommendedToolsUpdated tool recommendations.
conditionsUpdated event conditions (for event-based flows).
{
"success": true,
"data": {
"id": "693439915ceadf632e2cfc9a",
"title": "Updated Daily Report",
"description": "Updated description",
"trigger": {
"type": "time",
"config": {
"cronExpression": "0 10 * * *"
}
},
"updatedAt": "2025-12-06T14:20:00Z"
}
}
Temporarily disable a flow without deleting it.
POST /api/sdk/v1/flows/pauseFlow
{
"assignmentId": "693439915ceadf632e2cfc9a"
}
{
"success": true,
"data": {
"id": "693439915ceadf632e2cfc9a",
"status": "paused",
"pausedAt": "2025-12-06T14:25:00Z"
}
}
Re-enable a paused flow.
POST /api/sdk/v1/flows/resumeFlow
{
"assignmentId": "693439915ceadf632e2cfc9a"
}
{
"success": true,
"data": {
"id": "693439915ceadf632e2cfc9a",
"status": "active",
"resumedAt": "2025-12-06T14:30:00Z"
}
}
Permanently delete a flow and all associated execution history.
POST /api/sdk/v1/flows/deleteFlow
{
"assignmentId": "693439915ceadf632e2cfc9a"
}
{
"success": true,
"data": {
"id": "693439915ceadf632e2cfc9a",
"deleted": true,
"deletedAt": "2025-12-06T14:35:00Z"
}
}
This action cannot be undone! Deleting a flow removes all execution history and cannot be recovered.
Search and filter flows by status, trigger type, execution results, and metadata.
POST /api/sdk/v1/flows/searchFlows
{
"query": "daily report",
"status": "active",
"trigger": {
"type": "time"
},
"scope": "user",
"limit": 20,
"offset": 0
}
querySearch term to match against flow titles and descriptions.
statusFilter by flow status.
triggerFilter by trigger configuration (type, eventType, etc.).
scopeFilter by execution scope.
limitMaximum results to return. Default: 50. Max: 100.
offsetNumber of results to skip for pagination.
{
"success": true,
"data": [
{
"id": "693439915ceadf632e2cfc9a",
"title": "Daily Report Generator",
"description": "Generates daily analytics report",
"status": "active",
"trigger": {
"type": "time",
"config": {
"cronExpression": "0 9 * * *"
}
},
"executionCount": 45,
"lastExecutedAt": "2025-12-06T09:00:00Z"
}
],
"meta": {
"total": 3,
"limit": 20,
"offset": 0
}
}
All endpoints return consistent error responses:
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid cron expression: Expected 5 or 6 fields, got 4",
"details": {
"field": "schedule",
"value": "0 9 * *"
}
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Flow not found",
"details": {
"assignmentId": "693439915ceadf632e2cfc9a"
}
}
}
{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred"
}
}
API requests are subject to rate limiting:
- Authenticated requests: 1000 requests per minute
- Flow creation: 100 flows per day
- Flow execution: 10,000 executions per day per flow
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 987
X-RateLimit-Reset: 1638360000