Chat
Dax answers visitors from the catalog, word by word. Server-Sent Events or WebSocket.
Ask Dax a question and watch the answer stream. Follow-ups keep the conversation. Code has the request and every frame the API sent.
Ask me about mpechicago.com's products. I can help with:
Two ways to connect
POST /v1/chat (Server-Sent Events) | wss://api.indax.net/v1/chat (WebSocket) | |
|---|---|---|
| Best for | Servers, one-off turns, the playground above | A chat window in the browser |
| Auth | Authorization: Bearer header | key in the first hello frame |
| Follow-ups | Send conversation_id (from done or the x-conversation-id header) | Same socket; send another message |
Both send the same objects, in this order: status (searching), one or more results, status (answering), many delta, then done. An error can replace any of them and ends the turn.
Request (POST)
| Field | Type | What it does |
|---|---|---|
text | string, ≤2,000 chars, required | The visitor's message. Send only the new message; the server keeps the history. |
domain | string | The company Dax answers about. Default: your own. |
conversation_id | string | Continue a conversation: from done, or the x-conversation-id response header. |
options.length | short standard detailed | Default: your setting in the Indax app. |
options.language | e.g. es, de, ja | Default: the visitor's language. |
context | object | See Page context. |
instructions | string, ≤500 chars | Server-only keys: a note for this turn, e.g. "returning customer". |
What comes back
| Object | Fields | Meaning |
|---|---|---|
status | state | searching (Dax is looking things up), then answering (the text is about to stream). Optional to show. |
results | items[]: id, type, title, url, image, snippet | Pages and products Dax found. Can arrive several times in one turn, each with new items only (no repeats): append them. Show as cards or links. |
delta | text | The next piece of the answer. Append it, as plain text or Markdown with HTML off. |
done | conversation_id, credits_used, timing | The turn is over. timing in ms: first_frame_ms, first_results_ms, first_token_ms, total_ms. |
error | code, message | message is safe to show the visitor. |
WebSocket
| You send | When |
|---|---|
hello { key, domain?, conversation_id?, context? } | First, within 10 s. Use a key that allows your website. |
message { text, options?, context? } | After ready, one at a time (wait for done). |
context { context } | The visitor moved to another page. |
abort | Stop the current answer. |
ready returns conversation_id (store it in sessionStorage and send it in hello after a reload), plus the greeting and suggested_questions your admins set, for your chat window.
| Close code | Meaning |
|---|---|
4401 | Missing, invalid or revoked key. |
4403 | This website is not on the key's allowed websites. |
4402 | Credits used up. Show a contact link. |
4404 | domain is not on the Indax network. |
4400 | A frame was not valid JSON. |
Any other close: reconnect after 2 s with the same conversation_id.
Steer Dax
Try it above: Steer opens length, language and instructions.
| Where | What you set | Applies to |
|---|---|---|
| Portal › Dax in the Indax app | Tone, answer length, hand-off to sales (and the link), topics to avoid, extra instructions (up to 1,000 characters), greeting, suggested questions | Every chat about your own company, on your portal and through the API |
options on a message | length, language | That message |
instructions on a message | A note for this turn, up to 500 characters: who the visitor is, what to offer, how long to answer | That message. Server-only keys only: a website key's instructions are ignored, because anyone can read a key in page code. |
Indax's own rules always come first, then your Portal settings, then instructions, then the visitor's message. Steering changes how Dax answers, never what it may read or claim: it answers only from the company's catalog and website, links the page it used, and never invents a product, spec, price or certification, or promises stock or lead times.