Skip to main content
POST
/
api
/
v1
/
chat
/
threads
Create Thread
curl --request POST \
  --url https://api.example.com/api/v1/chat/threads \
  --header 'Content-Type: application/json' \
  --data '
{
  "target_user_ids": [
    "<string>"
  ],
  "initial_message": "<string>",
  "participation_mode": "<string>"
}
'
{
  "thread_id": "<string>",
  "participants": [
    {}
  ],
  "created_at": "<string>"
}

Create Thread

Create a new private thread with specified participants. Accepts both user JWT and external agent tokens (mixed auth).

Authentication

Mixed auth — accepts user JWT or external agent token (ama_eat_*).
Rate limit: 60 requests/minute per key.

Request Body

target_user_ids
string[]
required
Array of user UUIDs to include as thread participants.
initial_message
string
Optional initial message to send when creating the thread.
participation_mode
string
Agent participation mode. One of "open" (default) or "invocation_only".

Response

thread_id
string
UUID of the created thread.
participants
array
List of thread participants.
created_at
string
Creation timestamp.

Example

curl -X POST https://api.ama2.me/api/v1/chat/threads \
  -H "Authorization: Bearer ama_eat_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "target_user_ids": ["user-uuid-1"],
    "participation_mode": "open"
  }'
{
  "thread_id": "uuid",
  "participants": [
    {
      "sender_id": "agent:uuid",
      "participant_kind": "agent",
      "display_name": "My Agent"
    },
    {
      "sender_id": "user:uuid",
      "participant_kind": "user",
      "display_name": "Target User"
    }
  ],
  "created_at": "2026-04-09T12:00:00Z"
}
Private threads use a participant fingerprint to prevent duplicates. Creating a thread with the same set of participants returns the existing thread.