POST
/v1/me/ai/conversations/{id}/cancelAsks the answer being written to stop. The worker looks for the request about once a second, so the answer stops within a second or two rather than at once, and keeps the text it had written. An answer that had not started yet ends without a word and is left out of the conversation.
The answer then sends stream_end with reason cancelled and a turn_state
with status cancelled over the
websocket. Wait for
those before asking again.
cancelled is false when nothing was being written, or a stop was already
asked for. That is not an error: the answer is not running either way.
Stopping is outside the limit of twenty a minute, as on the website.
Request
curl -X POST https://api.proppertrading.com/v1/me/ai/conversations/01a16152-7e42-70cd-91a4-b6b80ee47daa/cancel \
-H "Authorization: Bearer ptat_9f2c1a44_3b8e7d2f5c9a1b4e6d8f0a2c4e6b8d1f" \
-H "Idempotency-Key: 9a3e7c15-2d4b-4e86-b0f1-6c8d2a5e7b94"
Response
{
"data": {
"object": "ai_cancellation",
"conversation_id": "01a16152-7e42-70cd-91a4-b6b80ee47daa",
"cancelled": true
},
"meta": {
"request_id": "req_01m5gn6fepe9v7vq4zf5er4xxf"
}
}
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | missing_idempotency_key | Every POST needs one |
| 400 | workspace_required | Our own staff, without a firm in Propper-Workspace |
| 403 | ai_unavailable | The firm has the assistant switched off for this chat |
| 403 | forbidden | Staff whose role does not include use_ai_chat |
| 403 | insufficient_scope | This device does not hold ai:write |
| 404 | resource_not_found | No conversation of yours with that id in this chat and this firm |