v1

latestOpenAPI 3.1.02026-07-2687120159.0 KB

Create a new chat conversation

Creates a new chat conversation and returns the conversation ID along with the agent's initial response.

post/{version}/{account_id}/{project_id}/chat/create

Path parameters

versionstring required

API version

account_idstring required

Account ID

project_idstring required

Project ID

Headers

X-API-KEYstring required

Your PolyAI API key.

X-TOKENstring required

Agent authentication token (connector).

Request body

integration_attributesobject

Custom metadata passed from external integrations. Accessible in functions via conv.integration_attributes.

variant_idstring

Specify which variant to use for this conversation. Useful for multi-site deployments.

channel'webchat' | 'whatsapp' | 'sms' | 'api'

Channel identifier for the conversation.

asr_lang_codestring

Language code for speech recognition (ISO 639-1 with region).

tts_lang_codestring

Language code for text-to-speech (ISO 639-1 with region).

Example request

{
  "integration_attributes": {
    "customer_id": "12345",
    "source": "mobile_app"
  },
  "variant_id": "VARIANT-xxxxxxxx",
  "channel": "webchat",
  "asr_lang_code": "en-US",
  "tts_lang_code": "en-US"
}

Response

OK

conversation_idstring required

Unique ID for the created conversation

responsestring required

Initial response message from the agent

Example response

{
  "conversation_id": "CONV-1234567890",
  "response": "Hi, how can I help?"
}