Cancel a session
niche_session_cancelCancel a running session. Marks status=failed with an error_message ('cancelled by user' or the caller's reason), and stops the in-flight orchestrator if any.
Used when you want to free a slot under the concurrent-session cap without deleting the session (history and audit trail preserved). Use the REST DELETE endpoint if you want a hard archive cleanup that also wipes outputs.
Idempotent: cancelling a completed / already-failed session returns its current state unchanged.
Credits: the unused hold is released; work already committed (e.g. the discovery for a story you picked) stays charged, so cancelling does not refund committed work. A pre-CP1 cancel (nothing committed yet) is effectively free. A full refund applies only to an actual run failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | No | Optional. Surfaced as session.error_message. | |
| session_id | Yes |