Send Message

POST
/v1/sessions/{session_id}/messages

Not available yet. This operation is part of the published contract and answers 501 not_implemented until it is built. The request and response shapes below are final for this contract version.

Send a message. The response streams the run as stream events until it ends or pauses.

Authorization

HTTPBearer
headerAuthorizationBearer <token>

Bearer credential. API keys look like sqk_<geo>_<key_id>_<secret>: treat them as opaque and never put one in a browser. Older keys without the geo part stay valid until rotated. Find a geo's endpoints through GET /.well-known/sparq-discovery before sending a key.

Path Parameters

session_id*Session Id
Formatuuid

Header Parameters

Sparq-Workspace?string

For a person signed in to a console with several workspaces: the workspace this call is for, one of their memberships (listMyMemberships). Without it such a person gets workspace_required (400); a workspace they are not a member of is forbidden. It never grants anything, and other callers' credentials ignore it.

Formatuuid
Idempotency-Key?string

Makes a retry safe: the same key, route and body within 24 hours returns the stored response and the same result id. The same key with a different body or route is idempotency_conflict; while the first request runs, idempotency_in_progress.

Length8 <= length <= 128

Request Body

application/json
  1. body

Body of POST /v1/sessions/{session_id}/messages. The response is a stream.

text*Text
Length1 <= length <= 100000
features?
idempotency_key?|null

Response Body

A stream of stream events: each is an id: <seq> line and a data: <JSON> line.

text/event-stream
  1. response

One stream event, discriminated by type.

seq*Seq

Position in the run's stream; the SSE id.

Range0 <= value
run_id*Run Id
Formatuuid
at*At
Formatdate-time
type?Type
Default"run_started"
agent*
release_id*Release Id
Formatuuid
session_id*|null
Example Request
curl -X POST 'http://dev-sparq.centralindia.cloudapp.azure.com:8000/v1/sessions/497f6eca-6276-4993-bfeb-53cbbbba6f08/messages' \  -H 'Content-Type: application/json' \  -d '{  "text": "string"}'
Example Response
{  "seq": 0,  "run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec",  "at": "2019-08-24T14:15:22Z",  "type": "run_started",  "agent": {    "name": "string",    "version": "1.4.0"  },  "release_id": "51d53377-463c-43a4-a864-f9b3ed9178de",  "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82"}