Web API Reference
Versioning
This document describes the Customer Chat Web API v3.6. This is the latest stable version recommended for the production use. Read more about versioning...
What is Web API
Web API is similar to REST API. Client can send a request message that results in getting a response message. It's also possible to get webhooks.
When to use Web API
If you're wondering which API to use - Customer Chat RTM API or Web API, keep on reading.
Web API allows for building stateless integrations. The communication is done via XHR requests. The implementation is easier than with RTM API, but you need to take possible time delays into consideration.
Not what you're looking for? Perhaps, you need to use Customer Chat RTM API instead.
Access
Customer authentication is handled with access tokens. Find out how to get an access token from Customer authorization flow. Take note that it's not the same token you would use for the Agent Chat or Configuration API.
Pagination
Pagination is a mechanism that allows splitting the database output into more manageable chunks of data.
Based on the limit and sort order parameters, pagination is able to decide how many records will be returned at once and whether it should fetch the oldest or the latest data first.
Any filters that could be applied should be provided in first pagination request. In the response, you'll get the next_page_id and previous_page_id parameters.
You should make the subsequent request using one of these parameters as page_id, depending on the direction of iteration: forward or backward.
The filters, limit, and sort_order parameters can't be provided along with page_id.
💡 The maximum duration of the page_id parameter before it expires is one month.
Data structures
To find sample payloads of events, users, and other common structures such as chats or threads visit the Data structures document.
Methods
| Header | Value | Notes |
|---|
X-API-Version | 3.6 | Not needed if you specify the API version in the URL. |
Content-Type | multipart/form-data; boundary=<boundary> | Valid for the Upload File method |
Content-Type | application/json | Valid for every method except for Upload File |
Authorization | Bearer <token> | Customer access token. It's not the same token you would use for the Agent Chat or Configuration API. Not needed for Get License Properties and Get Group Properties. Read more... |
Every request to Customer Chat API needs to have the following query string parameters:
| Query string parameter | Data type | Methods |
|---|
organization_id | string | All |
Available methods
Chats
List Chats
It returns summaries of the chats a customer participated in.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/list_chats |
| RTM API equivalent | list_chats |
| Webhook | - |
Request
| Parameter | Required | Type | Notes |
|---|
limit | No | number | The maximum number of records returned on each page. Default: 10, maximum: 25. |
sort_order | No | string | Possible values: asc, desc (default). Chat summaries are sorted by the creation date of its last thread. |
page_id | No | string | |
Response
| Field | Data type | Notes |
|---|
total_chats | number | An estimated number. The real number of found chats can slightly differ. |
next_page_id | string | In relation to page_id specified in the request. Appears in the response only when there's the next page. |
previous_page_id | string | In relation to page_id specified in the request. Appears in the response only when there's the previous page. |
chats_summary | array | Array of Chat summary data structures. |
List Threads
It returns threads that the current customer has access to in a given chat.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/list_threads |
| RTM API equivalent | list_threads |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | |
sort_order | No | string | Possible values: asc – oldest threads first and desc – newest threads first (default). |
limit | No | number | The maximum number of records returned on each page. Default: 3, maximum: 100. |
page_id | No | string | |
min_events_count | No | number | Range: 1-100. Specifies the minimum number of events to be returned in the response. It's the total number of events, so they can come from more than one thread. You'll get as many latest threads as needed to meet the min_events_count condition. |
You cannot use both limit and min_events_count at the same time.
Get Chat
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_chat |
| RTM API equivalent | get_chat |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | |
thread_id | No | string | Default: the latest thread (if exists) |
Start Chat
Starts a chat.
The method updates the requester's events_seen_up_to as if they've seen all chat events.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/start_chat |
| RTM API equivalent | start_chat |
| Webhook | incoming_chat |
Request
| Parameter | Required | Data type | Notes |
|---|
chat | No | object | |
chat.properties | No | object | The initial chat properties. |
chat.access | No | object | The chat access to set. Default: all agents. |
chat.thread | No | object | |
chat.thread.events | No | array | The initial chat events array. Does not support the form type event in the LiveChat app. |
chat.thread.properties | No | object | The initial thread properties. |
active | No | bool | When set to false, creates an inactive thread. When set to true, creates an active thread. Default: true. |
continuous | No | bool | When set to true, starts the chat as continuous (online group is not required). When set to false, starts the chat as non-continuous. Default: false. |
Response
| Field | Data type | Notes |
|---|
chat_id | string | |
thread_id | string | |
event_ids | []string | Returned only when the chat was started with initial events. Returns only the IDs of user-generated events; server-side generated events are not included in the array. |
Resume Chat
Restarts an archived chat.
The method updates the requester's events_seen_up_to as if they've seen all chat events.
Specifics
Request
| Parameter | Required | Data type | Notes |
|---|
chat | Yes | object | |
chat.id | Yes | string | The ID of the chat that will be resumed. |
chat.access | No | object | The chat access to set. Default: all agents. |
chat.properties | No | object | The initial chat properties. |
chat.thread | No | object | |
chat.thread.events | No | array | The initial chat events array. |
chat.thread.properties | No | object | The initial thread properties. |
active | No | bool | When set to false, creates an inactive thread. When set to true, creates an active thread. Default: true. |
continuous | No | bool | When set to true, sets a chat to the continuous mode. When set to false, sets a chat to non-continuous mode. When unset, leaves the mode unchanged. |
Response
| Field | Data type | Notes |
|---|
thread_id | string | |
event_ids | []string | Returned only when the chat was resumed with initial events. Returns only the IDs of user-generated events; server-side generated events are not included in the array. |
Deactivate Chat
Deactivates a chat by closing the currently open thread. Sending messages to this thread will no longer be possible.
Specifics
Request
| Parameter | Required | Data type | |
|---|
id | Yes | string | |
Response
No response payload (200 OK).
Configuration
Get Dynamic Configuration
Returns the dynamic configuration of a given group. It provides data to call Get Configuration and Get Localization.
Specifics
| |
|---|
| HTTP Method | GET |
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_dynamic_configuration |
| RTM API equivalent | - |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
group_id | No | number | The ID of the group that you want to get a dynamic configuration for. The ID of the default group is used if not provided. |
url | No | string | The URL that you want to get a dynamic configuration for. |
channel_type | No | string | The channel type that you want to get a dynamic configuration for. |
test | No | bool | When set to true, treats a dynamic configuration request as a test. |
Response
| Field | Data type | Notes |
|---|
organization_id | string | The ID of the organization for which the dynamic configuration is returned. |
default_widget | string | The default widget to be used; possible values: livechat, openwidget, chatbot. |
livechat_active | bool | Specifies if the LiveChat product license is active. |
livechat | object | Contains the configuration specific to the LiveChat product. It's present only when livechat_active is set to true. |
livechat.group_id | number | The ID of the group for which the dynamic configuration is returned. |
livechat.client_limit_exceeded | bool | Specifies if the limit of customers having a chat was exceeded. |
livechat.domain_allowed | bool | Specifies if url is configured as a trusted domain (configurable in the Agent Application). |
livechat.online_group_ids | array | It is returned in response with all the group IDs where agents accept chats. It is not visible when there is no such group. |
livechat.config_version | string | The version for which you want to get a configuration. Use it as version when calling Get Configuration. |
livechat.localization_version | string | The version for which you want to get a localization. Use it as version when calling Get Localization. |
livechat.language | string | The language of the group for which the dynamic configuration is returned. |
Get Configuration
Returns the configuration of a given group in a given version. Contains data based on which the Chat Widget can be built.
Specifics
| |
|---|
| HTTP Method | GET |
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_configuration |
| RTM API equivalent | - |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
group_id | Yes | number | The ID of the group that you want to get a configuration for. |
version | Yes | string | The version that you want to get a configuration for. Returned from Get Dynamic Configuration as the config_version parameter. |
Events
Send Event
Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
The method updates the requester's events_seen_up_to as if they've seen all chat events.
Specifics
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | The ID of the chat that you want to send a message to. |
event | Yes | object | The Event object. Does not support the form type event in the LiveChat app. |
attach_to_last_thread | No | bool | When set to true, the event will be added to the last thread for inactive chats. When set to false, the request will fail for inactive chats. The flag is ignored for active chats. Default: false. |
Delete Event
Deletes an Event object. Deleted events are hidden from all Customer Chat API responses but remain visible via the Agent Chat API.
In the Agent Chat API, the Delete Event method replaces the original event with a Deleted Event for agents with the normal role. Agents with higher roles (administrator, viceowner, and owner) see the original event with a deleted flag.
Specifics
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | The ID of the chat that you want to delete an event from. |
thread_id | Yes | string | The ID of the thread that you want to delete an event from. |
event_id | Yes | string | The ID of the event that you want to delete. |
Response
No response payload (200 OK).
Upload File
Uploads a file to the server as a temporary file. It returns a URL that expires after 24 hours unless the URL is used in send_event.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/upload_file |
| RTM API equivalent | - |
| Webhook | incoming_event * |
*)
incoming_event returns a URL that never expires.
Request
| Parameter | Required | Data type | Notes |
|---|
file | Yes | binary | The maximum size: 10MB. |
Send Rich Message Postback
Specifics
*) incoming_rich_message_postback will be sent only for active threads.
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | |
event_id | Yes | string | |
postback | Yes | object | |
postback.id | Yes | string | The postback name of the button. |
postback.toggled | Yes | bool | The toggle state of the button. |
thread_id | Yes | string | |
Response
No response payload (200 OK).
Send Sneak Peek
Sends a sneak peek to a chat.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/send_sneak_peek |
| RTM API equivalent | send_sneak_peek |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | The ID of the chat to send a sneak peek to. |
sneak_peek_text | Yes | string | The sneak peek text. |
Response
No response payload (200 OK).
Localization
Get Localization
Returns the localization of a given language and group in a given version. Contains translated phrases for the Chat Widget.
Specifics
| |
|---|
| HTTP Method | GET |
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_localization |
| RTM API equivalent | - |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
group_id | Yes | number | The ID of the group that you want to get a localization for. |
language | Yes | string | The language that you want to get a localization for. |
version | Yes | string | The version that you want to get a localization for. Returned from Get Dynamic Configuration as the localization_version parameter. |
Properties
Update Chat Properties
Specifics
Request
| Parameter | Required | Type | Notes |
|---|
id | Yes | string | The ID of the chat you want to set a property for. |
properties | Yes | object | The chat properties to set. You should stick to the general properties format and include namespace, property name and value. |
Response
No response payload (200 OK).
Delete Chat Properties
Specifics
Request
| Parameter | Required | Type | Notes |
|---|
id | Yes | string | The ID of the chat you want to delete properties of. |
properties | Yes | object | The chat properties to delete. |
Response
No response payload (200 OK).
Update Thread Properties
Specifics
Request
| Parameter | Required | Type | Notes |
|---|
chat_id | Yes | string | The ID of the chat you want to set properties for. |
thread_id | Yes | string | The ID of the thread you want to set properties for. |
properties | Yes | object | The chat properties to set. |
Response
No response payload (200 OK).
Delete Thread Properties
Specifics
Request
| Parameter | Required | Type | Notes |
|---|
chat_id | Yes | string | The ID of the chat you want to delete the properties of. |
thread_id | Yes | string | The ID of the thread you want to delete the properties of. |
properties | Yes | object | The thread properties to delete. |
Response
No response payload (200 OK).
Update Event Properties
Specifics
Request
| Parameter | Required | Type | Notes |
|---|
chat_id | Yes | string | The ID of the chat you want to set properties for. |
thread_id | Yes | string | The ID of the thread you want to set properties for. |
event_id | Yes | string | The ID of the event you want to set properties for. |
properties | Yes | object | The chat properties to set. You should stick to the general properties format and include namespace, property name and value. |
Response
No response payload (200 OK).
Delete Event Properties
Specifics
Request
| Parameter | Required | Type | Notes |
|---|
chat_id | Yes | string | The ID of the chat you want to delete the properties of. |
thread_id | Yes | string | The ID of the thread you want to delete the properties of. |
event_id | Yes | string | The ID of the event you want to delete the properties of. |
properties | Yes | object | The event properties to delete. You should stick to the general properties format and include namespace, property name and value. |
Response
No response payload (200 OK).
List License Properties
Returns the properties of a given license. It only returns the properties a customer has access to.
Specifics
| |
|---|
| HTTP Method | GET |
| Method URL | https://api.livechatinc.com/v3.6/customer/action/list_license_properties |
| RTM API equivalent | - |
| Webhook | - |
Request
| Query string parameter | Required | Data type | Notes |
|---|
namespace | No | string | The property namespace to retrieve. |
name | No | string | The property name. |
List Group Properties
Returns the properties of a given group. It only returns the properties a customer has access to.
Specifics
| |
|---|
| HTTP Method | GET |
| Method URL | https://api.livechatinc.com/v3.6/customer/action/list_group_properties |
| RTM API equivalent | - |
| Webhook | - |
Request
| Query string parameter | Required | Data type | Notes |
|---|
id | Yes | number | The ID of the group you want to return the properties of. |
namespace | No | string | The property namespace to retrieve |
name | No | string | The property name |
Customers
Update Customer
Specifics
*
The webhook will be sent only if the customer has active chats.
Request
| Parameter | Required | Data type | Notes |
|---|
name | No | string | |
email | No | string | |
avatar | No | string | The URL of the customer's avatar |
session_fields | No | []object | An array of custom object-enclosed key-value pairs. Respects the order of items. |
omnichannel | No | object | |
omnichannel.fbmessenger | No | object | |
omnichannel.fbmessenger.id | Yes | string | Required only when omnichannel.fbmessenger is included. |
omnichannel.fbmessenger.name | No | string | |
omnichannel.fbmessenger.first_name | No | string | |
omnichannel.fbmessenger.last_name | No | string | |
omnichannel.fbmessenger.profile_pic | No | string | |
omnichannel.fbmessenger.gender | No | string | |
omnichannel.fbmessenger.locale | No | string | |
omnichannel.fbmessenger.is_verified_user | No | bool | |
omnichannel.twilio | No | object | |
omnichannel.twilio.phone_number | Yes | string | Required only when omnichannel.twilio is included. |
At least one optional parameter needs to be included in the request.
Response
No response payload (200 OK).
Set Customer Session Fields
Specifics
*
The webhook will be sent only if the customer has active chats.
Request
| Parameter | Required | Data type | Notes |
|---|
session_fields | Yes | []object | An array of custom object-enclosed key-value pairs. Respects the order of items. The maximum number of keys: 100. |
Users agent and referrer are updated by default using the browser’s headers.
Response
No response payload (200 OK).
Get Customer
Returns the info about the customer requesting it.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_customer |
| RTM API equivalent | get_customer |
| Webhook | - |
Response
| |
|---|
name | The customer's name. Returned only if set. |
email | The customer's email. Returned only if set. |
avatar | The customer's avatar. Returned only if set. |
phone_number | The customer's phone number. Returned only if set. |
session_fields | An array of custom object-enclosed key:value pairs. Returned only if set. Available for the session duration. |
omnichannel | An object of the customer's omnichannel data. |
Status
List Group Statuses
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/list_group_statuses |
| RTM API equivalent | list_group_statuses |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
all | No | bool | When set to true, you will get statuses of all the groups. |
group_ids | No | array | A table of groups' IDs |
One of the optional parameters needs to be included in the request.
Response
No response payload (200 OK).
Response
| | |
|---|
Group Not Found | If you send group_id of a group that doesn't exists, the id won't be included in the resposne. | |
Other
Check Goals
Customer can use this method to trigger checking if goals were achieved. Then, Agents receive the information. You should call this method to provide goals parameters for the server when the customers limit is reached. Works only for offline Customers.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/check_goals |
| RTM API equivalent | - |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
session_fields | Yes | []object | An array of custom object-enclosed key-value pairs. |
group_id | Yes | number | |
page_url | Yes | string | |
Response
No response payload (200 OK).
Get Form
Returns an empty ticket form of a prechat or postchat survey.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_form |
| RTM API equivalent | get_form |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
group_id | Yes | number | The ID of the group from which you want the form. |
type | Yes | string | The form type. Possible values: prechat or postchat. |
Response
| |
|---|
enabled | When set to true, the form is enabled and the form object is returned. Prechat/postchat survey can be disabled in the LiveChat Agent App UI. |
form | The Form data structure. |
Get Predicted Agent
Gets the predicted agent - the one the customer will chat with when the chat starts. To use this method, the customer needs to be logged in, which can be done via the login method.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_predicted_agent |
| RTM API equivalent | get_predicted_agent |
| Webhook | - |
Response
| Field | Data type | Notes |
|---|
queue | bool | True if the chat will be queued; false otherwise. |
Get URL Info
It returns the info on a given URL.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/get_url_info |
| RTM API equivalent | get_url_info |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
url | Yes | string | A valid website URL. |
Response
| Field | Data type | Notes |
|---|
image_url | string | URL of the minified image hosted on the LiveChat's CDN |
image_original_url | string | URL of the original image |
Mark Events As Seen
Specifics
Request
| Parameter | Required | Data type | Notes |
|---|
chat_id | Yes | string | |
seen_up_to | Yes | string | The RFC 3339 date-time format. |
Response
No response payload (200 OK).
Accept Greeting
Marks an incoming greeting as seen.
How it's implemented in LiveChat:
The Chat Widget uses this method to inform that a customer has seen a greeting. Based on that, the Reports section displays the greetings
that were actually seen by Customers, not all the sent greetings. If a customer started a chat from a greeting, but the Accept Method wasn't executed,
the greeting is still counted as seen in Reports.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/accept_greeting |
| RTM API equivalent | accept_greeting |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
greeting_id | Yes | number | The ID of the greeting configured within the license to accept. |
unique_id | Yes | string | The ID of the greeting to accept. You can get it from the incoming_greeting push. |
Response
No response payload (200 OK).
Cancel Greeting
Cancels a greeting (an invitation to the chat). For example, Customers could cancel greetings by minimalizing the chat widget with a greeting.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/cancel_greeting |
| RTM API equivalent | cancel_greeting |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
unique_id | Yes | string | The ID of the greeting to cancel. You can get it from the incoming_greeting push. |
Response
No response payload (200 OK).
Send Greeting Button Clicked
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/send_greeting_button_clicked |
| RTM API equivalent | send_greeting_button_clicked |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
greeting_unique_id | Yes | string | A unique greeting ID. You can get it from the incoming_greeting push. |
button_id | Yes | string | The greeting button ID. |
Response
No response payload (200 OK).
Request Email Verification
Requests the verification of the customer's email address by sending them a verification email with the identity confirmation link.
Once the customer verifies their identity, we'll send a POST callback to the URL you provided in the callback_uri request parameter. The callback will contain the verified email in the payload.
The identity verification mechanism has the following constraints:
- We'll store multiple verification requests until a customer confirms their identity. Once the identity is confirmed, we'll send a callback only for the 10 most recent verification requests, not for all stored requests.
- Seven days after the last verification request, all callbacks are voided and, as a result, won't be sent.
- If a customer has already verified their email, the callback will be sent immediately, without prompting the customer to verify it again.
Specifics
| |
|---|
| Method URL | https://api.livechatinc.com/v3.6/customer/action/request_email_verification |
| RTM API equivalent | - |
| Webhook | - |
Request
| Parameter | Required | Data type | Notes |
|---|
callback_uri | Yes | string | The URI to be called after the customer confirms their email address. Should return 200 code. There are no retries. |
Response
No response payload (200 OK).
Webhooks
Here's what you need to know about webhooks:
- Webhooks notify you when specific events are triggered.
- They can be generated by both Web and RTM API actions.
- When using RTM API, you can be also notified about events with pushes.
- Webhooks and pushes have similar payloads.
- There's a limit of three weebhoks for every action a Client ID can register.
See webhook methodsSee webhook payloadsErrors
Possible errors
| Error type | Default message | Description |
|---|
authentication | Authentication error | An invalid or expired access token. |
authorization | Authorization error | User is not allowed to perform the action. |
chat_anonymized | Chat anonymized | The request couldn't be performed on an anonymized chat. |
chat_inactive | Chat is inactive | An action that requires an active thread performed on a chat with no active threads. |
customer_banned | Customer is banned | The customer had been banned. |
entity_too_large | Upload limit exceeded (10MB). | Client's request is too large. |
greeting_not_found | Greeting not found | |
group_not_found | Group not found | |
group_offline | Group is offline | Thrown in response to Get Predicted Agent. |
group_unavailable | No agent available for group | Thrown in response to Get Predicted Agent. The group is online, but there are no available Agents. |
groups_offline | Groups offline | |
internal | Internal server error | |
license_expired | License expired | The end of license trial or subcription. |
license_not_found | License not found | License with the specified ID doesn't exist. |
limit_reached | Limit reached | Resource cannot be created/modified because the change would exceed the limit |
misdirected_request | Wrong region | Client's request should be performed to another region. The correct region is returned in the optional data object – this is where the client should be connected. |
request_timeout | Request timed out | Timeout threshold is 15 seconds. |
service_unavailable | Service unavailable | New requests are temporarily not being accepted. |
too_many_requests | Too many requests | The request's rate limit was exceeded. It'll be unblocked automatically after some time. |
unsupported_version | Cannot call unsupported API versions. | Unsupported protocol version. |
validation | Wrong format of request | |
wrong_product_version | Wrong product version | License is not LiveChat 3 (probably still LiveChat 2). |
Contact us
If you found a bug or a typo, you can let us know directly on GitHub.
In case of any questions or feedback, don't hesitate to contact us at developers@text.com. We'll be happy to hear from you!