Skip to main content
GET
/
v0
/
chatbots
/
{chatbotId}
/
threads
Fetch All Threads
curl --request GET \
  --url https://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads', 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://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads",
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://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads"

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://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://sitegpt.ai/api/v0/chatbots/{chatbotId}/threads")

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
{
  "success": true,
  "message": "Fetched the chatbot threads successfully",
  "data": {
    "threads": [
      {
        "threadId": "06b3b43c-5651-49a2-b618-d7f24667c1b6",
        "startedAt": "2023-05-18T11:39:57.349750Z",
        "updatedAt": "2023-05-18T11:39:57.349750Z",
        "endedAt": "2023-05-18T11:39:57.349750Z",
        "chatUser": null,
        "escalated": false,
        "important": false,
        "resolved": false,
        "totalMessagesRead": 47,
        "lastMessage": {
          "answer": {
            "text": "This is agent!!",
            "timestamp": "2023-07-10T14:41:46.808649Z"
          },
          "sources": [],
          "reaction": "NEUTRAL",
          "threadId": "06b3b43c-5651-49a2-b618-d7f24667c1b6",
          "messageType": "AGENT_MESSAGE",
          "prompts": [
            {
              "id": "f3792c3c-5814-4dec-b530-55e1611951a9",
              "title": "Prompt 1",
              "description": "This is the prompt1 description"
            },
            {
              "id": "64d7fb10-847a-4dd7-8b5b-821fca199606",
              "title": "Prompt 2",
              "description": "This is the prompt2 description"
            }
          ],
          "messageId": "369876016179446353",
          "question": null,
          "chatbotId": "365062873485935184"
        },
        "totalMessages": 47,
        "totalPositiveMessages": 0,
        "totalNegativeMessages": 0,
        "totalGpt4MessagesCount": 0
      },
      {
        "threadId": "88d6c628-c108-4ca7-9578-0424461c0832",
        "startedAt": "2023-05-19T14:33:08.252701Z",
        "updatedAt": "2023-05-19T14:33:08.252701Z",
        "endedAt": "2023-05-19T14:33:08.252701Z",
        "chatUser": null,
        "escalated": false,
        "important": false,
        "resolved": false,
        "totalMessagesRead": 0,
        "lastMessage": {
          "question": {
            "text": "This is bot",
            "timestamp": "2023-05-19T14:33:08.771854Z"
          },
          "sources": [],
          "reaction": "NEUTRAL",
          "threadId": "88d6c628-c108-4ca7-9578-0424461c0832",
          "messageType": "USER_MESSAGE",
          "iconUrl": "https://avatars.githubusercontent.com/u/17903466?s=48&v=4",
          "messageId": "365164430725481040",
          "answer": null,
          "chatbotId": "365062873485935184",
          "prompts": []
        },
        "totalMessages": 1,
        "totalPositiveMessages": 0,
        "totalNegativeMessages": 0,
        "totalGpt4MessagesCount": 0
      },
      {
        "threadId": "1ca901e8-dab9-4e8f-ac24-80b557e89742",
        "startedAt": "2023-05-18T11:47:48.313693Z",
        "updatedAt": "2023-05-18T11:47:48.313693Z",
        "endedAt": "2023-05-18T11:47:48.313693Z",
        "chatUser": null,
        "escalated": false,
        "important": false,
        "resolved": false,
        "totalMessagesRead": 0,
        "lastMessage": {
          "question": {
            "text": "Hello, what is this?",
            "timestamp": "2023-05-18T11:47:57.194303Z"
          },
          "answer": {
            "text": "This is a website where you can find information on various topics. Please browse our pages to learn more.",
            "timestamp": "2023-05-18T11:47:57.194303Z"
          },
          "gptModel": "gpt-3.5-turbo",
          "sources": [],
          "reaction": "NEUTRAL",
          "threadId": "1ca901e8-dab9-4e8f-ac24-80b557e89742",
          "messageType": "NORMAL_MESSAGE",
          "messageId": "365063440720462416",
          "chatbotId": "365062873485935184",
          "prompts": []
        },
        "totalMessages": 1,
        "totalPositiveMessages": 0,
        "totalNegativeMessages": 0,
        "totalGpt4MessagesCount": 0
      }
    ]
  }
}
{
"success": false,
"message": "Failed to fetch the chatbot threads",
"error": {
"code": "CHATBOT_ID_REQUIRED",
"message": "chatbotId field is required",
"details": null
}
}
{
"success": false,
"message": "Failed to fetch the chatbot threads",
"error": {
"code": "API_KEY_NOT_VALID",
"message": "Authorization header does not contain valid API key",
"details": null
}
}
{
"success": false,
"message": "Failed to fetch the chatbot threads",
"data": null,
"error": {
"code": "FETCH_CHATBOT_THREADS_FORBIDDEN",
"message": "You are not authorized to fetch this chatbot threads",
"details": null
}
}
{
"success": false,
"message": "Failed to fetch the chatbot threads",
"data": null,
"error": {
"code": "REQUEST_METHOD_NOT_ALLOWED",
"message": "PATCH request method is not allowed",
"details": null
}
}
{
"success": false,
"message": "Failed to fetch the chatbot threads",
"data": null,
"error": {
"code": "FETCH_CHATBOT_THREADS_FAILED",
"message": "Some technical error has occurred !!",
"details": null
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

chatbotId
string
required

Id of the chatbot

Response

OK

Success Response

success
boolean

Indicates whether this is success response or error response

message
string

Overall message regarding the operation performed

data
object

Data returned from the server