mindra

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

ParameterTypeDescription
slugstringThe unique slug of your workflow, as defined in the Mindra Console

Request Body

FieldTypeRequiredDescription
taskstringYesThe task or prompt to send to the workflow
metadataobjectNoAdditional metadata to pass to the workflow

Example Request

Note: Replace your-workflow-slug with 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

FieldTypeDescription
execution_idstringUnique identifier for this execution
statusstringCurrent status (running)
workflow_slugstringThe workflow that was triggered
workflow_namestringDisplay name of the workflow
stream_urlstringRelative URL to connect for SSE streaming
created_atstringISO 8601 timestamp
conversation_idstring or nullConversation 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.