Skip to main content
POST
/
api
/
v2
/
sessions
/
{id}
/
messages
Send messages
curl --request POST \
  --url https://agp.eu.hcompany.ai/api/v2/sessions/{id}/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "<string>",
  "message": "<string>",
  "images": [
    {}
  ],
  "caller_id": "<string>",
  "messages": [
    {}
  ]
}
'
Sends one or more messages to a live agent session. Use this to provide additional instructions, answer agent questions, or redirect the task. Returns 202 Accepted. The message is delivered asynchronously: the agent processes it on its next reasoning step.

Path parameters

id
string
required
The session ID.

Request body

The body is a discriminated union: send either a single message or a batch.

Single message

type
string
required
Must be "user_message".
message
string
required
The message content.
images
array
Optional list of base64 data URIs to attach to the message (e.g. data:image/png;base64,...).
caller_id
string
Identifies the message sender. Defaults to user; leave it unset for normal user input.

Batch

type
string
required
Must be "batch".
messages
array
required
Array of message objects, each with type: "user_message" and message. Processed in order.

Examples

Send a single message

curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer $H_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "user_message",
    "message": "Focus on hotels near Kiyomizu-dera temple, under $200/night"
  }'

Send a batch of messages

curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer $H_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "batch",
    "messages": [
      {"type": "user_message", "message": "Also check availability for June 15-20"},
      {"type": "user_message", "message": "I prefer traditional ryokans over modern hotels"}
    ]
  }'

Errors

StatusCause
404Session not found, or you don’t have access.
400Invalid message format.