Questions and approvals API
Kheish exposes approvals and structured user questions as first-class suspended-run states. These endpoints do not create unrelated work. They resume runs that are waiting.Endpoint inventory
List pending user questions:GET /v1/questionsGET /v1/sessions/{session_id}/questions
POST /v1/sessions/{session_id}/approvalsPOST /v1/sessions/{session_id}/questionsPOST /v1/sessions/{session_id}/approval-runs
POST /v1/runs/{run_id}/approvalsPOST /v1/runs/{run_id}/questions
Which endpoint should you use?
Use the session-scoped endpoints when you already operate in a session workflow and want the result projected back onto the session surface. Use the run-scoped endpoints when you already have a concrete suspendedrun_id and want a detached resume handle.
Behavior difference:
POST /v1/sessions/{session_id}/approvals- returns an updated
SessionView
- returns an updated
POST /v1/sessions/{session_id}/questions- returns an updated
SessionView
- returns an updated
POST /v1/sessions/{session_id}/approval-runs- returns
202 Acceptedplus a detachedRunView
- returns
POST /v1/runs/{run_id}/approvals- returns
202 Acceptedplus a detachedRunView
- returns
POST /v1/runs/{run_id}/questions- returns
202 Acceptedplus a detachedRunView
- returns
List pending user questions
GET /v1/questions supports:
session_id
GET /v1/sessions/{session_id}/questions is the session-scoped equivalent.
The response is a list of PendingQuestionView objects:
session_idagent_idrun_idrequest
request is a UserQuestionRequest:
idtool_call_idquestionscreated_at_ms
idheaderquestionoptionsmulti_select
Resolve approvals
Approval endpoints accept:ApprovalResolution supports:
request_idbehaviorallowdeny
updated_inputjustificationreason
updated_input when the approver wants to modify the pending tool input before allowing it.
Resolve structured user questions
Question endpoints accept:UserQuestionResolution fields:
request_idanswersdeclinedjustification
question_idselected_option_idsfreeform_answer
Run states
These endpoints are relevant when a run enters one of these states:waiting_for_approvalwaiting_for_user_question
GET /v1/sessions/{session_id}GET /v1/runs/{run_id}
RunView:
pending_approval_idspending_question_idspending_questions
Operational notes
- Approval resolution is batch-based: send every decision you want to resolve in the current request.
- Session-scoped resume endpoints operate on the active waiting state for that session.
- Run-scoped resume endpoints are safer when multiple suspended runs could exist over time and the client wants to target one exact waiting run.
