---
title: "Save the queue AI worker and optional Voice AI agent"
description: "Agent must be a set-up, enabled voice profile in this workspace. Null uses the default. Turning on the worker clears its pause reason."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Call Queues

`PUT /api/call-queues/{queueId}/ai-worker`

Agent must be a set-up, enabled voice profile in this workspace. Null uses the default. Turning on the worker clears its pause reason.

## Authentication

- `BearerAuth`, http, header `Authorization`, format `JWT`

## Path parameters

- `queueId` (`put/api/call-queues/queueId/ai-worker.path.queueId`; string, required)
  - format `uuid`

## Request body

- `voice_agent_id` (`put/api/call-queues/queueId/ai-worker.voice_agent_id`; string, optional, nullable)
  - format `uuid`
- `enabled` (`put/api/call-queues/queueId/ai-worker.enabled`; boolean, optional)
- `max_concurrent` (`put/api/call-queues/queueId/ai-worker.max_concurrent`; integer, optional)
  - min 1; max 5
- `first_message` (`put/api/call-queues/queueId/ai-worker.first_message`; string, optional, nullable)
  - maxLength 220
- `context_template` (`put/api/call-queues/queueId/ai-worker.context_template`; string, optional, nullable)
  - maxLength 4000

## Example request

```json
{
  "voice_agent_id": "2fc8d568-5ce2-4e51-baa8-38c877b5dd08",
  "enabled": true,
  "max_concurrent": 1,
  "first_message": "string",
  "context_template": "string"
}
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url 'https://api.channelautomation.com/api/call-queues/<queueId>/ai-worker' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "voice_agent_id": "2fc8d568-5ce2-4e51-baa8-38c877b5dd08",
  "enabled": true,
  "max_concurrent": 1,
  "first_message": "string",
  "context_template": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/call-queues/<queueId>/ai-worker';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    voice_agent_id: '2fc8d568-5ce2-4e51-baa8-38c877b5dd08',
    enabled: true,
    max_concurrent: 1,
    first_message: 'string',
    context_template: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/call-queues/<queueId>/ai-worker"

payload = {
    "voice_agent_id": "2fc8d568-5ce2-4e51-baa8-38c877b5dd08",
    "enabled": True,
    "max_concurrent": 1,
    "first_message": "string",
    "context_template": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Saved worker settings

### 400

Invalid settings

### 403

Workspace owner or admin required

### 404

Queue not in this workspace

### 409

voice_agent_unavailable

### 503

Settings unavailable


Source: https://developer.channelautomations.com/api/put-api-call-queues-queue-id-ai-worker/index.md
