Skip to content

Ask Aletheia a question (streams as Server-Sent Events)

POST
/api/v1/ai/conversations/{id}/messages
curl --request POST \
--url https://api.aletheia-ops.com/api/v1/ai/conversations/example/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "content": "example" }'

Streams the answer as Server-Sent Events rather than returning JSON. The response is text/event-stream, with a heartbeat comment roughly every fifteen seconds so intermediaries do not close an idle connection.

Only one turn may be in flight per conversation; a second concurrent request on the same conversation returns 409 turn_in_progress.

Treat unknown event names as ignorable, and do not treat stream end as success — only a completion event means the answer finished. OpenAPI cannot usefully describe an event stream, so the full protocol is documented at https://docs.aletheia-ops.com/api/streaming/

id
required
string
Media typeapplication/json

A question for the assistant.

object
content
required
string
Examplegenerated
{
"content": "example"
}

An event stream. Read it incrementally; it does not complete until the answer is finished.

Media typetext/event-stream
string

The request is malformed or fails validation.

Media typeapplication/json
object
code
required

Stable, machine-readable identifier. Branch on this.

string
message
required

Human-readable explanation. Safe to display; do not parse.

string
Examples
{
"code": "validation_failed",
"message": "name: must not be blank"
}

No valid credential was presented, or it has expired.

Media typeapplication/json
object
code
required

Stable, machine-readable identifier. Branch on this.

string
message
required

Human-readable explanation. Safe to display; do not parse.

string
Examples
{
"code": "unauthorized",
"message": "authentication required"
}

Authenticated, but not permitted to perform this action.

Media typeapplication/json
object
code
required

Stable, machine-readable identifier. Branch on this.

string
message
required

Human-readable explanation. Safe to display; do not parse.

string
Examples
{
"code": "forbidden",
"message": "you do not have permission to perform this action"
}

The resource does not exist, or belongs to another organization. The two are deliberately indistinguishable.

Media typeapplication/json
object
code
required

Stable, machine-readable identifier. Branch on this.

string
message
required

Human-readable explanation. Safe to display; do not parse.

string
Examples
Examplenot_found
{
"code": "not_found",
"message": "resource not found"
}

The request conflicts with the current state.

Media typeapplication/json
object
code
required

Stable, machine-readable identifier. Branch on this.

string
message
required

Human-readable explanation. Safe to display; do not parse.

string
Examples
{
"code": "email_taken",
"message": "an account with this email already exists"
}

An unexpected failure. Diagnostic detail is logged server-side and deliberately not returned. Quote the X-Request-Id response header when reporting one.

Media typeapplication/json
object
code
required

Stable, machine-readable identifier. Branch on this.

string
message
required

Human-readable explanation. Safe to display; do not parse.

string
Examples
Exampleinternal_error
{
"code": "internal_error",
"message": "internal server error"
}