List sessions
curl --request GET \
--url https://accounts.livechat.com/v2/sessions \
--header 'Authorization: Bearer <token>'import requests
url = "https://accounts.livechat.com/v2/sessions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://accounts.livechat.com/v2/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://accounts.livechat.com/v2/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://accounts.livechat.com/v2/sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://accounts.livechat.com/v2/sessions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"account_id": "496a94f2-cbbf-444e-a3cb-305b9f5f8cbb",
"session_id": "bfeeb033-bc8e-467f-982d-22dcef274fa1",
"current": true,
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36",
"identity_source": "credentials",
"ip": "198.51.100.14",
"applications": [
{
"name": "LiveChat",
"client_id": "0805e283233042b37f460ed8fbf22160",
"session_id": "4cf5be18-8053-4ef4-9891-4a2a71b2b1c3"
}
]
}
]{
"error": "unauthorized",
"error_description": "The account is not authorized.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "access_denied",
"sub_error": "insufficient_scope",
"error_description": "The resource owner or authorization server denied the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}Sessions
List sessions
Returns all sessions for a given account ID.
The account ID is obtained from an authorization grant.
GET
/
sessions
List sessions
curl --request GET \
--url https://accounts.livechat.com/v2/sessions \
--header 'Authorization: Bearer <token>'import requests
url = "https://accounts.livechat.com/v2/sessions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://accounts.livechat.com/v2/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://accounts.livechat.com/v2/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://accounts.livechat.com/v2/sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://accounts.livechat.com/v2/sessions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"account_id": "496a94f2-cbbf-444e-a3cb-305b9f5f8cbb",
"session_id": "bfeeb033-bc8e-467f-982d-22dcef274fa1",
"current": true,
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36",
"identity_source": "credentials",
"ip": "198.51.100.14",
"applications": [
{
"name": "LiveChat",
"client_id": "0805e283233042b37f460ed8fbf22160",
"session_id": "4cf5be18-8053-4ef4-9891-4a2a71b2b1c3"
}
]
}
]{
"error": "unauthorized",
"error_description": "The account is not authorized.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "access_denied",
"sub_error": "insufficient_scope",
"error_description": "The resource owner or authorization server denied the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}Required scopes:
sessions--my:roAuthorizations
This API uses OAuth2 with the implicit grant flow. Learn about the implicit grant flow.
Response
OK: Returns the list of sessions.
Was this page helpful?