# flows.run

`POST /api/public/v1/flows/{id}/runs`

Run a published revision (default: the latest) on up to 1,000 profiles; typed input is validated against the revision and sensitive values are masked.

- Capability: `workflow.run`
- Command: yes — send a `command_id`; resending the same id and body returns the stored receipt
- MCP tool: `flows_run`

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes | Flow id |
| `command_id` | body | string (uuid) | yes | Client-generated UUID for this command. Send the same id (and body) again to get the stored receipt instead of a second change; a different body under the same id is CONFLICT. |
| `revision_id` | body | string (uuid) | no | Published revision to run (flows.get revisions); default: the latest |
| `input` | body | object | no | Values for the revision's declared inputs Default: `{}`. |
| `profile_ids` | body | array<string (uuid)> | yes | Profiles to run on (min 1 items, max 1000 items) |
| `device_ids` | body | array<string (uuid)> | no | Machines allowed to run it (default: any eligible paired machine) (max 100 items) Default: `[]`. |
| `max_parallel` | body | integer | no | Profiles running at the same time (min 1, max 50) Default: `5`. |
| `max_minutes` | body | integer | no | Time limit per profile (min 1, max 1440) Default: `30`. |

## Response

`201` with `{ data, replayed: false, correlation_id }` the first time; `200` with `replayed: true` for a repeated `command_id`.

The field list of this reply is not published yet; read `data` as JSON.

## Errors

| Code | HTTP | Retryable |
|---|---|---|
| `UNAUTHENTICATED` | 401 | no |
| `FORBIDDEN` | 403 | no |
| `RATE_LIMITED` | 429 | yes |
| `VALIDATION_FAILED` | 422 | no |
| `NOT_FOUND` | 404 | no |
| `CONFLICT` | 409 | no |
| `OUTCOME_UNKNOWN` | 202 | yes |
| `DEPENDENCY_UNAVAILABLE` | 503 | yes |
| `UNKNOWN` | 500 | no |

## Example (curl)

```bash
curl -X POST "https://browlix.com/api/public/v1/flows/<id>/runs" \
  -H "Authorization: Bearer $BROWLIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command_id":"<uuid>","profile_ids":["<profile_id>"]}'
```

## Example (TypeScript SDK)

```ts
import { Browlix } from "@browlix/sdk";

const bx = new Browlix({ apiKey: process.env.BROWLIX_API_KEY! });
const reply = await bx.call("flows.run", { path: { id: "<id>" }, body: {"profile_ids":["<profile_id>"]} });
console.log(reply.data);
```

## Example (Python)

```python
import os, uuid
import requests

r = requests.post(
    "https://browlix.com/api/public/v1/flows/<id>/runs",
    headers={"Authorization": f"Bearer {os.environ['BROWLIX_API_KEY']}"},
    json={"command_id":str(uuid.uuid4()),"profile_ids":["<profile_id>"]},
    timeout=60,
)
print(r.status_code, r.json())
```

## Example (MCP)

```json
{
  "method": "tools/call",
  "params": {
    "name": "flows_run",
    "arguments": {
      "id": "<id>",
      "profile_ids": [
        "<profile_id>"
      ]
    }
  }
}
```
