API referenceConversations

Follow moments in real time

GET
/conversations/{id}/stream

Sends the conversation's moments as server-sent events, those already let go first, then conversation.ended once the ended conversation's last moment has gone. Each event's id resumes the stream after it when sent back as Last-Event-ID.

Authorization

apiKey
X-API-Key<token>

API key (prefix spk_test_ or spk_live_) or personal access token (prefix pat_)

In: header

Path Parameters

id*string

Conversation ID

Header Parameters

Last-Event-Id?string

The id of the last event received, to resume after it

Response Body

text/event-stream

application/json

curl -X GET "https://example.com/conversations/cnv_2jxsy8cc8v0348asy6t1/stream"
[  {    "data": {      "created_at": "2019-08-24T14:15:22Z",      "data": {        "conversation": {          "created_at": "2019-08-24T14:15:22Z",          "ended_at": "2019-08-24T14:15:22Z",          "environment": "test",          "id": "cnv_2jxsy8cc8v0348asy6t1",          "metadata": {            "property1": null,            "property2": null          },          "moment_types": [            "string"          ],          "moments_count": 0,          "organization_id": "string",          "origin": "api",          "progress": {            "turns_done": 0,            "turns_total": 0          },          "started_at": "2019-08-24T14:15:22Z",          "status": "live",          "tenant_id": "string",          "title": "string",          "updated_at": "2019-08-24T14:15:22Z",          "usage": {            "metered_seconds": 126,            "transcription_seconds": 30.5          },          "webhook": {            "id": "whs_2jxsy8cc8v0348asy6t1",            "url": "string"          }        },        "reason": "requested",        "summary": {          "duration_s": 0.1,          "moments_by_kind": {            "property1": 0,            "property2": 0          },          "moments_count": 0,          "turns_count": 0        }      },      "id": "evt_2jxsy8cc8v0348asy6t1",      "livemode": true,      "object": "event",      "type": "conversation.ended"    },    "event": "conversation.ended"  }]