The assistant API

Your server talks to an assistant with an App server key (vxa_…), sent as a bearer token. Each conversation is also a room on the host, so people can read along and step in.

Start a conversation

POST /v1/api/conversations
Authorization: Bearer vxa_…
Content-Type: application/json

{ "user": "customer-1842", "name": "Ana Pérez", "metadata": { "plan": "gold" } }

→ 201 { "conversation": "c_…" }. user is your own id for the person (the same user continues their conversation); name is how it shows in the room; metadata is kept with it.

Send a message

POST /v1/api/conversations/{id}/messages
Authorization: Bearer vxa_…

{ "text": "Where is my order 1042?", "wait": 60 }
  • "wait": N (up to 120 seconds) answers with the reply: { "message": {…}, "reply": {…} }. If the assistant takes longer, reply is null — read it later.
  • "stream": true answers as Server-Sent Events: message (yours), then delta { text } as the reply is written, then done { reply } — or error { key }.
  • Without either, the message is posted and the call returns at once.
const r = await fetch(`${HOST}/v1/api/conversations/${id}/messages`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.VEXYLINE_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ text, stream: true }),
});
for await (const chunk of r.body) process.stdout.write(new TextDecoder().decode(chunk));

Read messages

GET /v1/api/conversations/{id}/messages?after=SEQ

→ { "messages": [{ seq, role, text, name, createdAt, … }] } — role is user (your side), assistant, or agent (a person from your team, with their name). Keep the last seq you saw and ask for what came after it — this is also how you receive what a person wrote in the room.

People and the assistant

When someone from your team writes in the conversation's room, the visitor sees it and the assistant stays quiet for 30 minutes. With people answer first on the key, the assistant answers only when asked by name.

Errors

Errors are JSON: { "code": "invalid" | "forbidden" | "not_found" | "rate_limited" …, "key": "server.…", "message": "…" }. A revoked or wrong key is 401.