Skip to main content
POST
/
v1
/
chat
/
chat
/
sessions
Create session
curl --request POST \
  --url https://api.agntix.ai/v1/chat/chat/sessions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "platform": "SDK",
  "metadata": {
    "userId": "usr_123",
    "locale": "en-US"
  }
}
'
{
  "id": "ses_01j3m8xkqp8v2nw4f7g9hk0r",
  "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "platform": "SDK",
  "state": "OPEN",
  "metadata": {
    "userId": "usr_123",
    "locale": "en-US"
  },
  "createdAt": "2026-04-29T09:00:00Z",
  "updatedAt": "2026-04-29T09:00:00Z"
}
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.

Code examples

curl -X POST https://api.agntix.ai/v1/chat/chat/sessions \
  -H "x-api-key: pk_live_••••" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "platform": "SDK",
    "metadata": {
      "userId": "usr_123",
      "locale": "en-US"
    }
  }'

Sample response

{
  "id": "ses_01j3m8xkqp8v2nw4f7g9hk0r",
  "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "platform": "SDK",
  "state": "OPEN",
  "metadata": {
    "userId": "usr_123",
    "locale": "en-US"
  },
  "orgId": "org_2abc123",
  "createdAt": "2026-04-29T09:00:00Z",
  "updatedAt": "2026-04-29T09:00:00Z"
}
Store the session id — you’ll pass it as {sessionId} in every subsequent message call.

Authorizations

x-api-key
string
header
required

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

Body

application/json
agentId
string<uuid>
required

The agent to chat with.

Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

platform
enum<string>
default:SDK
required

Originating platform. Affects session tagging and analytics.

Available options:
SDK,
WEB,
WHATSAPP,
VOICE
metadata
object

Arbitrary key-value pairs attached to the session (max 4096 characters total). Useful for storing user IDs, locale, etc.

contact
object

Contact information to associate with this session.

Response

Session created.

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>