Delete the authenticated consumer's account (GDPR Article 17 erasure)
Hard-deletes the SESSION-AUTHENTICATED consumer's account: the api_consumers row plus everything that cascades from it (API keys, delegations, approval tokens, idempotency keys, saved profiles, subscriptions and their pending webhook queue), then the backing auth identity. The deletion target is ALWAYS the session-resolved consumer — a request body is never read on this path, so a body-supplied id or email is inert (the operator-run twin with an explicit target lives outside this spec at /api/admin/erase-consumer). Sequence is load-bearing: a pre-delete audit record is written first (append-only, survives the erasure), the database erasure then runs as ONE transaction via the delete_consumer_cascade RPC, and the auth identity is removed LAST — so a failure at any step can never strand a half-deleted account silently. Idempotent: deleting an already-deleted account returns a clean success (consumer_found: false), never a 500. Immutable audit records (audit_log, api_audit_log, risk_pattern_hits, webhook_deliveries and similar append-only tables) deliberately survive with a reference to the erased account for integrity; where such a record holds a NOT NULL foreign key to one of the account's API keys or subscriptions, that key/subscription row is retained in a revoked, tombstoned form (a SHA-256 hash with no personal data) rather than deleted. As the final deletion step the anonymize_consumer routine scrubs the retained references INLINE — the account's consumer id and any personal payloads on those forensic records are nulled or tombstoned so the retained rows no longer identify the account (reported by the anonymized field; the records themselves survive for legal/forensic integrity). Inline rate limit 5/hour per consumer, fail-CLOSED.
Request
- Base URL: https://www.apier.no
- URL: https://www.apier.no/api/v1/account
- Auth: API key in cookie sb-access-token
Response
Account deleted. auth_user_removed=false with auth_cleanup_required=true signals a PARTIAL success: the database record is deleted but the auth identity survived a failed cleanup call and needs manual removal (operators are alerted via Sentry) — the caller must never believe nothing happened. consumer_found=false signals an idempotent no-op (the account was already gone).
Example response
{
"_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.