Register a bot session
curl --request POST \
--url https://apix.us.amity.co/api/v5/sessions/bot \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"deviceId": "<string>",
"deviceInfo": {
"model": "<string>",
"sdkVersion": "<string>"
}
}
'import requests
url = "https://apix.us.amity.co/api/v5/sessions/bot"
payload = {
"deviceId": "<string>",
"deviceInfo": {
"model": "<string>",
"sdkVersion": "<string>"
}
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({deviceId: '<string>', deviceInfo: {model: '<string>', sdkVersion: '<string>'}})
};
fetch('https://apix.us.amity.co/api/v5/sessions/bot', 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://apix.us.amity.co/api/v5/sessions/bot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'deviceId' => '<string>',
'deviceInfo' => [
'model' => '<string>',
'sdkVersion' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v5/sessions/bot"
payload := strings.NewReader("{\n \"deviceId\": \"<string>\",\n \"deviceInfo\": {\n \"model\": \"<string>\",\n \"sdkVersion\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apix.us.amity.co/api/v5/sessions/bot")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"deviceId\": \"<string>\",\n \"deviceInfo\": {\n \"model\": \"<string>\",\n \"sdkVersion\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v5/sessions/bot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deviceId\": \"<string>\",\n \"deviceInfo\": {\n \"model\": \"<string>\",\n \"sdkVersion\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"issuedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [
"MUTE_CHANNEL"
],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
],
"roles": [],
"files": [],
"lastCachePurge": "2023-11-07T05:31:56Z",
"userType": "bot"
}{
"status": "error",
"code": 400100,
"message": "User is banned from the system."
}{
"status": "error",
"code": 400312,
"message": "User is global banned."
}{
"status": "error",
"code": 500000,
"message": "Parameters error.",
"data": {
"detail": [
"The 'data.text' field length must be less than or equal to 20000 characters long."
]
}
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Session
Register a bot session
Register a bot session for SEO crawlers. Bot users have read-only access and are optimized for SEO crawling.
POST
/
api
/
v5
/
sessions
/
bot
Register a bot session
curl --request POST \
--url https://apix.us.amity.co/api/v5/sessions/bot \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"deviceId": "<string>",
"deviceInfo": {
"model": "<string>",
"sdkVersion": "<string>"
}
}
'import requests
url = "https://apix.us.amity.co/api/v5/sessions/bot"
payload = {
"deviceId": "<string>",
"deviceInfo": {
"model": "<string>",
"sdkVersion": "<string>"
}
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({deviceId: '<string>', deviceInfo: {model: '<string>', sdkVersion: '<string>'}})
};
fetch('https://apix.us.amity.co/api/v5/sessions/bot', 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://apix.us.amity.co/api/v5/sessions/bot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'deviceId' => '<string>',
'deviceInfo' => [
'model' => '<string>',
'sdkVersion' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v5/sessions/bot"
payload := strings.NewReader("{\n \"deviceId\": \"<string>\",\n \"deviceInfo\": {\n \"model\": \"<string>\",\n \"sdkVersion\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apix.us.amity.co/api/v5/sessions/bot")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"deviceId\": \"<string>\",\n \"deviceInfo\": {\n \"model\": \"<string>\",\n \"sdkVersion\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v5/sessions/bot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deviceId\": \"<string>\",\n \"deviceInfo\": {\n \"model\": \"<string>\",\n \"sdkVersion\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"issuedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [
"MUTE_CHANNEL"
],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
],
"roles": [],
"files": [],
"lastCachePurge": "2023-11-07T05:31:56Z",
"userType": "bot"
}{
"status": "error",
"code": 400100,
"message": "User is banned from the system."
}{
"status": "error",
"code": 400312,
"message": "User is global banned."
}{
"status": "error",
"code": 500000,
"message": "Parameters error.",
"data": {
"detail": [
"The 'data.text' field length must be less than or equal to 20000 characters long."
]
}
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Body
application/json
Information about bot user and devices that they use to connect. Bot users have read-only access and are typically used for SEO crawlers and automated systems.
accessToken expires in 30 days by default.
Response
Session Information with access token and user data