cURL
curl --request GET \
--url https://api.langtail.com/v2/threads/{threadId}/messages/{messageId} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.langtail.com/v2/threads/{threadId}/messages/{messageId}"
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}/messages/{messageId}', 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}/messages/{messageId}",
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}/messages/{messageId}"
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}/messages/{messageId}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langtail.com/v2/threads/{threadId}/messages/{messageId}")
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": "2023-11-07T05:31:56Z",
"threadId": "<string>",
"content": [
{
"role": "user",
"content": "Hello"
}
],
"metadata": {},
"requestLog": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"request": {},
"response": {}
},
"requestLogId": "<string>"
}{
"error": {
"message": "Thread not found, message not in thread, or message does not exist"
}
}Assistant messages in threads
Get Thread Message
Retrieves a specific message from a thread.
GET
/
v2
/
threads
/
{threadId}
/
messages
/
{messageId}
cURL
curl --request GET \
--url https://api.langtail.com/v2/threads/{threadId}/messages/{messageId} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.langtail.com/v2/threads/{threadId}/messages/{messageId}"
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}/messages/{messageId}', 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}/messages/{messageId}",
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}/messages/{messageId}"
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}/messages/{messageId}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langtail.com/v2/threads/{threadId}/messages/{messageId}")
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": "2023-11-07T05:31:56Z",
"threadId": "<string>",
"content": [
{
"role": "user",
"content": "Hello"
}
],
"metadata": {},
"requestLog": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"request": {},
"response": {}
},
"requestLogId": "<string>"
}{
"error": {
"message": "Thread not found, message not in thread, or message does not exist"
}
}This endpoint allows you to retrieve a specific message from a thread using its unique identifier. It provides detailed information about the message, including its content, creation time, and associated metadata.
Path Parameters
Response
Successful response
Was this page helpful?