Stream a reply
curl --request POST \
--url https://backend.drivehealth.ai/api/v1/chat/message/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f",
"message": "What time is my appointment?"
}
'import requests
url = "https://backend.drivehealth.ai/api/v1/chat/message/stream"
payload = {
"chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f",
"message": "What time is my appointment?"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chat_id: '9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f',
message: 'What time is my appointment?'
})
};
fetch('https://backend.drivehealth.ai/api/v1/chat/message/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));data: {"chunk": "Your appointment is ", "chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"}
data: {"chunk": "on Thursday at 2pm.", "chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"}
data: {"done": true, "chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"}
Chat
Stream a reply
Send a message and receive the caregiver’s reply as server-sent events, one JSON object per data: frame. The credential and the chat’s ownership are checked before the stream opens, so a refused request gets an ordinary error response rather than a stream. Once the stream is open, only model failures appear inside it, as {"error": "LLM error", "chat_id": "..."} followed by the end of the stream. The transcript is written when the stream completes; a client that abandons the stream leaves the turn unrecorded.
POST
/
api
/
v1
/
chat
/
message
/
stream
Stream a reply
curl --request POST \
--url https://backend.drivehealth.ai/api/v1/chat/message/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f",
"message": "What time is my appointment?"
}
'import requests
url = "https://backend.drivehealth.ai/api/v1/chat/message/stream"
payload = {
"chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f",
"message": "What time is my appointment?"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chat_id: '9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f',
message: 'What time is my appointment?'
})
};
fetch('https://backend.drivehealth.ai/api/v1/chat/message/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));data: {"chunk": "Your appointment is ", "chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"}
data: {"chunk": "on Thursday at 2pm.", "chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"}
data: {"done": true, "chat_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"}
Authorizations
organizationBearerorganizationApiKey
An organization API key starting with dh_, sent as Authorization: Bearer dh_your_api_key.
Body
application/json
Response
A stream of reply chunks that ends with a done frame.
The response is of type string.
