> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ada.cx/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ada.cx/_mcp/server.

# Update the handoff queue

PATCH https://example.ada.support/api/v2/conversations/{conversation_id}/handoff-queue/
Content-Type: application/json

Updates the end user's place in the agent queue for the conversation specified by the `conversation_id`. The chat widget shows a waiting banner with the position or the estimated wait, keeps it across a page reload, and clears it when a human agent joins or the handoff ends. Send an update whenever the position or the wait changes. Each request replaces the previous queue state, so include `unit`, and `amount` for the `position` and `time` units, every time. The conversation must be on the chat channel (the web widget and mobile SDKs), in an active Handoffs API handoff, and still waiting for an agent: voice, email and custom channels have no surface for the queue, and an update sent while a human agent is already on the conversation is rejected.

Reference: https://docs.ada.cx/reference/conversations/update-handoff-queue

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `conversation_id` (string, required) — The ID of the chat conversation in an active handoff

### Body (application/json)

This endpoint expects a HandoffQueueRequest.

- `unit` (enum, required) — What `amount` measures. Use `position` to show the end user how many people are ahead of them. Use `time` to show the estimated wait. Use `unknown` when a queue exists but its depth is not disclosed; the end user then sees a generic waiting message instead of a number.
  - Allowed values: `position`, `time`, `unknown`
- `amount` (integer, optional) — Must be a whole number. Required when `unit` is `position` or `time`, and ignored when `unit` is `unknown`. For `position`, the number of people ahead of the end user, from 0 to 9999; `0` shows the generic waiting message. For `time`, the estimated wait in seconds, from -1 to 86400. The end user sees the wait rounded up to whole minutes, and `-1` or `0` shows the generic waiting message.

## Response

### 200

Handoff queue updated

- `message` (string, optional)

## Errors

### 400 Bad Request Error

Invalid handoff queue update

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 401 Unauthorized Error

Unauthorized

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 404 Not Found Error

Conversation not found

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 422 Unprocessable Entity Error

Conversation is not on the chat channel, is not in an active Handoffs API handoff, or already has an active human agent

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 429 Too Many Requests Error

Too Many Requests

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 500 Internal Server Error

Internal server error

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

## Types

### ErrorsErrorsItems

- `type` (string, required) — The error type
- `message` (string, required) — The error message
- `details` (string, optional, nullable) — Extra information about the error

## Examples

**Request**

```json
{
  "unit": "position",
  "amount": 3
}
```

**Response**

```json
{
  "message": "Handoff queue updated"
}
```

**SDK Code**

```python
import requests

url = "https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/"

payload = {
    "unit": "position",
    "amount": 3
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"unit":"position","amount":3}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/"

	payload := strings.NewReader("{\n  \"unit\": \"position\",\n  \"amount\": 3\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"unit\": \"position\",\n  \"amount\": 3\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"unit\": \"position\",\n  \"amount\": 3\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/', [
  'body' => '{
  "unit": "position",
  "amount": 3
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"unit\": \"position\",\n  \"amount\": 3\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "unit": "position",
  "amount": 3
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://example.ada.support/api/v2/conversations/conversation_id/handoff-queue/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```