Skip to main content
Recommended Approach: Use conversation threads for the best experience. They handle context automatically so you can focus on building great features.

Quick Integration Guide

Get up and running with the Cura AI API in just a few steps using conversation threads - the easiest way to build multi-turn conversations.

Step 1: Authentication

All API requests require authentication. Add your API key to request headers:
X-API-Key: YOUR_API_KEY
Base URL: https://app.mycura.org/api/curaLearn more about authentication.

Step 2: Create a Conversation Thread

Start by creating a thread - it acts as a container for your conversation with automatic context management.
curl -X POST "https://app.mycura.org/api/cura/threads" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "5551234567"
  }'
Response:
{
  "success": true,
  "threadId": "82451",
  "expiresAt": "2025-10-22T19:30:00.000Z",
  "message": "Thread created successfully. Use this threadId in your chat requests."
}

Step 3: Send Messages with Auto-Context

Now use the threadId to send messages. The AI automatically remembers your conversation!
# Message 1
curl -X POST "https://app.mycura.org/api/cura/chat" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "threadId": "82451",
    "message": "I have been experiencing headaches"
  }'

# Message 2 - AI remembers message 1 automatically!
curl -X POST "https://app.mycura.org/api/cura/chat" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "threadId": "82451",
    "message": "What could be causing them?"
  }'
Response:
{
  "success": true,
  "response": "Headaches can be caused by stress, dehydration, lack of sleep...",
  "threadId": "82451",
  "messageCount": 4
}
That’s it! The AI automatically maintains conversation context. No need to manually send conversation history arrays.

Why Use Threads?

Automatic Context

Server manages the last 20 messages for you - no manual history tracking

Isolated Conversations

Each thread is independent - perfect for multiple users or topics

Auto-Cleanup

Threads expire after 30 minutes of inactivity for privacy

Patient Linking

Optional patient linking gives AI medical context automatically
You can also use the chat endpoint without threads, but you’ll need to manually manage conversation history:
curl -X POST "https://app.mycura.org/api/cura/chat" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What could be causing them?",
    "conversationHistory": [
      {"role": "user", "content": "I have headaches"},
      {"role": "assistant", "content": "...previous response..."}
    ]
  }'
Manual context management is more complex and error-prone. We strongly recommend using threads instead.

Next Steps

Now that you’ve built your first conversation with threads, dive deeper:

OpenAPI Specification

Access the complete OpenAPI specification at:
https://app.mycura.org/cura/openapi.json
This can be imported into tools like Postman, Insomnia, or used to generate client libraries.