Ai streaming

Initialise a stream

POST/ai/streams/init

Creates a stream bound to a chat. Pass the returned streamId on POST /ai/chats/{ref}/messages and poll GET /ai/streams/{streamId} from a separate connection.

Note: the message POST is synchronous and won't release until the AI finishes. Polling must happen on a different connection (a separate thread / async task in your client).

X-Api-Key<token>

Issued to you when your integration is provisioned. Determines which catalogue resources are visible and which AI tools are available.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/ai/streams/init" \  -H "Content-Type: application/json" \  -d '{    "chatRef": 0  }'
{  "data": {    "streamId": "stream_69f352eb1975d",    "ref": 0,    "chatRef": 0  }}