POST
/
api
/
v2
/
contacts
Create or update a contact
curl --request POST \
  --url https://app.livechatai.com/api/v2/contacts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "agentId": "clx1234567890abcdef",
  "distinctId": "user_12345",
  "contactId": "contact_1234567890",
  "userHash": "abc123hash",
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "+1234567890",
  "attributes": {
    "planType": "premium",
    "userLevel": "advanced",
    "signupDate": "2024-01-15"
  }
}'
{
  "status": "success",
  "contactId": "contact_1234567890"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Contact creation or identification details.

agentId
string
required

Unique identifier of the agent

Example:

"clx1234567890abcdef"

distinctId
string
required

Unique identifier for the user/contact

Example:

"user_12345"

contactId
string

Optional: Existing contact ID to update

Example:

"contact_1234567890"

userHash
string

Required if secure identification is enabled for the agent.

Example:

"abc123hash"

name
string

Full name of the contact

Example:

"John Doe"

email
string

Email address of the contact

Example:

"john@example.com"

phone
string

Phone number of the contact

Example:

"+1234567890"

attributes
object

Custom attributes to associate with the contact. Only allowed attributes configured for the agent will be saved.

Example:
{
"planType": "premium",
"userLevel": "advanced",
"signupDate": "2024-01-15"
}

Response

Contact created or updated successfully.

status
string
Example:

"success"

contactId
string

ID of the created or updated contact

Example:

"contact_1234567890"