Skip to main content

Administration: usage and sandboxes

The usage report and the running sandboxes. Administrators only.

OperationMethod and path
Usage reportGET /api/v1/admin/usage
The running sandboxesGET /api/v1/admin/sandboxes
Stop an idle sandboxPOST /api/v1/admin/sandboxes/{conversation_id}/stop

Usage report​

GET /api/v1/admin/usage

Relayed-request usage by day, user or route over an inclusive UTC date range (at most 92 days apart, ending no later than tomorrow). Day reports include days without requests; user and route reports are ranked by prompt plus completion tokens, at most 200 rows, with truncated=true when more exist. Totals cover the whole range. Administrators only; a session or a personal token. Route rows are labelled with the route's display name when it has one.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
fromquerystring (date)First day, UTC. Defaults to 29 days before to.
toquerystring (date)Last day, UTC. Defaults to today.
groupquery"day", "user", "route"
comparequery"previous"previous: also total the equal-length period that ends the day before from (previous_from, previous_to, previous).

Responses

StatusMeaningBody
200The reportAdminUsageReport
400Invalid parameter (see details)Error
401Authentication requiredError
403Not an administratorError
503Database unavailable or gateway restartingError

The running sandboxes​

GET /api/v1/admin/sandboxes

Every running sandbox with its owner, environment, state, size and measured use, the install's limits and totals, and what the sweeps left behind (the Sandboxes page). One consistent read of the records; the engine is never called, and the measured use is the sampler's last values (null until a sandbox has two samples). Nothing of a task but its id: no title, message, file, workspace, route or profile, for other people's tasks and the administrator's own alike. Ordered working, starting, stopping, then idle by soonest stop. Administrators only; a session or a personal token.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
afterquerystring (uuid)The conversation_id of the previous page's last row (next_after); a token nothing matches starts over.

Responses

StatusMeaningBody
200The listingAdminSandboxes
400Invalid parameter (see details)Error
401Authentication requiredError
403Not an administratorError
503Database unavailable or gateway restartingError

Stop an idle sandbox​

POST /api/v1/admin/sandboxes/{conversation_id}/stop

Asks the retire path to stop the task's sandbox, as an eviction does: the sandbox goes, the task keeps its files and history, its owner reads a notice (sandbox.stopped) and its next message starts a new sandbox. Only an idle sandbox with nothing waiting and no held screen is stopped; a kept-on one is stoppable. Administrators only; a session or a personal token. Idempotency-Key required: a repeat of the key replays the first answer. Audited (area sandboxes, action stop) and counted.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
conversation_idpathyesstring (uuid)The task whose sandbox to stop.
Idempotency-KeyheaderyesstringA repeat with the same key answers the first result and retires nothing twice.

Responses

StatusMeaningBody
202The stop is requested (or already on its way)AdminSandboxStop
400Missing or invalid Idempotency-Key, or an invalid idError
401Authentication requiredError
403Not an administratorError
404not_found: the task has no running sandboxError
409working: a run is going, the sandbox is starting, or a person holds its screen; work_waiting: a message is queued for itError
422The key was used with another requestError
503Database unavailable or gateway restartingError