admin-sleep

Trigger Sleep Maintenance (admin manual run)

Manually trigger a Sleep Maintenance run for the calling admin.

Self-scoped: the run targets only contexts the admin created (matched on Context.created_by), excluding soft-deleted contexts and contexts with sleep_mode='skip'. When context_id is provided a single run is scheduled for that context; otherwise one run is scheduled per eligible context.

Returns: 202 with {"report_ids": [...]}. Phase execution happens in the background; poll GET /admin/sleep-reports/{id} for progress.

Raises: 409 SLEEP-002 if this user already has a sleep run with status='running' — the response body includes running_report_id and started_at so the UI can link to it. 404 SLEEP-003 if no eligible contexts match.

Phase 1 limitation: The 409 guard is best-effort under concurrent requests. Two simultaneous POSTs could each pass the check before either commits, resulting in overlapping batches. Acceptable for single-admin dogfooding; Phase 2 will enforce exactly-once via a unique partial index on sleep_reports(user_id) WHERE status='running'.

post/api/v1/admin/sleep/run

Request

  • Base URL: https://memory.kagura-ai.com (the document declares no server; this is the origin it was published from)
  • URL: https://memory.kagura-ai.com/api/v1/admin/sleep/run
  • Auth: none declared

Request body

context_idstring uuid nullable

Response

Successful Response

report_idsstring[] required

Changes

No recorded changes to this operation across all 1 revision of this API.