Skip to main content
GET
https://app.mycura.org
/
api
/
cura
/
threads
/
{id}
Get Thread Info
curl --request GET \
  --url https://app.mycura.org/api/cura/threads/{id} \
  --header 'X-API-Key: <x-api-key>'
{
  "error": "Thread not found or expired"
}

Overview

Retrieves detailed information about a conversation thread, including message count, patient linkage, activity timestamps, and expiration status.

Authentication

X-API-Key
string
required
Your Cura API key

Path Parameters

id
string
required
The 5-digit thread ID (e.g., 82451)

Request Example

curl -X GET "https://app.mycura.org/api/cura/threads/82451" \
  -H "X-API-Key: YOUR_API_KEY"

Response

success
boolean
Whether the request was successful
thread
object
Thread information object

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"
}

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://app.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://app.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

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 });
  }
}
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!`);
  }
}
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
  });
}

Next Steps

Learn About Conversation Threads

Comprehensive guide to thread features and best practices