## Start an auto-call with audio file playback

`POST /v1/calls/auto-call-audio`

Dials `toNumber` and, after the call is answered, plays back an MP3 file from the `url` link. Bitrix24 downloads the file at the moment of the call. No operator is involved. Used for call campaigns with a pre-recorded voice message.

## Request fields (body)

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `fromLine` | string | yes | — | Outbound call line ID. List of lines — [`GET /v1/voximplant-lines`](../lines/voximplant.md) |
| `toNumber` | string | yes | — | Phone number in international format |
| `url` | string | yes | — | Direct HTTPS link to an MP3 file |

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/calls/auto-call-audio \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fromLine": "YOUR_LINE_ID",
    "toNumber": "+12025550123",
    "url": "https://example.com/audio/greeting.mp3"
  }'
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/calls/auto-call-audio \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fromLine": "YOUR_LINE_ID",
    "toNumber": "+12025550124",
    "url": "https://example.com/audio/greeting.mp3"
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/calls/auto-call-audio', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fromLine: 'YOUR_LINE_ID',
    toNumber: '+12025550125',
    url: 'https://example.com/audio/greeting.mp3',
  }),
})

const { success, data } = await res.json()
const callId = data.callId
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/calls/auto-call-audio', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fromLine: 'YOUR_LINE_ID',
    toNumber: '+12025550126',
    url: 'https://example.com/audio/greeting.mp3',
  }),
})

const { success, data } = await res.json()
const callId = data.callId
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `result` | boolean | `true` when the call is initiated successfully |
| `callId` | string | Identifier of the initiated call with the `infocall.` prefix |

## Response example

HTTP 200 — call initiated:

```json
{
  "success": true,
  "data": {
    "result": true,
    "callId": "infocall.b7e1d4c2a9f03e8b6d5c2a1f4e9b7d03.1777975100"
  }
}
```

## Error response example

400 — required parameters not provided:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_PARAMS",
    "message": "Required: fromLine (string — ID from GET /v1/voximplant-lines), toNumber (string), url (string — URL to audio file)"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_PARAMS` | `fromLine`, `toNumber`, or `url` not provided |
| 401 | `MISSING_API_KEY` | `X-Api-Key` header not provided |
| 401 | `INVALID_API_KEY` | Invalid API key |
| 401 | `TOKEN_MISSING` | The key has no configured Bitrix24 tokens |
| 401 | `KEY_INACTIVE` | API key is inactive or revoked |
| 403 | `SCOPE_DENIED` | The key lacks the `telephony` scope |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error (message in `error.message`) |
| 429 | `RATE_LIMITED` | Request limit exceeded |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**File format and availability.** The file must be in MP3 format and accessible via a direct HTTPS link without authorization. Bitrix24 downloads the file at the moment the call is made — if the link is unavailable, `BITRIX_ERROR` is returned.

**Record in statistics.** After the call ends, it appears in the [statistics](../analytics/statistics.md) with `CALL_TYPE: "5"`.

**Limit and line restrictions** — the same as for the [auto-call with speech synthesis](./auto-call.md#known-specifics): monthly quota and the base line restriction.

## See also

- [Callback](./callback.md)
- [Auto-call with speech synthesis](./auto-call.md)
- [Call statistics](../analytics/statistics.md)
- [Voximplant line list](../lines/voximplant.md)
