Close a chat
Closes an active chat conversation and marks it as complete.
PUT
/
{version}
/
{account_id}
/
{project_id}
/
chat
/
close
Close an existing chat conversation
curl --request PUT \
--url https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-TOKEN: <x-token>' \
--data '
{
"conversation_id": "CONV-1234567890"
}
'import requests
url = "https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close"
payload = { "conversation_id": "CONV-1234567890" }
headers = {
"X-API-KEY": "<api-key>",
"X-TOKEN": "<x-token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-API-KEY': '<api-key>',
'X-TOKEN': '<x-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({conversation_id: 'CONV-1234567890'})
};
fetch('https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close', 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://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'conversation_id' => 'CONV-1234567890'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>",
"X-TOKEN: <x-token>"
],
]);
$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://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close"
payload := strings.NewReader("{\n \"conversation_id\": \"CONV-1234567890\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("X-TOKEN", "<x-token>")
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.put("https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close")
.header("X-API-KEY", "<api-key>")
.header("X-TOKEN", "<x-token>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"CONV-1234567890\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<api-key>'
request["X-TOKEN"] = '<x-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversation_id\": \"CONV-1234567890\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}Authorizations
ApiKeyAuthTokenAuth
You must request an API Key to use PolyAI APIs.
Headers
Your PolyAI API key.
Agent authentication token (connector).
Path Parameters
API version
Account ID
Project ID
Body
application/json
ID of the conversation to close
Example:
"CONV-1234567890"
Response
OK
Whether the conversation was successfully closed
Example:
true
Last modified on September 23, 2025
Was this page helpful?
⌘I
Close an existing chat conversation
curl --request PUT \
--url https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-TOKEN: <x-token>' \
--data '
{
"conversation_id": "CONV-1234567890"
}
'import requests
url = "https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close"
payload = { "conversation_id": "CONV-1234567890" }
headers = {
"X-API-KEY": "<api-key>",
"X-TOKEN": "<x-token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-API-KEY': '<api-key>',
'X-TOKEN': '<x-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({conversation_id: 'CONV-1234567890'})
};
fetch('https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close', 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://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'conversation_id' => 'CONV-1234567890'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>",
"X-TOKEN: <x-token>"
],
]);
$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://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close"
payload := strings.NewReader("{\n \"conversation_id\": \"CONV-1234567890\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("X-TOKEN", "<x-token>")
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.put("https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close")
.header("X-API-KEY", "<api-key>")
.header("X-TOKEN", "<x-token>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"CONV-1234567890\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us-1.platform.polyai.app/{version}/{account_id}/{project_id}/chat/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<api-key>'
request["X-TOKEN"] = '<x-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversation_id\": \"CONV-1234567890\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}
