Run Workflow
Execute a workflow via the API
2 min read
Run Workflow
Trigger a workflow execution. The endpoint returns immediately with an execution ID and a stream URL for receiving real-time events.
Endpoint
POST /v1/workflows/{slug}/run
Path Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | The unique slug of your workflow, as defined in the Mindra Console |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
task | string | Yes | The task or prompt to send to the workflow |
metadata | object | No | Additional metadata to pass to the workflow |
Example Request
Note: Replace
your-workflow-slugwith the actual slug of your workflow from the Mindra Console.
cURL
curl -X POST https://api.mindra.co/v1/workflows/your-workflow-slug/run \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": "Your task description here",
"metadata": {}
}'
Python
import requests
response = requests.post(
"https://api.mindra.co/v1/workflows/your-workflow-slug/run",
headers={
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"task": "Your task description here",
"metadata": {},
},
)
data = response.json()
print(data["execution_id"])
print(data["stream_url"])
TypeScript
const response = await fetch(
"https://api.mindra.co/v1/workflows/your-workflow-slug/run",
{
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
task: "Your task description here",
metadata: {},
}),
}
);
const data = await response.json();
console.log(data.execution_id);
console.log(data.stream_url);
Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"task": "Your task description here",
"metadata": map[string]interface{}{},
})
req, _ := http.NewRequest("POST",
"https://api.mindra.co/v1/workflows/your-workflow-slug/run",
bytes.NewBuffer(payload))
req.Header.Set("x-api-key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["execution_id"])
}
Response
{
"execution_id": "exec_abc123",
"status": "running",
"workflow_slug": "your-workflow-slug",
"workflow_name": "Your Workflow Name",
"stream_url": "/api/v1/workflows/execute/exec_abc123/stream",
"created_at": "2026-01-15T10:30:00Z",
"conversation_id": null
}
Response Fields
| Field | Type | Description |
|---|---|---|
execution_id | string | Unique identifier for this execution |
status | string | Current status (running) |
workflow_slug | string | The workflow that was triggered |
workflow_name | string | Display name of the workflow |
stream_url | string | Relative URL to connect for SSE streaming |
created_at | string | ISO 8601 timestamp |
conversation_id | string or null | Conversation ID if applicable |
What's Next
After receiving the response, connect to the stream_url to receive real-time execution events. See Stream Events for details.