Create or replace a saved audit-log view
/portal/v1/me/audit-viewsCreates or replaces a saved audit-log view for the calling admin, keyed on (name, surface) — re-posting the same name and surface overwrites the prior entry, while the same name may coexist across the two surfaces. filters is validated as a strict AuditQueryDto so a stored view can always be replayed by the query endpoint. Enforces a per-admin cap of 20 views summed across both surfaces; exceeding it returns 400 (audit.view_limit_exceeded). Returns 201 with the stored view.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
Request body
application/json
namestring Required Display label for the chip. Trimmed; allowed characters: letters, numbers, spaces, hyphens, underscores. 1–60 chars.
surfaceenum Required Audit-log surface the view belongs to. Uniqueness is per-`(name, surface)` so a 'Last 24h' chip can live on both tabs.
filtersobject Required Filter set snapshot — same shape as the query endpoint.
Responses
application/json
data *AuditViewResponseDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
Returned object
curl -X POST "https://auth.canopy-io.com/portal/v1/me/audit-views" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "surface": "admin", "filters": { "from": "2026-04-20T12:00:00.000Z", "to": "2026-04-20T12:00:00.000Z", "action": [ "string" ], "category": "auth", "severity": "info", "outcome": "success", "actor_id": "00000000-0000-0000-0000-000000000000", "actor_type": "string", "resource_type": "string", "resource_id": "00000000-0000-0000-0000-000000000000", "correlation_id": "00000000-0000-0000-0000-000000000000", "application_id": "00000000-0000-0000-0000-000000000000", "environment_id": "00000000-0000-0000-0000-000000000000", "q": "string", "cursor": "string", "limit": 50 } }'
{ "data": { "name": "string", "surface": "admin", "filters": {} } }
Tell us how we can improve this guide.