Skip to content

Conversations ​

Conversations of conversational agents.

Conversation ​

FieldTypeDescription
iduuid
agentIduuid
externalUserIdstring | null
titlestring | nullgenerated from the first message (if enabled)
metadataobject
createdAtstring
updatedAtstringlast message

Message ​

FieldTypeDescription
iduuid
roleuser | assistant
content{ text, files?: [{id, name, mimeType}] }files sent with a user message
runIduuid | nullthe run that produced the turn
createdAtstring

Create a conversation ​

http
POST /v1/conversations

Scope: agents:run.

Body fieldTypeDescription
agentstringrequired; slug of a conversational agent
externalUserIdstring (1–200)your end user's id
metadataobjectfree-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"
}
StatusCodeWhen
400AGENT_TYPE_MISMATCHthe agent is not conversational
404NOT_FOUNDno agent with this slug
403AGENT_NOT_ALLOWEDthe key is restricted to other agents

List conversations ​

http
GET /v1/conversations?externalUserId=user_42&limit=20

Scope: runs:read. Newest first. Response: { "items": Conversation[], "nextCursor": string | null }.

QueryDescription
externalUserIdonly this end user's conversations
agentIdonly this agent's conversations
limit1 to 200, default 50
cursornextCursor 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}/messages

Scope: agents:run. Runs the agent's current published version with the message and the conversation history.

Body fieldTypeDescription
contentstring (1–1 000 000)required; the user's message
filesstring[] (≤ 20)ids of uploaded files
streambooleananswer with Server-Sent Events
HeaderDescription
Idempotency-Keyoptional, 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 }.

Hevkar public API v1