Get Thread Info
curl --request GET \
--url https://api.mycura.org/api/cura/threads/{id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.mycura.org/api/cura/threads/{id}"
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.mycura.org/api/cura/threads/{id}', 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.mycura.org/api/cura/threads/{id}",
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.mycura.org/api/cura/threads/{id}"
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.mycura.org/api/cura/threads/{id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mycura.org/api/cura/threads/{id}")
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{
"error": "Thread not found or expired"
}
{
"error": "Unauthorized - Invalid API key"
}
{
"error": "Failed to retrieve thread"
}
Conversation Threads
Get Thread Info
Retrieve information about a conversation thread
GET
/
api
/
cura
/
threads
/
{id}
Get Thread Info
curl --request GET \
--url https://api.mycura.org/api/cura/threads/{id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.mycura.org/api/cura/threads/{id}"
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.mycura.org/api/cura/threads/{id}', 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.mycura.org/api/cura/threads/{id}",
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.mycura.org/api/cura/threads/{id}"
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.mycura.org/api/cura/threads/{id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mycura.org/api/cura/threads/{id}")
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{
"error": "Thread not found or expired"
}
{
"error": "Unauthorized - Invalid API key"
}
{
"error": "Failed to retrieve thread"
}
Overview
Retrieves detailed information about a conversation thread, including message count, patient linkage, activity timestamps, and expiration status.Authentication
string
required
Your Cura API key
Path Parameters
string
required
The 5-digit thread ID (e.g.,
82451)Request Example
curl -X GET "https://api.mycura.org/api/cura/threads/82451" \
-H "X-API-Key: YOUR_API_KEY"
const axios = require('axios');
const response = await axios.get(
'https://api.mycura.org/api/cura/threads/82451',
{
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
}
);
console.log(response.data.thread);
import requests
response = requests.get(
'https://api.mycura.org/api/cura/threads/82451',
headers={
'X-API-Key': 'YOUR_API_KEY'
}
)
thread = response.json()['thread']
print(f"Messages: {thread['messageCount']}")
print(f"Expires: {thread['expiresAt']}")
<?php
$ch = curl_init('https://api.mycura.org/api/cura/threads/82451');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: YOUR_API_KEY'
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
$thread = $data['thread'];
echo "Thread ID: " . $thread['threadId'] . "\n";
echo "Messages: " . $thread['messageCount'] . "\n";
?>
Response
boolean
Whether the request was successful
object
Thread information object
Show Thread Properties
Show Thread Properties
string
The 5-digit thread identifier
string | null
UUID of linked patient (null if not linked)
integer
Total number of messages in the thread (user + assistant)
string (ISO 8601)
Timestamp of the last message sent to this thread
string (ISO 8601)
Timestamp when the thread was created
string (ISO 8601)
Timestamp when the thread will auto-delete (30 minutes from last activity)
Success Response (200)
{
"success": true,
"thread": {
"threadId": "82451",
"patientId": "28dffdd1-c18b-46e4-88f7-9b2f073c70dc",
"messageCount": 12,
"lastActivity": "2025-10-22T18:15:30.123Z",
"createdAt": "2025-10-22T18:05:00.000Z",
"expiresAt": "2025-10-22T18:45:30.123Z"
}
}
Error Responses
{
"error": "Thread not found or expired"
}
{
"error": "Unauthorized - Invalid API key"
}
{
"error": "Failed to retrieve thread"
}
Use Cases
Check if Thread is Active
Verify a thread exists before sending messages
Monitor Expiration
Check when the thread will expire to warn users
Track Conversation Length
See how many messages have been exchanged
Verify Patient Linkage
Confirm which patient (if any) the thread is linked to
Example: Check Expiration
async function isThreadExpired(threadId) {
try {
const response = await axios.get(
`https://api.mycura.org/api/cura/threads/${threadId}`,
{
headers: { 'X-API-Key': 'YOUR_API_KEY' }
}
);
const expiresAt = new Date(response.data.thread.expiresAt);
const now = new Date();
if (expiresAt < now) {
return true; // Expired
}
const minutesLeft = Math.floor((expiresAt - now) / 1000 / 60);
console.log(`Thread expires in ${minutesLeft} minutes`);
return false;
} catch (error) {
if (error.response?.status === 404) {
return true; // Thread not found = expired/deleted
}
throw error;
}
}
Example: Display Thread Stats
async function displayThreadStats(threadId) {
const response = await axios.get(
`https://api.mycura.org/api/cura/threads/${threadId}`,
{
headers: { 'X-API-Key': 'YOUR_API_KEY' }
}
);
const { thread } = response.data;
console.log(`
Thread Information
==================
ID: ${thread.threadId}
Patient Linked: ${thread.patientId ? 'Yes' : 'No'}
Total Messages: ${thread.messageCount}
Age: ${getTimeSince(thread.createdAt)}
Last Active: ${getTimeSince(thread.lastActivity)}
Expires In: ${getTimeUntil(thread.expiresAt)}
`);
}
function getTimeSince(timestamp) {
const minutes = Math.floor((Date.now() - new Date(timestamp)) / 1000 / 60);
return `${minutes} minutes ago`;
}
function getTimeUntil(timestamp) {
const minutes = Math.floor((new Date(timestamp) - Date.now()) / 1000 / 60);
return `${minutes} minutes`;
}
Best Practices
Check expiration before long operations
Check expiration before long operations
Before starting a multi-message flow, verify the thread is still active:
async function sendMultipleMessages(threadId, messages) {
// Check thread status first
const threadInfo = await getThreadInfo(threadId);
if (!threadInfo) {
throw new Error('Thread expired - please create a new one');
}
// Proceed with messages
for (const msg of messages) {
await chat({ threadId, message: msg });
}
}
Display expiration warnings to users
Display expiration warnings to users
Show users when their thread is about to expire:
function showExpirationWarning(expiresAt) {
const minutesLeft = Math.floor(
(new Date(expiresAt) - Date.now()) / 1000 / 60
);
if (minutesLeft < 5) {
alert(`Your conversation will expire in ${minutesLeft} minutes!`);
}
}
Use for analytics and monitoring
Use for analytics and monitoring
Track thread usage patterns:
async function logThreadMetrics(threadId) {
const { thread } = await getThreadInfo(threadId);
await analytics.track('thread_activity', {
threadId: thread.threadId,
messageCount: thread.messageCount,
duration: new Date(thread.lastActivity) - new Date(thread.createdAt),
hasPatient: !!thread.patientId
});
}
Related Endpoints
Create Thread
Start a new conversation
Chat
Send messages to the thread
Delete Thread
Manually end the conversation
Next Steps
Learn About Conversation Threads
Comprehensive guide to thread features and best practices
Was this page helpful?

