Skip to content

Chat

Chat operations in the Hlix API.

See the OpenAPI document for schemas and operation IDs.

  • Protected operations require an API key in x-api-key or a browser session cookie; some actions require a verified user session
  • Tenant-scoped operations use X-Organization-Id; browser sessions can use their active workspace. Discovery and personal-workspace bootstrap do not require an active workspace
  • The base URL for your deployment, https://server.hlix.ai by default
Method Path Operation
POST /v1/api/chat/approvals/{requestId} Answer an approval the agent asked for
POST /v1/api/chat/attachments Store a file for a chat turn to name
POST /v1/api/chat/connect Get the proof a conversation’s socket upgrade presents
GET /v1/api/chat/directory Search your private and accessible shared project conversations
GET /v1/api/chat/events Follow a conversation as Server-Sent Events
GET /v1/api/chat/messages Read a conversation’s messages, newest page first
POST /v1/api/chat/stop Stop the turn a conversation is running
POST /v1/api/chat/turns Send a message to a conversation and return while the agent works
POST /v1/api/chat/urgent Stop only the project’s recent work an urgent message contradicts
GET /v1/api/chats List the chat sessions of a conversation you may see
POST /v1/api/chats Start a chat session with an agent
PATCH /v1/api/chats/{id}/model Choose the model for your private conversation
POST /v1/api/projects/{id}/stream/connect Get the proof a project stream’s socket upgrade presents

POST /v1/api/chat/approvals/{requestId} · operation ID answerChatApproval

Parameters

Name In Required Type Description
requestId path yes string
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Request body — application/json, ConversationApproval (required)

Property Type Required Notes
approved boolean yes
chatId string yes min length 1, max length 512
reason string no max length 2000

Responses

Status Body Description
202 ConversationApprovalResult The answer is recorded and the conversation goes on from it.
400 ValidationError | ApiError The JSON body failed schema validation (ValidationError), or the request named no active organization (ApiError).
401 ApiError No valid session or API key.
403 ApiError Read-only access to this project.
404 ApiError No such conversation or request for this caller.
409 ApiError The request was already answered.

POST /v1/api/chat/attachments · operation ID uploadChatAttachment

Parameters

Name In Required Type Description
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.

Request body — multipart/form-data (required)

Property Type Required Notes
file string (binary) yes

Responses

Status Body Description
201 ChatAttachment The file is stored. artifactKey is what a later turn sends in attachments; the agent reads the bytes through its own tool (analyse an image, parse a PDF, analyse a video, transcribe audio). Audio is transcribed on the way in, so transcript carries the text the composer should show.
400 ApiError The body is not multipart/form-data, or carries no file field.
401 ApiError No valid session or API key.
402 PaymentRefusal The workspace is over a spend cap — its free monthly credit, its plan’s included usage while extra usage is not allowed for the project, or a limit it set itself. The body names which one and what to do about it, and code is the stable reason.
403 ApiError File uploads are agency-only. Audio attachments are transcribed on upload using the agency’s model budget.
404 ApiError The resource does not exist, or the caller is a task-scoped credential and this endpoint is outside its allowlist.
413 ApiError The file is over the attachment ceiling — 25 MB, or the smaller limit past which a video can no longer be analysed.
415 ApiError No agent tool can read a file of that type. The accepted set is the one the reading tools actually handle — a raster image (including HEIC/HEIF and AVIF), a PDF, audio in a transcribable format, or a video. SVG is refused as markup rather than a raster.
502 ApiError The file could not be written to object storage. Nothing was recorded and the upload is safe to retry.
503 ApiError Usage could not be verified, so new spending is paused until the meter is available. Nothing changed.

Get the proof a conversation’s socket upgrade presents

Section titled “Get the proof a conversation’s socket upgrade presents”

POST /v1/api/chat/connect · operation ID connectChatSocket

Parameters

Name In Required Type Description
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Request body — application/json, ConversationConnect (required)

Property Type Required Notes
chatId string yes min length 1, max length 512

Responses

Status Body Description
200 ConversationConnection A short-lived token for one conversation and one person, and the socket path to present it on (path?token=&from=&gen=).
400 ValidationError | ApiError The JSON body failed schema validation (ValidationError), or the request named no active organization (ApiError).
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError No such conversation for this caller.

Search your private and accessible shared project conversations

Section titled “Search your private and accessible shared project conversations”

GET /v1/api/chat/directory · operation ID listChatDirectory

Parameters

Name In Required Type Description
q query no string Search title, project or agent name. Up to 200 characters.
visibility query no string all (default), private or shared.
projectId query no string Limit shared conversations to an accessible project.
page query no string One-based page, default 1.
pageSize query no string 1–50 conversations per page, default 20.
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Responses

Status Body Description
200 ChatDirectoryResponse Matching conversations, newest first, with authorized project filters. Private conversations belong only to the signed-in user.
400 ValidationError Invalid filters.
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError The resource does not exist, or the caller is a task-scoped credential and this endpoint is outside its allowlist.

Follow a conversation as Server-Sent Events

Section titled “Follow a conversation as Server-Sent Events”

GET /v1/api/chat/events · operation ID streamChatEvents

Parameters

Name In Required Type Description
chatId query yes string The conversation’s address.
from query no string The next event the client wants; Last-Event-ID says the same after a reconnect.
gen query no string The stream generation from belongs to; a stale one starts from a snapshot.
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Responses

Status Body Description
200 string The conversation’s events: a snapshot of its messages when you join cold, then every event of the turns that follow.
400 ApiError The request named no active organization.
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError No such conversation for this caller.

Read a conversation’s messages, newest page first

Section titled “Read a conversation’s messages, newest page first”

GET /v1/api/chat/messages · operation ID listChatMessages

Parameters

Name In Required Type Description
chatId query yes string The conversation’s address.
limit query no string How many transcript entries one page holds, 1 to 200. Default 50.
before query no string The next of the page you have: read the messages before it.
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Responses

Status Body Description
200 ConversationMessages The page, oldest first. Bookkeeping entries (approvals, signals) are not messages and are not listed.
400 ValidationError The query failed validation.
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError No such conversation for this caller.

POST /v1/api/chat/stop · operation ID stopChatTurn

Parameters

Name In Required Type Description
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Request body — application/json, ConversationStop (required)

Property Type Required Notes
chatId string yes min length 1, max length 512

Responses

Status Body Description
200 ConversationStopResponse stopped is true when a turn was running and was stopped; effects of tools already executed are not undone.
400 ValidationError | ApiError The JSON body failed schema validation (ValidationError), or the request named no active organization (ApiError).
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError No such conversation for this caller.

Send a message to a conversation and return while the agent works

Section titled “Send a message to a conversation and return while the agent works”

POST /v1/api/chat/turns · operation ID sendChatTurn

Parameters

Name In Required Type Description
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Request body — application/json, ConversationSend (required)

Property Type Required Notes
addressAgent boolean no
attachments object[] no
chatId string yes min length 1, max length 512
context object no
message string yes min length 1, max length 100000
messageId string (uuid) no
mode wait | now | stop_first no

Responses

Status Body Description
202 ConversationReceipt The message is in the conversation and, unless it named only people (delivered: "thread"), the agent is answering it. The turn runs to completion on the server whether or not anyone is watching; read it on the conversation’s events. On a cycle’s address (project:<projectId>:cycle:<cycleId>) the message goes to that cycle’s agent, not to the project manager: it is stored in the cycle’s chat and given to the agent at work, or to the next run of the cycle.
400 ValidationError | ApiError The body failed validation.
401 ApiError No valid session or API key.
402 PaymentRefusal The workspace is over a spend cap — its free monthly credit, its plan’s included usage while extra usage is not allowed for the project, or a limit it set itself. The body names which one and what to do about it, and code is the stable reason.
403 ApiError Read-only access to this project: reading is allowed, asking the agent is not.
404 ApiError No such conversation for this caller.
409 ApiError The conversation belongs to the sample project, which takes no work.
503 ApiError Usage could not be verified, so new spending is paused until the meter is available. Nothing changed.

Stop only the project’s recent work an urgent message contradicts

Section titled “Stop only the project’s recent work an urgent message contradicts”

POST /v1/api/chat/urgent · operation ID checkUrgentChatMessage

Parameters

Name In Required Type Description
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.

Request body — application/json, ChatUrgent (required)

Property Type Required Notes
content string yes min length 1, max length 20000
projectId string (uuid) yes

Responses

Status Body Description
200 ChatUrgentResponse The cycles stopped because the message contradicts them; empty when it contradicts nothing or the check could not answer. The rest of the project keeps running.
400 ValidationError | ApiError The JSON body failed schema validation (ValidationError), or the request named no active organization (ApiError).
401 ApiError No valid session or API key.
403 ApiError Read-only access to this project.
404 ApiError Project not found.

List the chat sessions of a conversation you may see

Section titled “List the chat sessions of a conversation you may see”

GET /v1/api/chats · operation ID listChats

Parameters

Name In Required Type Description
chatId query yes string The conversation’s address, or one of its sessions’.
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Responses

Status Body Description
200 ConversationChats The conversation’s default chat and the sessions you may see: your own private ones and the shared ones.
400 ApiError The request named no active organization.
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError No such conversation for this caller.

POST /v1/api/chats · operation ID createChat

Parameters

Name In Required Type Description
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Request body — application/json, ConversationChatCreate (required)

Property Type Required Notes
chatId string yes min length 1, max length 512
id string (uuid) yes
private boolean no

Responses

Status Body Description
201 ConversationChatCreated The session exists from its first message. Every extra chat is private to the person who starts it.
400 ValidationError | ApiError The body failed validation, or asked for a shared extra chat.
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError No such conversation for this caller.

Choose the model for your private conversation

Section titled “Choose the model for your private conversation”

PATCH /v1/api/chats/{id}/model · operation ID setPrivateChatModel

Parameters

Name In Required Type Description
id path yes string
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.

Request body — application/json, ConversationModel (required)

Property Type Required Notes
model string | null yes

Responses

Status Body Description
200 PrivateChatModelResponse Saved catalog model or null for the workspace default.
400 ValidationError | ApiError Invalid body or unavailable catalog model.
401 ApiError No valid session or API key.
403 ApiError Agency membership required.
404 ApiError Private session not found.

Get the proof a project stream’s socket upgrade presents

Section titled “Get the proof a project stream’s socket upgrade presents”

POST /v1/api/projects/{id}/stream/connect · operation ID connectProjectStream

Parameters

Name In Required Type Description
id path yes string
X-Organization-Id header no string The workspace (organization) to act in. Omitted, the session’s active organization is used.
X-Client-Portal header no string The agency Workspace ID for a signed-in client’s portal requests. A verified user session and portal membership are required; API keys cannot authenticate portal access. This header does not grant agency administration access.

Responses

Status Body Description
200 ConversationConnection A short-lived token for one project and one person, and the socket path to present it on. The stream carries the project’s loop, its cycles’ stages and its files changing; a client collaborator reads the copy that passed its fence.
400 ApiError The request named no active organization.
401 ApiError No valid session or API key.
403 ApiError Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project.
404 ApiError Project not found, or not reachable by this caller.

The response table for each operation lists its documented errors. Common status codes include:

  • 400 — the body failed schema validation, or the request named no active organization. A ValidationError body carries the failing fields; an ApiError body carries only error.
  • 401 — no valid session or API key.
  • 403 — authenticated, but not a member of the named organization, or a client collaborator without the required access.
  • 404 — check the resource ID and your access to the selected Workspace.
  • 409 — the expected revision or state is stale, or another operation currently owns the transition.
  • 500 — the operation failed server-side. Retry only where an idempotency key makes that safe.