Amarsia
Client Usage

Conversation API

Build chat flows with memory, without building your own conversation database.

What this does

Conversation API remembers previous messages for you.

Think of it like this:

  • First message -> creates a conversation
  • You get conversation_id
  • Next messages use that same conversation_id
  • Assistant remembers context

Step 1: start a conversation

curl https://api.amarsia.com/v1/runner/YOUR_DEPLOYMENT_ID/conversation \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "content": [
      { "type": "text", "text": "Hi, I need help." }
    ]
  }'

Response

{
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Support chat",
  "content": "Sure. What do you need help with?",
  "input_tokens": 10,
  "output_tokens": 18
}

Save conversation_id. You need it for all next messages.

Step 2: send next message

curl -N https://api.amarsia.com/v1/runner/YOUR_DEPLOYMENT_ID/conversation/stream \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
    "content": [
      { "type": "text", "text": "Can you explain that in simple words?" }
    ],
    "history_limit": 5
  }'

Step 3: get messages

GET /v1/runner/conversation/{conversation_id}/messages?page=1&page_size=20

Use this when you want to render past chat in your UI.

Step 4: list conversations

GET /v1/runner/conversations?page=1&page_size=20

What is meta?

meta is optional custom labels you attach to a conversation.

Example:

{
  "meta": {
    "userId": "user_123",
    "projectId": "project_456"
  }
}

Why use it:

  • Find all chats for one user
  • Find all chats for one project
  • Organize chatbot analytics