Skip to content
TriedDocs
Chats and SMS

End chat

End a chat and start its post-chat analysis.

PATCHhttps://api.tried.com.au/end-chat/{chat_id}

Marks a chat as ended. In the background the chat_ended webhook is sent, then post-chat analysis runs and chat_analyzed is sent. Ending a chat that already ended returns it unchanged. POST /end-chat/{chat_id} does the same thing.

Chats also end on their own when idle longer than the chat agent's end_chat_after_silence_ms.

Request#

Path parameters#

Parameter Type Required Description
chat_id string Yes The chat.

Example request#

curl -X PATCH "https://api.tried.com.au/end-chat/chat_0a1b2c3d4e5f6a7b8c9d0e1f" \
  -H "Authorization: Bearer $TRIED_API_KEY"
const res = await fetch("https://api.tried.com.au/end-chat/chat_0a1b2c3d4e5f6a7b8c9d0e1f", {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
});
const data = await res.json();
import os, requests

res = requests.patch(
    "https://api.tried.com.au/end-chat/chat_0a1b2c3d4e5f6a7b8c9d0e1f",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
)
data = res.json()

Response#

200 OK with the chat object, chat_status: "ended". chat_analysis is filled shortly after.

Errors#

Status When
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the calls scope. With a public key: the chat was not started with this key. Public keys can use POST only.
404 No chat with this ID in the workspace.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.