رفتن به محتوای اصلی

Send every request to the base URL below with the X-Api-Key header. Bodies are JSON.

Base URL
http://api:4000/v1
Authentication
Create a key in the “Webhook & API” settings and send it in the X-Api-Key header. Limit: 60 requests per minute per key.
Example
curl -H "X-Api-Key: <key>" http://api:4000/v1/chats?limit=20

Response format

{ "status": "success", "data": { … } }
{ "status": "error", "code": "not_found", "message": "…" }

Error codes

invalid_key401Missing or invalid key.
invalid_params400Invalid input.
forbidden403Not allowed, or not in the plan.
not_found404Not found.
rate_limited429Too many requests.
internal500Internal server error.

Chats

GET/chats

List chats, paginated.

Query parameters

FieldTypeRequired
limitintegerNo
pageintegerNo
operator_idstringNo
status"open" | "closed"No
has_ownerbooleanNo

GET/chats/{chat_id}/messages

Messages of a chat, newest first.

Alternate paths: GET /chats/messages

Path parameters

FieldTypeRequired
chat_idstringYes

Query parameters

FieldTypeRequired
limitintegerNo
pageintegerNo
from_datestring (date-time) | stringNo
to_datestring (date-time) | stringNo

POST/chats

Start a chat for a user with a user or an operator message. Uses the contact quota.

Body

FieldTypeRequired
user_idstringYes
user_messagestringNo
operator_messagestringNo
operator_idstringNo

DELETE/chats/{chat_id}

Delete a chat permanently.

Path parameters

FieldTypeRequired
chat_idstringYes

POST/chats/{chat_id}/messages

Send an operator message. Button codes in the text become buttons. Uses the contact quota.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
operator_idstringYes
messagestringYes
reply_idstringNo

POST/chats/{chat_id}/files

Send a file from a public URL; the server fetches and checks it. Uses the contact quota.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
operator_idstringYes
file_urlstring (uri)Yes
file_namestringYes
file_sizeintegerYes
file_durationnumberNo

POST/chats/{chat_id}/notes

A private note the user cannot see.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
operator_idstringYes
messagestringYes

POST/chats/{chat_id}/user-messages

Record a message from the user.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
messagestringYes
reply_idstringNo

POST/chats/{chat_id}/typing

Show or hide “typing” to the user.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
operator_idstringYes
typing_statusbooleanYes

POST/chats/{chat_id}/close

Close a chat.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
operator_idstringYes

POST/chats/{chat_id}/assign

Transfer a chat to other operators.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
from_operatorstringYes
to_operatorstring[]Yes

POST/chats/{chat_id}/unassign

Remove the chat owner.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
from_operatorstringYes

GET/chats/{chat_id}/unread

Unread message counts.

Alternate paths: GET /chats/unread

Path parameters

FieldTypeRequired
chat_idstringYes

POST/chats/{chat_id}/poll

Send the satisfaction survey to the user.

Path parameters

FieldTypeRequired
chat_idstringYes

POST/chats/{chat_id}/widget

Open or close the user's widget.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
action"open" | "close"Yes

POST/chats/{chat_id}/js-event

Fire a JavaScript event on the user's page.

Path parameters

FieldTypeRequired
chat_idstringYes

Body

FieldTypeRequired
eventstringYes

Messages

PATCH/messages/{message_id}

Edit an operator message (within 60 minutes).

Path parameters

FieldTypeRequired
message_idstringYes

Body

FieldTypeRequired
messagestringYes

GET/messages/{message_id}/edits

Edit history of a message.

Path parameters

FieldTypeRequired
message_idstringYes

DELETE/messages/{message_id}

Delete an operator message.

Path parameters

FieldTypeRequired
message_idstringYes

Users

GET/users/{user_id}

User details.

Path parameters

FieldTypeRequired
user_idstringYes

PATCH/users/{user_id}

Update user details.

Path parameters

FieldTypeRequired
user_idstringYes

Body

FieldTypeRequired
namestringNo
phonestringNo
emailstring (email)No
avatarstring (uri)No
descriptionstringNo
tagsstring[]No
metadataobject[]No

POST/users/{user_id}/ban

Ban a user.

Path parameters

FieldTypeRequired
user_idstringYes

Body

FieldTypeRequired
operator_idstringYes

GET/users/{user_id}/pages

Pages the user has viewed.

Path parameters

FieldTypeRequired
user_idstringYes

Operators

GET/operators

Operators and their online status.

GET/operators/{operator_id}

One operator (by id or email).

Alternate paths: GET /operators/find

Path parameters

FieldTypeRequired
operator_idstringYes

Workspace

GET/workspace

Plan, remaining days and quota.

Webhooks

Each event is POSTed with the body {event, data}. X-Signature is sha256= plus the HMAC of the body with the signing secret, and X-Event-Id is the unique event id. A 2xx answer within 5 seconds counts as delivered; otherwise it is retried up to 6 times with growing delays.

X-Signature · X-Event-Id · new_messageclose_chattransfer_chatratingclick_button

مستندات API چت آنلاین | گپسو