Skip to main content
When you cancel a session, Knoq stamps a cancellation timestamp on the session record. The background workflow checks for this signal on every poll cycle and exits gracefully as soon as it detects it — typically within one poll interval (1–5 seconds). The session and its transcript are preserved; only the in-flight turn is interrupted. Cancellation is idempotent. If the session is already cancelled (or was never running), the endpoint returns { "ok": true } without error. This makes it safe to call multiple times or from multiple clients without special-casing the response.
Cancelling a session does not delete it. To remove the session and its events permanently, use the Delete Session endpoint.
POST /api/managed-agents/cancel

Request

sessionId
string
required
The ID of the session to cancel. You can obtain this from the Create Session response or the List Sessions endpoint.

Response

ok
boolean
Always true when the cancellation request is accepted.
alreadyCancelled
boolean
Present and true when the session had already been cancelled before this request. The cancellation timestamp was not updated.

Example

curl -X POST https://knoq.one/api/managed-agents/cancel \
  -H "Content-Type: application/json" \
  -H "Origin: https://knoq.one" \
  -H "Cookie: <your-session-cookie>" \
  -d '{
    "sessionId": "a3f2c1d4-e5b6-7890-abcd-ef1234567890"
  }'

Idempotent response (already cancelled)

curl -X POST https://knoq.one/api/managed-agents/cancel \
  -H "Content-Type: application/json" \
  -H "Origin: https://knoq.one" \
  -H "Cookie: <your-session-cookie>" \
  -d '{
    "sessionId": "a3f2c1d4-e5b6-7890-abcd-ef1234567890"
  }'

Errors

StatusMeaning
400The sessionId field is missing, empty, or malformed.
401The request is not authenticated. Ensure your session cookie is valid and has not expired.
404No session with the given ID was found for your user and organisation.
429Cancel burst rate limit exceeded (30 requests per minute per user). The response includes a Retry-After header.