Create Thread
Conversation Threads
Create Thread
Create a new conversation thread for stateful chat sessions
POST
Create Thread
Recommended: This is the preferred way to start a conversation with the Cura AI. Threads handle context automatically.
Overview
Creates a new conversation thread with a unique 5-digit ID. Once created, you can send multiple messages to this thread and the AI will automatically remember the conversation history (last 20 messages).Authentication
string
required
Your Cura API key
Body Parameters
All parameters are optional. You can send an empty body
{} for general conversations without patient context.string (UUID)
Optional patient UUID to link this thread to a patient profile. The AI will have access to patient data.
string
Optional patient phone number (any format:
5551234567, +15551234567, (555) 123-4567).The system will automatically find the patient and link the thread.object
Optional metadata to store with the thread (e.g., session info, source, tags).
Examples:
{}- General conversation (no patient lookup) Recommended{"phone": "5551234567"}- With patient lookup{"patientId": "uuid-123"}- With patient ID
Request Example
Response
boolean
Whether the thread was created successfully
string
Unique 5-digit thread identifier (e.g.,
"82451")string (optional)
An initial question from the AI to start the conversation (e.g., demographic questions like gender). Display this message to the user immediately after thread creation to begin the conversation flow.
string (ISO 8601)
ISO 8601 timestamp when the thread will auto-delete (30 minutes from creation)
number
Initial message count (typically 0 for new threads, or 2 if initialMessage is present)
string
Success message with usage instructions
Success Response (201)
The
initialMessage field may or may not be present depending on whether the AI has an initial question. Always check for its presence and display it to the user if available.Error Responses
Thread Features
Unique 5-Digit ID
Each thread gets a unique identifier that’s easy to reference and share
Auto-Expires in 30 Min
Threads automatically delete after 30 minutes of inactivity for privacy
Automatic Context
Last 20 messages auto-loaded on every request - no manual history management
Patient Linking
Optional patient linking gives AI access to medical information
Usage Flow
1
Create Thread
Make this request to get a
threadId2
Save Thread ID
Store the
threadId on your client (localStorage, state, session, etc.)3
Send Messages
Use the
threadId in your chat requests4
Continue Conversation
Keep using the same
threadId - context is automatic!Best Practices
Create threads at session start
Create threads at session start
When a user opens your app or starts a new conversation, create a thread immediately:
Link to patients when available
Link to patients when available
If you have patient information, include it for better AI context:
Use metadata for tracking
Use metadata for tracking
Store useful information in metadata for analytics:
Handle expiration gracefully
Handle expiration gracefully
Monitor
expiresAt and create new threads when needed:Related Endpoints
Chat
Send messages to the thread
Get Thread
Retrieve thread information
Delete Thread
Manually end a conversation
Next Steps
Learn About Conversation Threads
Comprehensive guide to using threads effectively

