Account

Consumer-wide audit trail for the dashboard activity view

Returns the signed-in consumer's OWN audit_log slice across ALL organisations (including system-scoped rows like api_key.create / system.cron_run that carry no org_number), newest first, keyset-paginated. The browser/session-cookie sibling of GET /api/v1/company/{org}/audit (the Bearer/agent surface, which is per-org and gated on read:audit). Session-cookie auth (NOT Bearer, no scope). Cross-tenant boundary: the session-resolved consumer_id is applied as an explicit .eq('consumer_id', $1) predicate (RLS via auth.uid() cannot serve this read because api_consumers.id ≠ Supabase auth.uid()). details is auto-redacted on sensitive keys. Conditional GET supported (strong ETag, If-None-Match → 304); Cache-Control private.

get/api/v1/account/audit

Request

  • Base URL: https://www.apier.no
  • URL: https://www.apier.no/api/v1/account/audit
  • Auth: API key in cookie sb-access-token

Query parameters

limitinteger

Page size. Defaults to 25; max 100. The reader fetches limit+1 to compute has_more without a COUNT round-trip; the extra row is sliced off and only its presence surfaced via pagination.has_more.

cursorstring

Opaque HMAC-signed continuation token - the CANONICAL pagination idiom. Pass the previous response's pagination.next_cursor back verbatim; a tampered or cross-endpoint cursor is rejected with 400 CURSOR_INVALID. Cannot be combined with the legacy before/before_id tuple.

beforestring date-time

Keyset cursor — pass pagination.next_before from the previous response. Required together with before_id (the cursor is a (timestamp, id) tuple); supplying one without the other returns 400 VALIDATION_FAILED. Returns rows STRICTLY OLDER than the tuple. DEPRECATED: use the opaque cursor parameter instead; this parameter keeps working through the deprecation window (Sunset: 2027-01-31T00:00:00Z) and responses to requests using it carry Deprecation/Sunset/Link headers.

before_idstring uuid

Keyset cursor companion — pass pagination.next_before_id. The id tiebreak makes rows with identical timestamps page deterministically under concurrent writes. DEPRECATED: use the opaque cursor parameter instead; this parameter keeps working through the deprecation window (Sunset: 2027-01-31T00:00:00Z) and responses to requests using it carry Deprecation/Sunset/Link headers.

sincestring date-time

Inclusive lower bound on timestamp, RFC 3339 with timezone. If both since and until are present, since <= until (compared as instants) or the request 400s.

untilstring date-time

Inclusive upper bound on timestamp, RFC 3339 with timezone.

action'delegation.create' | 'delegation.revoke' | 'approval_token.mint' | 'approval_token.used' | 'api_key.create' | 'api_key.revoke' | 'gov_api.call' | 'registry.upsert' | 'system.cron_run' | 'privacy.dsr' | 'subscription.create' | 'subscription.delete' | 'webhook.delivered' | 'dry_run_execute' | 'risk_elevated_response' | 'risk_elevated_shadow' | 'risk_pattern_override_applied' | 'submit_mva_started' | 'submit_mva' | 'submit_mva_failed' | 'execute_authorization_failed' | 'rate_limit_blocked' | 'idempotency_replay' | 'altinn.list_acting_capacity' | 'brreg.get_company_profile' | 'write_conflict_blocked'

Closed enumeration of audit_log action identifiers — single source of truth for both response bodies and query-parameter filters on the audit-trail read surface. Mirrors AUDIT_ACTIONS Adding a new value is a one-line append HERE that propagates via $ref to every consumer. Append-only — renaming a value is a /v2 break.

Filter to one audit action. Whitelisted enum — see the shared AuditAction schema; anything outside the list 400s.

initiated_by'human' | 'agent' | 'cron' | 'system' | 'unknown'

Closed enumeration of initiated_by classifier values — single source of truth for both response bodies and query-parameter filters on the audit-trail read surface. Mirrors INITIATED_BY_VALUEShuman = write action confirmed via the X-Approval-Token UI flow. agent = self-identifying AI client OR an unattended write without approval. cron = scheduled job hitting /api/cron/* with the configured CRON_SECRET. system = reserved for future internal service-to-service calls. unknown = read verbs without other signals, plus the historical-row backfill default for pre-correlation-id rows.

Filter by initiator classification (human / agent / cron / system / unknown) — see the shared AuditInitiatedBy schema.

Headers

If-None-Matchstring

Strong ETag from a prior GET of this resource. When it matches the current state the server returns 304 Not Modified with an empty body, saving the payload.

Response

A page of the consumer's audit entries, newest first. Empty data array when the consumer has no audit rows (NEVER 404).

successtrue required

Example response

{
  "data": {
    "data": [
      {
        "org_number": "999999999"
      }
    ]
  },
  "_meta": {
    "rulebook_version": "v1.0.0",
    "source": "apier.no",
    "data_source": "Brønnøysund Enhetsregisteret + Apier Universal Rulebook",
    "schema_version": "1.0.0",
    "legal_basis": "NLOD — public registry reuse",
    "response_timestamp": "2026-04-24T12:00:00.000Z",
    "response_hash": "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
    "source_snapshot_id": "brreg-2026-04-24T02:00:00.000Z",
    "cost_nok": 0.5,
    "wallet_remaining_nok": 9.5,
    "spend_cap_remaining_nok": 12.5
  }
}

Changes

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