# Launch a campaign's calls

`POST https://www.getrevox.com/api/campaigns/{id}/launch-calls`

Send the campaign's calls matching a selection. In ai_first mode each call is handed to the admission scheduler at the requested time and follows the retry configuration from there. In speed_dial mode a live operator session dials them, and any call waiting on an AI retry is un-scheduled first so the same contact is never dialed twice. Calls the AI is already dialing are skipped; any other call, finished or cancelled included, is launched again.

## Path parameters

- `id` (string, required)

## Request body (JSON)

- `mode` (enum (string), required): One of: `ai_first`, `speed_dial`.
- `scheduled_at` (string (date-time), optional): When to place the calls (ISO 8601). Omit to launch now. ai_first only — a speed dial session cannot be scheduled.
- `max_attempts` (integer, optional): ai_first only. How many more attempts each launched call gets from now, replacing whatever it had left. Defaults to the campaign's max_retry_attempts. With the campaign's call_twice_in_a_row on, the double call counts as 2 of these attempts when both calls happen: with 1, there is no double call. Constraints: max 9007199254740991, > 0.
- `selection` (object, required)
  - `filters` (object, required)
    - `query` (string, optional)
    - `statuses` (array of enum (string), required): Default: `[]`.
    - `directions` (array of enum (string), required): Default: `[]`.
    - `results` (array of enum (string), required): Default: `[]`.
    - `outcomes` (array of enum (string), required): Default: `[]`.
    - `assignee_ids` (array of one of, required): Default: `[]`.
      - One of, **string** (string)
      - One of, **string** (string (constant))
    - `variables` (array of object, optional)
      - `key` (string, required)
      - `value` (string, required)
  - `rows` (object, required): Default: `{"mode":"all_except","call_ids":[]}`.
    - `mode` (enum (string), required): One of: `all_except`, `only`.
    - `call_ids` (array of string, required)

## Example request

```bash
curl -X POST https://www.getrevox.com/api/campaigns/3c90c3cc-0d44-4b50-8888-8dd25736052a/launch-calls \
  -H "Authorization: Bearer $REVOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "ai_first",
    "selection": {
      "filters": {
        "statuses": [],
        "directions": [],
        "results": [],
        "outcomes": [],
        "assignee_ids": []
      },
      "rows": {
        "mode": "all_except",
        "call_ids": []
      }
    }
  }'
```

## Responses

### 200: Success

- `launched` (number, required)
- `skipped` (object, required)
  - `active` (number, required)
  - `already_reached` (number, required)
  - `attempts_exhausted` (number, required)
  - `cancelled` (number, required)
- `session` (object, optional)
  - `id` (string (uuid), required)
  - `campaign_id` (string (uuid), required)
  - `status` (enum (string), required): One of: `dialing`, `connected`, `completed`, `stopped`, `errored`.
  - `outcome_filter` (array of enum (string), required)
  - `current_call_id` (string (uuid), required, nullable)
  - `total_targets` (number, required)
  - `dialed_count` (number, required)
  - `connected_count` (number, required)
  - `in_flight_calls` (array of [Call](https://www.getrevox.com/docs/api/objects/call.md), required)
  - `created_at` (one of, required)
    - One of, **string** (string (date-time))
    - One of, **Option 2** (any)
  - `ended_at` (one of, required, nullable)
    - One of, **string** (string (date-time))
    - One of, **Option 2** (any)

### 400: Invalid request: the body or a parameter failed validation

- `message` (string, optional)
- `error` (string, optional)
- `bodyErrors` (object, optional): The validation errors returned from the API.
  - `issues` (array of object, required)
    - `path` (array of one of, required)
      - One of, **string** (string)
      - One of, **number** (number)
    - `message` (string, required)
    - `code` (string, optional)

### 402: Not enough credits on the organization

- `error` (string, required)
- `code` (string (constant), required)

### 404: Not found in your organization

- `error` (string, required)

### 409: Conflict with the resource's current state

- `error` (string, required)