NAV
HTTP Node.JS Python Ruby

Overview

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Chaport REST API lets you integrate Chaport with your application and manage chats, visitors, and messages programmatically. This documentation covers available endpoints, request and response formats, and authentication.

Check out basic usage examples on the right side.

In addition to API endpoints, Chaport provides webhooks for receiving real-time events (for example, new messages or chat updates). See Webhooks and Events below.

Email: REST API Help

Base URLs:

Authentication

Authorization: Bearer <your-access-token>

All API requests must include the Authorization HTTP header with a bearer token (see the example on the right).

You can generate or copy your access token in Settings → API.

To verify that your token works, send a GET request to /me.json.

Operators

The Operators API lets you manage operators (team members) in your Chaport account.

List Operators

Code samples

GET https://app.chaport.ru/api/v1/operators HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/operators',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://app.chaport.ru/api/v1/operators', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://app.chaport.ru/api/v1/operators',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /operators

Retrieves all existing operators.

Example responses

Status 200

{
  "result": [
    {
      "id": "59747c3ff77948220136b7b3",
      "email": "jon.snow@example.com",
      "name": "Jon Snow",
      "language": "en",
      "jobTitle": "The Wall supervisor",
      "role": "operator",
      "lastLoginAt": "2025-10-03T10:47:31.873Z",
      "emailConfirmedAt": "2025-10-02T09:44:12.873Z",
      "lastActivityAt": "2025-10-03T10:47:31.873Z",
      "image": "string",
      "lastStatus": "online",
      "lastStatusValidUntil": "2025-10-05T10:47:31.873Z",
      "realStatus": "online"
    }
  ]
}

Responses

Status Meaning Description
200 OK Successful request
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
result [Operator] true List of operators
result.id string true Operator ID
result.email string(email) true Operator email address
result.name string true Operator name
result.language string true App language
result.jobTitle string false Job title
result.role string true operator – a generic operator, admin – an operator with advanced administrative permissions
result.lastLoginAt string(date-time) false Time of the last login
result.emailConfirmedAt string(date-time) false Time when the operator confirmed their email address
result.lastActivityAt string(date-time) false Time of the most recent activity
result.image string false Profile image
result.lastStatus string false Last status explicitly set (manual or automatic)
result.lastStatusValidUntil string(date-time) false Time until which lastStatus is considered valid when computing realStatus
result.realStatus string false Effective status computed from presence and the last known status

Create an Operator

Code samples

POST https://app.chaport.ru/api/v1/operators HTTP/1.1
Host: app.chaport.ru
Content-Type: application/json
Accept: application/json

const request = require('node-fetch');
const inputBody = '{
  "email": "jon.snow@example.com",
  "name": "Jon Snow",
  "language": "en",
  "jobTitle": "The Wall supervisor",
  "role": "operator",
  "password": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/operators',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://app.chaport.ru/api/v1/operators', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://app.chaport.ru/api/v1/operators',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /operators

Creates a new operator.

Example request body

{
  "email": "jon.snow@example.com",
  "name": "Jon Snow",
  "language": "en",
  "jobTitle": "The Wall supervisor",
  "role": "operator",
  "password": "string"
}

Body parameters

Parameter Type Required Description
email string(email) true Operator email address
name string true Operator name
language string true App language
jobTitle string false Job title
role string true operator – a generic operator, admin – an operator with advanced administrative permissions
password string false Optional. If omitted, the operator must request an activation email from the login screen (log in without a password) and set their password

Example responses

Status 200

{
  "id": "string",
  "created": true
}

Responses

Status Meaning Description
200 OK Successful request
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
id string true Operator ID
created boolean true Whether a new operator has been created or not

Retrieve an Operator

Code samples

GET https://app.chaport.ru/api/v1/operators/:operatorId HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/operators/:operatorId',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://app.chaport.ru/api/v1/operators/:operatorId', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://app.chaport.ru/api/v1/operators/:operatorId',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /operators/:operatorId

Retrieves a single operator by ID.

Path parameters

Parameter Type Required Description
operatorId string true Operator ID

Example responses

Status 200

{
  "result": {
    "id": "59747c3ff77948220136b7b3",
    "email": "jon.snow@example.com",
    "name": "Jon Snow",
    "language": "en",
    "jobTitle": "The Wall supervisor",
    "role": "operator",
    "lastLoginAt": "2025-10-03T10:47:31.873Z",
    "emailConfirmedAt": "2025-10-02T09:44:12.873Z",
    "lastActivityAt": "2025-10-03T10:47:31.873Z",
    "image": "string",
    "lastStatus": "online",
    "lastStatusValidUntil": "2025-10-05T10:47:31.873Z",
    "realStatus": "online"
  }
}

Responses

Status Meaning Description
200 OK Successful request
404 Not Found Operator not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
result Operator true Operator
result.id string true Operator ID
result.email string(email) true Operator email address
result.name string true Operator name
result.language string true App language
result.jobTitle string false Job title
result.role string true operator – a generic operator, admin – an operator with advanced administrative permissions
result.lastLoginAt string(date-time) false Time of the last login
result.emailConfirmedAt string(date-time) false Time when the operator confirmed their email address
result.lastActivityAt string(date-time) false Time of the most recent activity
result.image string false Profile image
result.lastStatus string false Last status explicitly set (manual or automatic)
result.lastStatusValidUntil string(date-time) false Time until which lastStatus is considered valid when computing realStatus
result.realStatus string false Effective status computed from presence and the last known status

Update an Operator

Code samples

PUT https://app.chaport.ru/api/v1/operators/:operatorId HTTP/1.1
Host: app.chaport.ru
Content-Type: application/json
Accept: application/json

const request = require('node-fetch');
const inputBody = '{
  "name": "Jon Snow",
  "language": "en",
  "jobTitle": "The Wall supervisor",
  "role": "operator"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/operators/:operatorId',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('https://app.chaport.ru/api/v1/operators/:operatorId', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.put 'https://app.chaport.ru/api/v1/operators/:operatorId',
  params: {
  }, headers: headers

p JSON.parse(result)

PUT /operators/:operatorId

Updates an operator by ID.

Example request body

{
  "name": "Jon Snow",
  "language": "en",
  "jobTitle": "The Wall supervisor",
  "role": "operator"
}

Path parameters

Parameter Type Required Description
operatorId string true Operator ID

Body parameters

Parameter Type Required Description
name string true Operator name
language string true App language
jobTitle string false Job title
role string true operator – a generic operator, admin – an operator with advanced administrative permissions

Example responses

Status 200

{
  "updated": true
}

Responses

Status Meaning Description
200 OK Successful request
400 Bad Request Invalid or missing parameters in the request, find more details in the response body
404 Not Found Operator not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
updated boolean true Whether the operator has been updated or not

Delete an Operator

Code samples

DELETE https://app.chaport.ru/api/v1/operators/:operatorId HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/operators/:operatorId',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.delete('https://app.chaport.ru/api/v1/operators/:operatorId', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.delete 'https://app.chaport.ru/api/v1/operators/:operatorId',
  params: {
  }, headers: headers

p JSON.parse(result)

DELETE /operators/:operatorId

Deletes an operator by ID.

Path parameters

Parameter Type Required Description
operatorId string true Operator ID

Example responses

Status 200

{
  "deleted": true
}

Responses

Status Meaning Description
200 OK Successful request
400 Bad Request Invalid or missing parameters in the request, find more details in the response body
404 Not Found Operator not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
deleted boolean true Whether the operator has been deleted or not

Update Operator Status

Code samples

POST https://app.chaport.ru/api/v1/operators/:operatorId/status HTTP/1.1
Host: app.chaport.ru
Content-Type: application/json
Accept: application/json

const request = require('node-fetch');
const inputBody = '{
  "status": "online",
  "ttl": 3600,
  "validUntil": "2025-10-10T10:47:31.873Z"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/operators/:operatorId/status',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://app.chaport.ru/api/v1/operators/:operatorId/status', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://app.chaport.ru/api/v1/operators/:operatorId/status',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /operators/:operatorId/status

Sets an operator's lastStatus. Provide exactly one of ttl or validUntil to control how long this status is treated as the operator’s effective status (realStatus).

Example request body

{
  "status": "online",
  "ttl": 3600,
  "validUntil": "2025-10-10T10:47:31.873Z"
}

Body parameters

Parameter Type Required Description
status string true Operator status
ttl number(float) false Duration in seconds for which the status should remain valid unless changed manually. Alternative to validUntil
validUntil string(date-time) false Time until which the status should remain valid unless changed manually. Alternative to ttl

Example responses

Status 200

{
  "updated": true
}

Responses

Status Meaning Description
200 OK Successful request
404 Not Found Operator not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
updated boolean true Whether the operator has been updated or not

Visitors

The Visitors API lets you read and update data associated with your website visitors.

List Visitors

Code samples

GET https://app.chaport.ru/api/v1/visitors HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/visitors',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://app.chaport.ru/api/v1/visitors', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://app.chaport.ru/api/v1/visitors',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /visitors

Retrieves visitors ordered by the time of their most recent chat (most recent first).

Query parameters

Parameter Type Required Description
page integer false Results page number. Pages are 1-indexed. Use links.next and links.prev from response to fetch the next/previous page.

Example responses

Status 200

{
  "result": [
    {
      "id": "59747c3ff77948220136b7cd",
      "widgetId": "11111111-2222-eeee-bbbb-aaaaaa777777",
      "sourceHost": "example.com",
      "name": "London #1399",
      "referrer": "www.example.com",
      "language": "en",
      "lastSeen": "2017-10-03T10:47:31.873Z",
      "email": "visitor-email@example.com",
      "location": "United Kingdom, London",
      "custom": {},
      "consents": {
        "emailMarketing": true
      },
      "phone": "+44 (111) 111 11 11",
      "notes": "Asked us to notify him when the Others come. What is he talking about?",
      "utm": {
        "source": "string",
        "medium": "string",
        "term": "string",
        "campaign": "string",
        "content": "string"
      },
      "browser": {
        "name": "Chrome",
        "version": "67.0.3396.69"
      },
      "os": {
        "name": "OS X",
        "version": "14.14"
      }
    }
  ],
  "links": {
    "next": "string",
    "prev": "string"
  }
}

Responses

Status Meaning Description
200 OK Successful request
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
result [Visitor] true Page of visitors
result.id string true Visitor ID
result.widgetId string true Visitor ID assigned by the widget
result.sourceHost string false Website from which the visitor contacted you
result.name string false Visitor name. By default, name is likely to include identified geolocation and a visitor number. However, if IP geolocation is unsuccessful, a name may be an integer representing a visitor number only
result.referrer string false Referrer
result.language string false Widget UI language for this visitor. Typically derived from the visitor’s browser preferences, unless overridden by your JS API configuration
result.lastSeen string(date-time) false Time when the visitor was last seen
result.email string(email) false Visitor email address
result.location string false Detected location (country and city when available)
result.custom object false Custom visitor data. Configure your own visitor fields to display this data in visitor info panel
result.consents object false Consents granted by the visitor
result.consents.emailMarketing boolean false Whether email marketing consent is granted
result.phone string false Visitor phone number (free-form)
result.notes string false Visitor-related notes left by operators
result.utm object false UTM parameters associated with the visitor
result.utm.source string false UTM source
result.utm.medium string false UTM medium
result.utm.term string false UTM term
result.utm.campaign string false UTM campaign
result.utm.content string false UTM content
result.browser object false Browser information
result.browser.name string false Browser name
result.browser.version string false Browser version
result.os object false OS information
result.os.name string false OS name
result.os.version string false OS version
links object false Pagination links
links.next string false Relative URL to the next page of results if available
links.prev string false Relative URL to the previous page of results if available

Retrieve a Visitor

Code samples

GET https://app.chaport.ru/api/v1/visitors/:visitorId HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/visitors/:visitorId',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://app.chaport.ru/api/v1/visitors/:visitorId', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://app.chaport.ru/api/v1/visitors/:visitorId',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /visitors/:visitorId

Retrieves a visitor by ID.

Path parameters

Parameter Type Required Description
visitorId string true Visitor ID

Example responses

Status 200

{
  "result": {
    "id": "59747c3ff77948220136b7cd",
    "widgetId": "11111111-2222-eeee-bbbb-aaaaaa777777",
    "sourceHost": "example.com",
    "name": "London #1399",
    "referrer": "www.example.com",
    "language": "en",
    "lastSeen": "2017-10-03T10:47:31.873Z",
    "email": "visitor-email@example.com",
    "location": "United Kingdom, London",
    "custom": {},
    "consents": {
      "emailMarketing": true
    },
    "phone": "+44 (111) 111 11 11",
    "notes": "Asked us to notify him when the Others come. What is he talking about?",
    "utm": {
      "source": "string",
      "medium": "string",
      "term": "string",
      "campaign": "string",
      "content": "string"
    },
    "browser": {
      "name": "Chrome",
      "version": "67.0.3396.69"
    },
    "os": {
      "name": "OS X",
      "version": "14.14"
    }
  }
}

Responses

Status Meaning Description
200 OK Successful request
404 Not Found Visitor not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
result Visitor true Visitor
result.id string true Visitor ID
result.widgetId string true Visitor ID assigned by the widget
result.sourceHost string false Website from which the visitor contacted you
result.name string false Visitor name. By default, name is likely to include identified geolocation and a visitor number. However, if IP geolocation is unsuccessful, a name may be an integer representing a visitor number only
result.referrer string false Referrer
result.language string false Widget UI language for this visitor. Typically derived from the visitor’s browser preferences, unless overridden by your JS API configuration
result.lastSeen string(date-time) false Time when the visitor was last seen
result.email string(email) false Visitor email address
result.location string false Detected location (country and city when available)
result.custom object false Custom visitor data. Configure your own visitor fields to display this data in visitor info panel
result.consents object false Consents granted by the visitor
result.consents.emailMarketing boolean false Whether email marketing consent is granted
result.phone string false Visitor phone number (free-form)
result.notes string false Visitor-related notes left by operators
result.utm object false UTM parameters associated with the visitor
result.utm.source string false UTM source
result.utm.medium string false UTM medium
result.utm.term string false UTM term
result.utm.campaign string false UTM campaign
result.utm.content string false UTM content
result.browser object false Browser information
result.browser.name string false Browser name
result.browser.version string false Browser version
result.os object false OS information
result.os.name string false OS name
result.os.version string false OS version

Update a Visitor

Code samples

PUT https://app.chaport.ru/api/v1/visitors/:visitorId HTTP/1.1
Host: app.chaport.ru
Content-Type: application/json
Accept: application/json

const request = require('node-fetch');
const inputBody = '{
  "sourceHost": "example.com",
  "name": "London #1399",
  "email": "visitor-email@example.com",
  "custom": {},
  "consents": {
    "emailMarketing": true
  },
  "phone": "+44 (111) 111 11 11",
  "notes": "Asked us to notify him when the Others come. What is he talking about?",
  "utm": {
    "source": "string",
    "medium": "string",
    "term": "string",
    "campaign": "string",
    "content": "string"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/visitors/:visitorId',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('https://app.chaport.ru/api/v1/visitors/:visitorId', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.put 'https://app.chaport.ru/api/v1/visitors/:visitorId',
  params: {
  }, headers: headers

p JSON.parse(result)

PUT /visitors/:visitorId

Updates a visitor by ID. Updates only the fields provided in the request body. Omitted fields are not changed. Response contains updated visitor data.

Example request body

{
  "sourceHost": "example.com",
  "name": "London #1399",
  "email": "visitor-email@example.com",
  "custom": {},
  "consents": {
    "emailMarketing": true
  },
  "phone": "+44 (111) 111 11 11",
  "notes": "Asked us to notify him when the Others come. What is he talking about?",
  "utm": {
    "source": "string",
    "medium": "string",
    "term": "string",
    "campaign": "string",
    "content": "string"
  }
}

Path parameters

Parameter Type Required Description
visitorId string true Visitor ID

Body parameters

Parameter Type Required Description
sourceHost string false Website from which the visitor contacted you
name string false Visitor name. By default, name is likely to include identified geolocation and a visitor number. However, if IP geolocation is unsuccessful, a name may be an integer representing a visitor number only
email string(email) false Visitor email address
custom object false Custom visitor data. Configure your own visitor fields to display this data in visitor info panel
consents object false Consents granted by the visitor
consents.emailMarketing boolean false Whether email marketing consent is granted
phone string false Visitor phone number (free-form)
notes string false Visitor-related notes left by operators
utm object false UTM parameters associated with the visitor
utm.source string false UTM source
utm.medium string false UTM medium
utm.term string false UTM term
utm.campaign string false UTM campaign
utm.content string false UTM content

Example responses

Status 200

{
  "updated": {
    "id": "59747c3ff77948220136b7cd",
    "widgetId": "11111111-2222-eeee-bbbb-aaaaaa777777",
    "sourceHost": "example.com",
    "name": "London #1399",
    "referrer": "www.example.com",
    "language": "en",
    "lastSeen": "2017-10-03T10:47:31.873Z",
    "email": "visitor-email@example.com",
    "location": "United Kingdom, London",
    "custom": {},
    "consents": {
      "emailMarketing": true
    },
    "phone": "+44 (111) 111 11 11",
    "notes": "Asked us to notify him when the Others come. What is he talking about?",
    "utm": {
      "source": "string",
      "medium": "string",
      "term": "string",
      "campaign": "string",
      "content": "string"
    },
    "browser": {
      "name": "Chrome",
      "version": "67.0.3396.69"
    },
    "os": {
      "name": "OS X",
      "version": "14.14"
    }
  }
}

Responses

Status Meaning Description
200 OK Successfully updated. The response returns the updated visitor object in updated
404 Not Found Visitor not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
updated Visitor true Updated visitor object
updated.id string true Visitor ID
updated.widgetId string true Visitor ID assigned by the widget
updated.sourceHost string false Website from which the visitor contacted you
updated.name string false Visitor name. By default, name is likely to include identified geolocation and a visitor number. However, if IP geolocation is unsuccessful, a name may be an integer representing a visitor number only
updated.referrer string false Referrer
updated.language string false Widget UI language for this visitor. Typically derived from the visitor’s browser preferences, unless overridden by your JS API configuration
updated.lastSeen string(date-time) false Time when the visitor was last seen
updated.email string(email) false Visitor email address
updated.location string false Detected location (country and city when available)
updated.custom object false Custom visitor data. Configure your own visitor fields to display this data in visitor info panel
updated.consents object false Consents granted by the visitor
updated.consents.emailMarketing boolean false Whether email marketing consent is granted
updated.phone string false Visitor phone number (free-form)
updated.notes string false Visitor-related notes left by operators
updated.utm object false UTM parameters associated with the visitor
updated.utm.source string false UTM source
updated.utm.medium string false UTM medium
updated.utm.term string false UTM term
updated.utm.campaign string false UTM campaign
updated.utm.content string false UTM content
updated.browser object false Browser information
updated.browser.name string false Browser name
updated.browser.version string false Browser version
updated.os object false OS information
updated.os.name string false OS name
updated.os.version string false OS version

Delete a Visitor

Code samples

DELETE https://app.chaport.ru/api/v1/visitors/:visitorId HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/visitors/:visitorId',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.delete('https://app.chaport.ru/api/v1/visitors/:visitorId', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.delete 'https://app.chaport.ru/api/v1/visitors/:visitorId',
  params: {
  }, headers: headers

p JSON.parse(result)

DELETE /visitors/:visitorId

Deletes a visitor by ID.

Path parameters

Parameter Type Required Description
visitorId string true Visitor ID

Example responses

Status 200

{
  "deleted": true
}

Responses

Status Meaning Description
200 OK Successful request
404 Not Found Visitor not found
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
deleted boolean true Whether the visitor has been deleted or not

Chats

The Chats API lets you read and update chats.

Retrieve Last Visitor Chat

Code samples

GET https://app.chaport.ru/api/v1/visitors/:visitorId/chats HTTP/1.1
Host: app.chaport.ru

Accept: application/json

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://app.chaport.ru/api/v1/visitors/:visitorId/chats',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://app.chaport.ru/api/v1/visitors/:visitorId/chats', params={

}, headers = headers)

print r.json()

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://app.chaport.ru/api/v1/visitors/:visitorId/chats',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /visitors/:visitorId/chats

Retrieves the visitor’s current or most recent chat. To fetch older chats, use the URLs in links.more from the response.

Path parameters

Parameter Type Required Description
visitorId string true Visitor ID

Query parameters

Parameter Type Required Description
eventTypes array false List of event types to include. Ignored when transcript=true
transcript boolean false If true, returns events as a transcript (message events only)

Example responses

Status 200

{
  "result": {
    "id": 120904824,
    "startedAt": "2017-10-03T10:47:31.873Z",
    "startPage": {
      "url": "https://example.com/some-page",
      "title": "Example.com | Home page"
    },
    "rating": 1,
    "ip": "string",
    "initiator": "visitor",
    "events": [
      [
        {
          "type": "visitor-message",
          "timestamp": "2018-09-25T13:14:01Z",
          "params": {
            "text": "Hello! How do I do this thing?"
          }
        },
        {
          "type": "operator-message",
          "timestamp": "2018-09-25T13:14:13Z",
          "params": {
            "operatorId": "123abc123abc123abc123abc",
            "text": "Hello! To do this thing please do that thing and follow instructions on the screen."
          }
        }
      ]
    ],
    "stage": "engaged",
    "operators": [
      "123894abc958123894abc958"
    ],
    "assignedTeam": "123894abc958123894abc958",
    "lastMessageAt": "2017-10-03T10:57:31.873Z",
    "lastMessageChannel": "facebook",
    "lastMessageChannelId": "123abc123abc123abc123abc",
    "missed": false
  },
  "links": {
    "app": "string",
    "more": [
      "string"
    ]
  }
}

Status 404

{
  "links": {
    "more": [
      "string"
    ]
  }
}

Responses

Status Meaning Description
200 OK Successful request
404 Not Found Chat not found. Response may contain links to related chats
500 Internal Server Error Server was unable to process the request due to an internal error

Response Schema

Status Code 200

Name Type Required Description
result Chat true Chat
result.id integer false Chat ID
result.startedAt string(date-time) false Time when the chat was started
result.startPage object false Details of the page where the chat was initiated
result.startPage.url string true Start page URL
result.startPage.title string true Start page title
result.rating integer false Rating given to the chat by visitor
result.ip string false Visitor IP address during this chat
result.initiator string false Chat initiator. Possible values are: auto-invitation, chat-bot, operator, visitor, system
result.events [ChatEvent] false List of the chat events
result.events.type string true Type of the chat event (i.e., a chat event discriminator)
result.events.timestamp string(date-time) true Time of the chat event
result.stage string false Chat stage

Values:
initiated – visitor started a chat, no operator reply yet
offline - like initiated, but all operators were offline
responded – operator replied; visitor has not replied since
engaged - visitor messaged after an operator message (conversation started)
invited manually – operator initiated a chat; visitor did not reply
closed - operator closed the chat without sending a message
result.operators [string] false Assigned operators IDs
result.assignedTeam string false Assigned team ID
result.lastMessageAt string(date-time) false Time of the last message
result.lastMessageChannel string false Channel (integration name) through which last message came
result.lastMessageChannelId string false Integration ID
result.missed boolean false Whether the chat is considered missed
links object false Related API URLs
links.app string false App link
links.more [string] false API URLs to request other chats

Response Schema

Status Code 404

Name Type Required Description
links object false Related API URLs
links.more [string] false API URLs to request other chats

Update Last Visitor Chat

Code samples

PUT https://app.chaport.ru/api/v1/visitors/:visitorId/chats HTTP/1.1
Host: app.chaport.ru
Content-Type: application/json
Accept: application/json

const request = require('node-fetch');
const inputBody = '{
  "startPage": {
    "url": "https://example.com/some-page",
    "title": "Example.com | Home page"
  },
  "rating": 1,
  "stage": "engaged",
  "operators": [
    "