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

# Bulk Trigger

> Start multiple workflow executions in parallel with different inputs.

## Endpoint

```
POST https://workflows.eachlabs.run/api/v1/{workflowID}/bulk-trigger
```

<Warning>
  This public URL uses a deprecated compatibility host outside the api-service host. It remains supported for now, but will soon move under `https://api.eachlabs.ai`. Keep integrations configurable and switch to the api-service URL once it is published.
</Warning>

Run the same workflow with up to **10 different inputs** in parallel. All executions share a `bulk_id` so you can track them together.

## Path Parameters

| Parameter    | Type   | Required | Description   |
| ------------ | ------ | -------- | ------------- |
| `workflowID` | string | Yes      | Workflow UUID |

## Request Body

| Field         | Type   | Required | Description                                      |
| ------------- | ------ | -------- | ------------------------------------------------ |
| `version_id`  | string | No       | Specific version to trigger (defaults to latest) |
| `inputs`      | array  | Yes      | Array of input objects (1–10 items)              |
| `webhook_url` | string | No       | URL to receive completion notifications          |

## Code Examples

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -X POST https://workflows.eachlabs.run/api/v1/WF_ID/bulk-trigger \
    -H "Content-Type: application/json" \
    -H "X-API-Key: YOUR_API_KEY" \
    -d '{
      "inputs": [
        {"prompt": "A sunset over the ocean", "style": "photorealistic"},
        {"prompt": "Mountains at dawn", "style": "artistic"},
        {"prompt": "City skyline at night", "style": "minimalist"}
      ],
      "webhook_url": "https://your-app.com/webhooks/workflow"
    }'
  ```

  ```python Python theme={"dark"}
  import requests

  response = requests.post(
      "https://workflows.eachlabs.run/api/v1/WF_ID/bulk-trigger",
      headers={
          "Content-Type": "application/json",
          "X-API-Key": "YOUR_API_KEY"
      },
      json={
          "inputs": [
              {"prompt": "A sunset over the ocean"},
              {"prompt": "Mountains at dawn"},
              {"prompt": "City skyline at night"}
          ]
      }
  )

  data = response.json()
  print(f"Bulk ID: {data['bulk_id']}")
  for exec in data["executions"]:
      print(f"  {exec.get('execution_id', 'N/A')} | {exec['status']}")
  ```

  ```javascript JavaScript theme={"dark"}
  const response = await fetch(
    "https://workflows.eachlabs.run/api/v1/WF_ID/bulk-trigger",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-API-Key": "YOUR_API_KEY",
      },
      body: JSON.stringify({
        inputs: [
          { prompt: "A sunset over the ocean" },
          { prompt: "Mountains at dawn" },
          { prompt: "City skyline at night" },
        ],
      }),
    }
  );
  const data = await response.json();
  console.log(`Bulk ID: ${data.bulk_id}`);
  ```
</CodeGroup>

## Response

**Status: `202 Accepted`**

```json theme={"dark"}
{
  "bulk_id": "550e8400-e29b-41d4-a716-446655440000",
  "executions": [
    {
      "execution_id": "exec-1",
      "status": "queued",
      "started_at": "2025-12-20T10:00:00Z"
    },
    {
      "execution_id": "exec-2",
      "status": "queued",
      "started_at": "2025-12-20T10:00:01Z"
    },
    {
      "status": "failed",
      "message": "invalid input: missing required field 'prompt'"
    }
  ]
}
```

### Partial Failures

Some executions may succeed while others fail. That's totally fine! Failed entries will have `status: "failed"` with an error `message` and no `execution_id`.

## Tracking Bulk Executions

Use the `bulk_id` to list all executions from a bulk operation:

```bash theme={"dark"}
curl "https://workflows.eachlabs.run/api/v1/workflows/WF_ID/executions?bulk_id=550e8400-e29b-41d4-a716-446655440000" \
  -H "X-API-Key: YOUR_API_KEY"
```

## Error Responses

| Status | Body                                          | Description            |
| ------ | --------------------------------------------- | ---------------------- |
| `400`  | `{"error": "inputs must contain 1–10 items"}` | Invalid inputs count   |
| `401`  | `{"error": "Invalid or missing API key"}`     | Authentication failure |
| `404`  | `{"error": "workflow not found"}`             | Invalid workflow ID    |
