Skip to main content
PATCH
/
v1
/
chat
/
chat
/
sessions
/
{sessionId}
/
close
Close session
curl --request PATCH \
  --url https://api.agntix.ai/v1/chat/chat/sessions/{sessionId}/close \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "reason": "RESOLVED"
}
'
{
  "id": "ses_01j3m8xkqp8v2nw4f7g9hk0r",
  "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "platform": "SDK",
  "state": "OPEN",
  "metadata": {},
  "orgId": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}
Every endpoint on this page requires either a Clerk-issued JWT (Authorization: Bearer <token>) or an organization API key (x-api-key: pk_…). Anonymous calls return 401 Unauthorized. See Authentication for the full setup.
Closing a session triggers session.closed webhooks if you have them configured. Closed sessions remain readable — you can still fetch messages and session details.

Code examples

curl -X PATCH https://api.agntix.ai/v1/chat/chat/sessions/ses_01j3m8xkqp8v2nw4f7g9hk0r/close \
  -H "x-api-key: pk_live_••••" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "RESOLVED" }'

Sample response

{
  "id": "ses_01j3m8xkqp8v2nw4f7g9hk0r",
  "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "platform": "SDK",
  "state": "CLOSED",
  "metadata": { "userId": "usr_123" },
  "createdAt": "2026-04-29T09:00:00Z",
  "updatedAt": "2026-04-29T09:45:00Z"
}

Authorizations

x-api-key
string
header
required

Organization API key. Obtain from the dashboard. Format: pk_live_…

Path Parameters

sessionId
string
required

Body

application/json
reason
string

Optional reason for closing the session.

Example:

"RESOLVED"

Response

Session closed.

id
string
Example:

"ses_01j3m8xkqp8v2nw4f7g9hk0r"

agentId
string<uuid>
platform
string
Example:

"SDK"

state
enum<string>
Available options:
OPEN,
CLOSED
Example:

"OPEN"

metadata
object
orgId
string
createdAt
string<date-time>
updatedAt
string<date-time>