Skip to content

Home > @opengovsg/logging > ApiUsageAudit

ApiUsageAudit interface ​

API usage audit events (category apiUsage).

Covers API token lifecycle and access to sensitive endpoints. These run on machine/bearer-token requests that often have no authenticated user, so userId is optional throughout — supply it only when the token is user-bound. Anomaly/abuse detection is intentionally absent — the app does not know a call is anomalous at log time; that is a sink/SIEM concern *over* these lines (ADR-0007).

Signature:

typescript
export interface ApiUsageAudit

Methods ​

MethodDescription
sensitiveEndpointAccessed(input)A sensitive endpoint was accessed. Fires at notice.
tokenInvalidated(input)An API token was invalidated/revoked. Fires at notice.
tokenIssued(input)An API token was issued. Fires at notice.
tokenRefreshed(input)An API token was refreshed. Fires at notice.