Get Widget Threads
curl --request GET \
--url https://api.bland.ai/v1/widget/{id}/threads \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v1/widget/{id}/threads"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v1/widget/{id}/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://api.bland.ai/v1/widget/{id}/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: <authorization>"
],
]);
$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://api.bland.ai/v1/widget/{id}/threads"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bland.ai/v1/widget/{id}/threads")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/widget/{id}/threads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"threads": [
{
"id": "thread_550e8400-e29b-41d4-a716-446655440000",
"created_at": "2024-01-15T14:30:00Z",
"ended_at": null,
"live_agent_handoff_at": null,
"visitor_id": "visitor_123456789",
"messages": [
{
"id": "msg_001",
"sender_type": "USER",
"created_at": "2024-01-15T14:30:00Z",
"content": "Hello, I need help with my order",
"original_content": null
},
{
"id": "msg_002",
"sender_type": "ASSISTANT",
"created_at": "2024-01-15T14:30:15Z",
"content": "I'd be happy to help you with your order! Can you please provide your order number?",
"original_content": null
},
{
"id": "msg_003",
"sender_type": "USER",
"created_at": "2024-01-15T14:30:45Z",
"content": "It's order #12345",
"original_content": null
}
]
},
{
"id": "thread_660f9511-f3ac-52e5-b827-557766551111",
"created_at": "2024-01-15T13:15:00Z",
"ended_at": "2024-01-15T13:20:00Z",
"live_agent_handoff_at": null,
"visitor_id": null,
"messages": [
{
"id": "msg_101",
"sender_type": "USER",
"created_at": "2024-01-15T13:15:00Z",
"content": "What are your business hours?",
"original_content": null
},
{
"id": "msg_102",
"sender_type": "ASSISTANT",
"created_at": "2024-01-15T13:15:05Z",
"content": "Our business hours are Monday through Friday, 9 AM to 6 PM EST.",
"original_content": null
}
]
}
],
"total": 2
},
"errors": null
}
Widgets
Get Widget Threads
Retrieves all conversation threads for a specific widget. Returns threads ordered by creation date (newest first) with associated messages ordered chronologically.
GET
/
v1
/
widget
/
{id}
/
threads
Get Widget Threads
curl --request GET \
--url https://api.bland.ai/v1/widget/{id}/threads \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v1/widget/{id}/threads"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v1/widget/{id}/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://api.bland.ai/v1/widget/{id}/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: <authorization>"
],
]);
$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://api.bland.ai/v1/widget/{id}/threads"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bland.ai/v1/widget/{id}/threads")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/widget/{id}/threads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"threads": [
{
"id": "thread_550e8400-e29b-41d4-a716-446655440000",
"created_at": "2024-01-15T14:30:00Z",
"ended_at": null,
"live_agent_handoff_at": null,
"visitor_id": "visitor_123456789",
"messages": [
{
"id": "msg_001",
"sender_type": "USER",
"created_at": "2024-01-15T14:30:00Z",
"content": "Hello, I need help with my order",
"original_content": null
},
{
"id": "msg_002",
"sender_type": "ASSISTANT",
"created_at": "2024-01-15T14:30:15Z",
"content": "I'd be happy to help you with your order! Can you please provide your order number?",
"original_content": null
},
{
"id": "msg_003",
"sender_type": "USER",
"created_at": "2024-01-15T14:30:45Z",
"content": "It's order #12345",
"original_content": null
}
]
},
{
"id": "thread_660f9511-f3ac-52e5-b827-557766551111",
"created_at": "2024-01-15T13:15:00Z",
"ended_at": "2024-01-15T13:20:00Z",
"live_agent_handoff_at": null,
"visitor_id": null,
"messages": [
{
"id": "msg_101",
"sender_type": "USER",
"created_at": "2024-01-15T13:15:00Z",
"content": "What are your business hours?",
"original_content": null
},
{
"id": "msg_102",
"sender_type": "ASSISTANT",
"created_at": "2024-01-15T13:15:05Z",
"content": "Our business hours are Monday through Friday, 9 AM to 6 PM EST.",
"original_content": null
}
]
}
],
"total": 2
},
"errors": null
}
Headers
string
required
Your API key for authentication.
Path Parameters
string
required
UUID of the widget to retrieve threads for.
Query Parameters
number
default:1
Page number for pagination (minimum 1).
number
default:20
Number of threads per page (minimum 1, maximum 100).
string
Filter results to a specific thread by its UUID.
Response
number
HTTP status code (200 for success).
object
threads(array): Array of thread objects, each containing:id(string): Thread UUIDcreated_at(string): ISO timestampended_at(string | null): ISO timestamp of when the thread endedlive_agent_handoff_at(string | null): ISO timestamp of when the thread was handed off to a live agentvisitor_id(string | null): UUID of visitor (if available)messages(array): Array of message objects, each containing:id(string): Message UUIDsender_type(string): Either “USER” or “ASSISTANT”created_at(string): ISO timestampcontent(string): Message contentoriginal_content(string | null): Original message content before any modifications
total(number): Total number of threads matching the query (useful for calculating total pages)
This endpoint does not return 404 if no threads exist; it returns an empty array instead.
{
"status": 200,
"data": {
"threads": [
{
"id": "thread_550e8400-e29b-41d4-a716-446655440000",
"created_at": "2024-01-15T14:30:00Z",
"ended_at": null,
"live_agent_handoff_at": null,
"visitor_id": "visitor_123456789",
"messages": [
{
"id": "msg_001",
"sender_type": "USER",
"created_at": "2024-01-15T14:30:00Z",
"content": "Hello, I need help with my order",
"original_content": null
},
{
"id": "msg_002",
"sender_type": "ASSISTANT",
"created_at": "2024-01-15T14:30:15Z",
"content": "I'd be happy to help you with your order! Can you please provide your order number?",
"original_content": null
},
{
"id": "msg_003",
"sender_type": "USER",
"created_at": "2024-01-15T14:30:45Z",
"content": "It's order #12345",
"original_content": null
}
]
},
{
"id": "thread_660f9511-f3ac-52e5-b827-557766551111",
"created_at": "2024-01-15T13:15:00Z",
"ended_at": "2024-01-15T13:20:00Z",
"live_agent_handoff_at": null,
"visitor_id": null,
"messages": [
{
"id": "msg_101",
"sender_type": "USER",
"created_at": "2024-01-15T13:15:00Z",
"content": "What are your business hours?",
"original_content": null
},
{
"id": "msg_102",
"sender_type": "ASSISTANT",
"created_at": "2024-01-15T13:15:05Z",
"content": "Our business hours are Monday through Friday, 9 AM to 6 PM EST.",
"original_content": null
}
]
}
],
"total": 2
},
"errors": null
}
Docs for agents: llms.txt
Was this page helpful?
⌘I