PromQL-shaped aggregation over a single workspace's audit log
const url = 'https://your-org.evershell.ai/v1/workspaces/example/audit/stats?time_bucket=auto&metric=count';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://your-org.evershell.ai/v1/workspaces/example/audit/stats?time_bucket=auto&metric=count' \ --header 'Authorization: Bearer <token>'GET /audit/stats pinned to one workspace — the same per-scope
visibility as GET /workspaces/{id}/audit, then a workspace_id
filter.
Permissions: any of audit:read, audit:read:own,
workspace:read, workspace:read:own — the grants union the
same way as GET /workspaces/{id}/audit. Equivalent to
GET /audit/stats?filter=workspace_id=<id>; this route adds the
workspace_id filter for the caller and returns 404 for a
workspace in another org.
Same query model as GET /audit/stats: group_by,
time_bucket, bucket_by, metric, top, filter, from,
to all behave identically.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Query Parameters
Section titled “Query Parameters ”Responses
Section titled “ Responses ”OK
object
object
object
Example generated
{ "buckets": [ { "group": { "additionalProperty": "example" }, "bucket": "example", "value": 1 } ]}Invalid query (unknown dimension / bad metric grammar).
object
object
Closed-enum slug (e.g. permission_denied, validation_error, workspace_not_found)
Human-readable summary
Server-generated request id for correlating logs
Optional structured context. Validation errors land at
details.fields as a per-field map.
object
Example
{ "error": { "code": "permission_denied", "message": "caller lacks required scope", "request_id": "7f3a9c2e" }}Resource not found in the caller’s org
object
object
Closed-enum slug (e.g. permission_denied, validation_error, workspace_not_found)
Human-readable summary
Server-generated request id for correlating logs
Optional structured context. Validation errors land at
details.fields as a per-field map.
object
Example
{ "error": { "code": "permission_denied", "message": "caller lacks required scope", "request_id": "7f3a9c2e" }}