Skip to main content
PATCH
Close session
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

Sample response

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>