> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/workflows/{id}/run

Run a workflow with optional payload. Works for draft, active, and paused workflows. Does not count against maxRuns or enforce cooldown.

` POST /v1/workflows/{id}/run `

Run a workflow with optional payload. Works for draft, active, and paused workflows. Does not count against maxRuns or enforce cooldown.

## Parameters

### ` id ` (path, required)

Workflow ID

- ` value `: type ` string `

## Request body (optional)

Content type: ` application/json `

Optional payload

- ` value `: type ` unknown `

  - ` oneOf alternative 1 `: type ` object `

  - ` oneOf alternative 2 `: type ` object `

    - ` chatMessageId `: type ` string ` — Optional assistant chat message that launched this run.

    - ` dustTest `: type ` boolean ` — When true, run with auto-calculated dust amounts (~$0.01 USD). Mutually exclusive with Simulate.

    - ` payload `: type ` object ` — Optional payload

    - ` runId `: type ` string ` — Optional run ID. If provided, must start with "run_" prefix. Use this to subscribe to SSE stream before triggering the run.

    - ` simulate `: type ` boolean ` — When true, run the workflow in simulation mode (dry-run).

    - ` triggerNodeId `: type ` string ` — For multi-trigger ("forest") workflows: which trigger node should be recorded as the firing trigger for this run. Optional — when omitted the workflow's manual trigger is resolved by type, matching the historical single-trigger behavior. The trigger picker in the editor sends this so the resulting run is attributed to the trigger the user actually clicked.

    - ` version `: type ` integer ` — Optional version number. When set, run this specific version instead of the default (which prioritizes draft). Useful for testing the live version while a draft exists.

## Responses

### ` 200 ` — OK

Content type: ` application/json `

- ` value `: type ` object `

  - ` code `: type ` integer `

    - example: ` 200 `

  - ` data `: type ` object `

    - ` runId `: type ` string `

      - example: ` "run_c9i6j8k2l0m3" `

  - ` message `: type ` string `

    - example: ` "success" `

  - ` requestId `: type ` string `

    - example: ` "abc-123" `

### ` 400 ` — Bad request or workflow is archived

Content type: ` application/json `

- ` value `: type ` object `

  - ` code `: type ` integer `

  - ` details `: type ` array `

    - ` array item `: type ` unknown `

  - ` message `: type ` string `

  - ` requestId `: type ` string `

### ` 404 ` — Workflow not found

Content type: ` application/json `

- ` value `: type ` object `

  - ` code `: type ` integer `

  - ` details `: type ` array `

    - ` array item `: type ` unknown `

  - ` message `: type ` string `

  - ` requestId `: type ` string `

## Request examples

### cURL

```curl
curl -X POST 'https://api.example.com/v1/workflows/string/run' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

### JavaScript

```javascript
const response = await fetch('https://api.example.com/v1/workflows/string/run', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({})
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post('https://api.example.com/v1/workflows/string/run', headers=headers, json={})
print(response.json())
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{}`)
	req, _ := http.NewRequest("POST", "https://api.example.com/v1/workflows/string/run", body)
	req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	result, _ := io.ReadAll(resp.Body)
	fmt.Println(string(result))
}
```