chat

A turn: its status, Chat's reply so far (markdown), the searches it ran, and its usage and charge once finished. Poll every 5 seconds for the first minute, then every 10; turns with searches usually take 1 to 3 minutes. Not rate limited. latest reads the chat's newest turn; the response's id names it.

get/v1/chat/{chat_id}/turns/{turn_id}

Request

  • Base URL
    https://api.happenstance.ai (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Path parameters

chat_idstring required
turn_idstring required

A turn ID from POST /v1/chat or /messages, or latest for the chat's newest turn

Response

Successful Response

idstring required

The turn's id

chat_idstring required

The chat's id

status'queued' | 'running' | 'completed' | 'failed' | 'cancelled' required

queued (not started), running, completed, failed (not charged) or cancelled

stop_reason'done' | 'needs_input' | 'stopped' | 'error' nullable

Why a finished turn ended: done; needs_input (Chat asked questions and waits for the answers, see reply.questions); stopped (cancelled); error. Null while running.

started_by'message' | 'schedule'

message: a message or answers started the turn. schedule: one of the chat's scheduled tasks ran, and nobody sent a message (only a chat started in the app has scheduled tasks).

messagestring required

The message that started the turn, or for a scheduled run the task's instruction

messagesstring[] required

Every message in the turn: the first started it, any later one was sent while it ran and joined it. A scheduled run's turn has none.

created_atstring required

When the turn started (ISO 8601)

completed_atstring nullable

When the turn finished (ISO 8601)

last_activity_atstring nullable

When Chat last made progress on the turn (a reply, a search starting or finishing). A running turn with no progress for several minutes is stuck or slow and can be cancelled.

elapsed_secondsinteger required

Seconds since the turn started, or how long it took once finished

next_turn_idstring nullable

The chat's next turn, once one was started

Changes