curl --request POST \
--url https://{host}/channel-api/chats/{id}/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"userId": "66f1f0c2e4b0a1b2c3d4e200"
}
'import requests
url = "https://{host}/channel-api/chats/{id}/capture"
payload = { "userId": "66f1f0c2e4b0a1b2c3d4e200" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: '66f1f0c2e4b0a1b2c3d4e200'})
};
fetch('https://{host}/channel-api/chats/{id}/capture', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/channel-api/chats/{id}/capture",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'userId' => '66f1f0c2e4b0a1b2c3d4e200'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/channel-api/chats/{id}/capture"
payload := strings.NewReader("{\n \"userId\": \"66f1f0c2e4b0a1b2c3d4e200\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/channel-api/chats/{id}/capture")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"66f1f0c2e4b0a1b2c3d4e200\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/channel-api/chats/{id}/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"66f1f0c2e4b0a1b2c3d4e200\"\n}"
response = http.request(request)
puts response.read_body{
"id": "66f2a1c9e4b0a1b2c3d4e5f6",
"status": "open",
"queue": "Espera",
"channelId": "66f1f0c2e4b0a1b2c3d4e001",
"teamId": "66f1f0c2e4b0a1b2c3d4e100",
"userId": null,
"contact": {
"id": "<string>",
"name": "Cliente",
"value": "554396647639"
},
"unreadMessages": 2,
"lastMessage": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"statusCode": 400,
"message": "Chat ja esta em atendimento e nao pode ser capturado novamente",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Credencial ausente ou inválida",
"error": "Unauthorized"
}{
"statusCode": 404,
"message": "Not Found",
"error": "Not Found"
}{
"statusCode": 409,
"message": "O chat ja foi capturado por outro usuario.",
"error": "Conflict"
}{
"statusCode": 429,
"message": "Rate limit exceeded. Maximum 120 requests per 60s per API key."
}Capturar atendimento
Um usuário assume a conversa que está na fila. Recusada se a conversa já está Em Atendimento — para tirar de um atendente e passar a outro, use Transferir para usuário. Scope: chats:capture.
curl --request POST \
--url https://{host}/channel-api/chats/{id}/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"userId": "66f1f0c2e4b0a1b2c3d4e200"
}
'import requests
url = "https://{host}/channel-api/chats/{id}/capture"
payload = { "userId": "66f1f0c2e4b0a1b2c3d4e200" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: '66f1f0c2e4b0a1b2c3d4e200'})
};
fetch('https://{host}/channel-api/chats/{id}/capture', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/channel-api/chats/{id}/capture",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'userId' => '66f1f0c2e4b0a1b2c3d4e200'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/channel-api/chats/{id}/capture"
payload := strings.NewReader("{\n \"userId\": \"66f1f0c2e4b0a1b2c3d4e200\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/channel-api/chats/{id}/capture")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"66f1f0c2e4b0a1b2c3d4e200\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/channel-api/chats/{id}/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"66f1f0c2e4b0a1b2c3d4e200\"\n}"
response = http.request(request)
puts response.read_body{
"id": "66f2a1c9e4b0a1b2c3d4e5f6",
"status": "open",
"queue": "Espera",
"channelId": "66f1f0c2e4b0a1b2c3d4e001",
"teamId": "66f1f0c2e4b0a1b2c3d4e100",
"userId": null,
"contact": {
"id": "<string>",
"name": "Cliente",
"value": "554396647639"
},
"unreadMessages": 2,
"lastMessage": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"statusCode": 400,
"message": "Chat ja esta em atendimento e nao pode ser capturado novamente",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Credencial ausente ou inválida",
"error": "Unauthorized"
}{
"statusCode": 404,
"message": "Not Found",
"error": "Not Found"
}{
"statusCode": 409,
"message": "O chat ja foi capturado por outro usuario.",
"error": "Conflict"
}{
"statusCode": 429,
"message": "Rate limit exceeded. Maximum 120 requests per 60s per API key."
}400 se a conversa já está Em Atendimento. Para reatribuir, use Transferir para usuário.Authorizations
API key de conta, no formato ApiKey <token> (ex.: ApiKey zk_live_...). Criada em Configurações → API Keys por um usuário com a permissão api_keys:manage. O token é exibido uma única vez. Cada rota exige um scope; key sem o scope, ou recurso fora dos canais permitidos da key, responde 404.
Path Parameters
ID do chat (ObjectId).
"66f2a1c9e4b0a1b2c3d4e5f6"
Body
Usuário que assume o atendimento.
Response
Conversa após a captura.
"66f2a1c9e4b0a1b2c3d4e5f6"
"open"
Fila atual: Espera (aguardando atendente da equipe), Em Atendimento, Automação, API ou a fila configurada no canal.
"Espera"
"66f1f0c2e4b0a1b2c3d4e001"
"66f1f0c2e4b0a1b2c3d4e100"
Atendente atual; null quando ninguém está atendendo.
null
Show child attributes
Show child attributes
2
Resumo da última mensagem (origin, content).