cURL
curl --request GET \
--url https://api.langtail.com/v2/threads/{threadId} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.langtail.com/v2/threads/{threadId}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://api.langtail.com/v2/threads/{threadId}', 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.langtail.com/v2/threads/{threadId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.langtail.com/v2/threads/{threadId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
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.langtail.com/v2/threads/{threadId}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langtail.com/v2/threads/{threadId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": 123,
"projectId": "<string>",
"deletedAt": "2023-11-07T05:31:56Z",
"createLog": {
"id": "<string>",
"url": "<string>",
"stream": true,
"metadata": "<string>",
"promptId": "<string>",
"threadId": "<string>",
"assistant": true,
"projectId": "<string>",
"requestIP": "<string>",
"startedAt": "2023-11-07T05:31:56Z",
"variables": "<string>",
"parameters": "<string>",
"promptSlug": "<string>",
"doNotRecord": true,
"environment": "<string>",
"openAIKeyId": "<string>",
"projectSlug": "<string>",
"requestData": "<string>",
"deploymentId": "<string>",
"organizationId": "<string>",
"projectAPIKeyId": "<string>",
"organizationSlug": "<string>",
"deploymentVersion": "<string>",
"promptHistoryHash": "<string>",
"openAIOrganization": "<string>"
},
"metadata": {
"user_id": "user_123",
"conversation_topic": "product_inquiry",
"priority": "high"
}
}{
"error": {
"message": "Thread not found"
}
}Threads
Thread by ID
Retrieves a thread by its ID.
GET
/
v2
/
threads
/
{threadId}
cURL
curl --request GET \
--url https://api.langtail.com/v2/threads/{threadId} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.langtail.com/v2/threads/{threadId}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://api.langtail.com/v2/threads/{threadId}', 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.langtail.com/v2/threads/{threadId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.langtail.com/v2/threads/{threadId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
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.langtail.com/v2/threads/{threadId}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langtail.com/v2/threads/{threadId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": 123,
"projectId": "<string>",
"deletedAt": "2023-11-07T05:31:56Z",
"createLog": {
"id": "<string>",
"url": "<string>",
"stream": true,
"metadata": "<string>",
"promptId": "<string>",
"threadId": "<string>",
"assistant": true,
"projectId": "<string>",
"requestIP": "<string>",
"startedAt": "2023-11-07T05:31:56Z",
"variables": "<string>",
"parameters": "<string>",
"promptSlug": "<string>",
"doNotRecord": true,
"environment": "<string>",
"openAIKeyId": "<string>",
"projectSlug": "<string>",
"requestData": "<string>",
"deploymentId": "<string>",
"organizationId": "<string>",
"projectAPIKeyId": "<string>",
"organizationSlug": "<string>",
"deploymentVersion": "<string>",
"promptHistoryHash": "<string>",
"openAIOrganization": "<string>"
},
"metadata": {
"user_id": "user_123",
"conversation_topic": "product_inquiry",
"priority": "high"
}
}{
"error": {
"message": "Thread not found"
}
}This endpoint retrieves a single thread by its unique identifier. It provides detailed information about a specific conversation thread, including its creation timestamp, associated project, and any custom metadata.
Response
Successful response
Was this page helpful?