Appearance
Conversations
Conversations of conversational agents.
Conversation
| Field | Type | Description |
|---|---|---|
id | uuid | |
agentId | uuid | |
externalUserId | string | null | |
title | string | null | generated from the first message (if enabled) |
metadata | object | |
createdAt | string | |
updatedAt | string | last message |
Message
| Field | Type | Description |
|---|---|---|
id | uuid | |
role | user | assistant | |
content | { text, files?: [{id, name, mimeType}] } | files sent with a user message |
runId | uuid | null | the run that produced the turn |
createdAt | string |
Create a conversation
http
POST /v1/conversationsScope: agents:run.
| Body field | Type | Description |
|---|---|---|
agent | string | required; slug of a conversational agent |
externalUserId | string (1–200) | your end user's id |
metadata | object | free-form data |
Response 201: Conversation.
json
{
"id": "c3a1e2f0-…",
"agentId": "…",
"externalUserId": "user_42",
"title": null,
"metadata": { "plan": "pro" },
"createdAt": "2026-11-21T10:15:00.000Z",
"updatedAt": "2026-11-21T10:15:00.000Z"
}| Status | Code | When |
|---|---|---|
| 400 | AGENT_TYPE_MISMATCH | the agent is not conversational |
| 404 | NOT_FOUND | no agent with this slug |
| 403 | AGENT_NOT_ALLOWED | the key is restricted to other agents |
List conversations
http
GET /v1/conversations?externalUserId=user_42&limit=20Scope: runs:read. Newest first. Response: { "items": Conversation[], "nextCursor": string | null }.
| Query | Description |
|---|---|
externalUserId | only this end user's conversations |
agentId | only this agent's conversations |
limit | 1 to 200, default 50 |
cursor | nextCursor of the previous page |
ts
const page = await hevkar.conversations.list({ externalUserId: 'user_42', limit: 20 });Get a conversation
http
GET /v1/conversations/{id}Scope: runs:read. Response: Conversation with messages: Message[] (oldest first).
json
{
"id": "c3a1e2f0-…",
"agentId": "…",
"externalUserId": "user_42",
"title": "Wrong invoice amount",
"metadata": {},
"createdAt": "2026-11-21T10:15:00.000Z",
"updatedAt": "2026-11-21T10:16:02.000Z",
"messages": [
{
"id": "…",
"role": "user",
"content": { "text": "My invoice is wrong" },
"runId": "…",
"createdAt": "…"
},
{
"id": "…",
"role": "assistant",
"content": { "text": "Sorry about that…" },
"runId": "…",
"createdAt": "…"
}
]
}Errors: 404 CONVERSATION_NOT_FOUND, 403 AGENT_NOT_ALLOWED.
Send a message
http
POST /v1/conversations/{id}/messagesScope: agents:run. Runs the agent's current published version with the message and the conversation history.
| Body field | Type | Description |
|---|---|---|
content | string (1–1 000 000) | required; the user's message |
files | string[] (≤ 20) | ids of uploaded files |
stream | boolean | answer with Server-Sent Events |
| Header | Description |
|---|---|
Idempotency-Key | optional, 1 to 200 characters; see Idempotency |
Response 200: RunResult with output: { text } and conversationId, or an event stream. A repeated Idempotency-Key replays the first message's run instead of sending the message again (409 IDEMPOTENCY_KEY_REUSED for a different message). There is no async mode on this route; use runs with conversationId for that.
bash
curl "$HEVKAR_BASE_URL/v1/conversations/$CONVERSATION_ID/messages" \
-H "Authorization: Bearer $HEVKAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Where is my order?"}'ts
const reply = await hevkar.conversations.send(conversationId, { content: 'Where is my order?' });Errors: as for running an agent (input, files, guardrails, quota), plus 404 CONVERSATION_NOT_FOUND and 409 AGENT_NOT_PUBLISHED.
Delete a conversation
http
DELETE /v1/conversations/{id}Scope: agents:run. Deletes the conversation and its messages; the runs keep their own record. Response 200: { "deleted": true }.