Skip to Content

Compliance

The audit log, what gets masked in your call data, and how someone gets at the unmasked version.

Three things here: the audit log of who did what, the masking applied to stored call data, and the break-glass workflow for reading it unmasked.

Audit log

GET /audit-log returns durable events newest first — event ID, timestamp, actor identity (nullable: system and agent actions have no human actor), action, resource identity, client IP, request/session correlation, sanitized metadata. Rows survive call purge.

curl 'https://api.kejue.co/v1/audit-log?actor=api_key&action=agent.deploy&limit=50' \
  -H "Authorization: Bearer $KEJUE_API_KEY"

Exact filters, AND-combined: action, resource_kind, resource_id, actor=user|api_key|system|agent|eval, user_id, api_key_id, request_id, session_id, client_ip, via=oauth|none, oauth_grant_id, created_from (inclusive), created_to (exclusive), and q — case-insensitive over action, resource identity, actor identity, connected-app name, request ID, and client IP. Time bounds accept RFC 3339 or YYYY-MM-DD (midnight UTC). limit is 1–200, default 50; cursors follow the pagination contract and are rejected (400 invalid_query_parameter, details.reason: "invalid_cursor") when reused across a different path or filter set.

When someone acts through a connected app such as Claude, the event still names the person and adds a via object: kind: "oauth", the app's client_name, and the connection's grant_id. Read it as "Alex via Claude". via is null for direct actions. via=oauth returns only connected-app events, via=none only direct ones, and oauth_grant_id narrows to one connection.

GET /audit-log/actors returns the trail's distinct principals, most recently active first — a complete "filter by actor" source. Feed email back as actor_email, or api_key_id as api_key_id; truncated: true means more actors exist. A person who also acted through a connected app appears once more per connection, with via set — pass its via.grant_id as oauth_grant_id.

Both operations need audit-log:read plus the audit_log_export entitlement.

PII masking dictionary

Masking is a per-workspace switch: pii_masking on the workspace — new workspaces start with it off. While it is enabled, the built-in entities SSN, CREDIT_CARD, EMAIL, PHONE, DOB, POLICY_NUMBER, MRN, and ACCOUNT_NUMBER are always masked — a floor that cannot be removed or renamed. The dictionary adds vocabulary on top; it never grants permission to unmask (that's break-glass, below). While masking is disabled, neither is applied to new calls.

GET /pii-redaction-config returns the built-ins, your custom_entities, version, nullable updated_at, and an ETag. Before the first save you get a virtual default: empty list, version 0, updated_at: null.

PUT /pii-redaction-config replaces the complete custom list — not a patch, so send custom_entities even when the intended result is empty.

curl -X PUT https://api.kejue.co/v1/pii-redaction-config \
  -H "Authorization: Bearer $KEJUE_API_KEY" \
  -H "Content-Type: application/json" \
  -H 'If-Match: "pii-redaction-config-v0"' \
  -d '{
    "custom_entities": [
      {"label": "CLAIM_CODE", "terms": ["internal claim alpha", "internal claim beta"]}
    ]
  }'

A custom entity: uppercase label matching ^[A-Z][A-Z0-9_]{1,31}$ (unique, distinct from every built-in) and 1–200 non-blank literal terms, each at most 200 characters. At most 50 custom entities; body limit 3 MiB. The server trims, case-insensitively deduplicates, and sorts; a rejected literal is never copied into an error message.

Reading needs pii-config:read; replacing needs pii-config:update; both need the pii_redaction_config entitlement. A semantic no-op preserves version and ETag but is still audit-recorded.

Break-glass access to raw data

pii_access_mode on your workspace sets how much friction stands in front of an unmasked read — raw transcripts, recordings, raw tool input and output:

ModeFriction
openPermission alone suffices; still audited
reason (default)A written justification per read
approvalNothing is revealed until another member approves

The mode never changes which permission is required: pii-access:unmask still gates raw transcripts and tool I/O, calls:download-recording still gates audio.

Turning PII masking off doesn't remove this gate — raw reads still need the permission and, per mode, a reason or an approval. It removes the difference: calls recorded with masking off store the same text on the redacted and raw tracks.

In approval mode, a sensitive read without a live grant returns 403 pii_access_approval_required; details.request_status says whether the caller has no request, one pending, or one rejected, revoked, or expired.

Raising a request is a signed-in dashboard workflow, deliberately not public API — an API key has nobody to notify, so a key holding pii-access:unmask supplies a reason instead. Reviewing and deciding is fully public:

  • GET /pii-access-requests — newest-first, cursor-paginated. pii-access:approve sees every request; everyone else only their own. Server-side filters across the whole backlog: q (requester identity, reason, call ID), status, call_id, requested_by. Also returned: pending_count (workspace-wide, filter-independent) and self_decision_allowed. status is effective — an elapsed approval reports expired while staying stored as approved.
  • POST /pii-access-requests/{id}/decision — decision (approve or reject) plus an optional note the requester receives. Approval grants standing access to the whole call — transcript, recordings, raw tool I/O, per-turn audio — one decision per investigation, no new request to return later. The lifetime is stamped at decision time from the workspace's pii_access_grant_days (0 = never expires); shortening the setting later never cuts an existing grant short.
  • POST /pii-access-requests/{id}/revoke — withdraws a granted approval; the next sensitive read is refused, past reads stay in the audit log. Only a live approval can be revoked; anything else returns 409 pii_access_request_not_actionable.
curl -X POST https://api.kejue.co/v1/pii-access-requests/$REQUEST_ID/decision \
  -H "Authorization: Bearer $KEJUE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: decide-request-7f3a-01" \
  -d '{"decision": "approve", "note": "for the Q3 dispute only"}'

Approving your own request returns 403 pii_access_self_decision_forbidden whenever another member holds pii-access:approve. The one exception — a workspace whose only approver is the requester — is reported by self_decision_allowed, and such a decision is recorded as self-approved on the request and on every read it authorizes.

Listing needs pii-access:read; deciding and revoking need pii-access:approve. Holding pii-access:approve does not confer pii-access:unmask — an approver signs off without gaining access, which is why built-in admin can empty the queue while only owner reads raw PII by default. Every read a grant authorizes writes its own audit event, carrying the mode it ran under and the authorizing request.

PUT /calls/{id}/legal-hold freezes a call against manual and retention purge until lifted. Needs calls:legal-hold plus the legal_hold entitlement; mechanics on the calls page.

See Errors, conditional requests, and the API reference.

On this page