POST /api/v1/gdpr/erasure
Permanently deletes all records associated with a customer ID across ten interaction and decision tables, plus any customer-type dynamic schema tables. This implements the GDPR “right to erasure” (right to be forgotten) as defined in Article 17 of the General Data Protection Regulation. The ten Prisma-modeled tables are deleted in a single transaction — either all of them are cleaned or none are. The dynamic-schema (ds_*) deletes run outside that transaction on purpose: a failing raw statement inside an interactive transaction would abort it and roll back the modeled deletes. When a ds_* table has no customer_id column (or its delete fails), the erasure continues and records the issue in the top-level warnings[] array rather than failing. An audit log entry is recorded after erasure to maintain a compliance trail (the audit entry records that an erasure occurred but does not retain the deleted data).
This is the single source of truth for erasure: the admin endpoint below and the DSAR delete-request workflow both run the same
eraseSubjectData path, so a subject deleted through either route has the identical set of categories erased.ConsentRecord, the DsarRequest row itself, and hash-chained AuditLog entries are deliberately not erased here — they are retained as legal-obligation proof (consent history, the audit trail of who requested what) and are purged only by the retention cron on their own clock. The stored DSAR export payload (DsarExport) is erased.Authentication
Requires a valid tenant and the admin role.Request Body
Example Request
Example Response
Response Fields
Data Categories Affected
The erasure targets these customer-scoped categories within the tenant boundary:
All deletions are scoped to both the
tenantId and customerId, so no cross-tenant data is affected.
Audit Trail
After a successful erasure, an audit log entry is created with:- action:
gdpr_erasure - entityType:
customer - entityId: The erased customer ID
- changes: The
deletedCountsbreakdown
action=gdpr_erasure.
Error Responses
The GDPR erasure endpoint automatically deletes rows from customer-type dynamic schema tables (those with
entityType: "customer" and table names prefixed with ds_). However, data stored in external data sources (e.g., upstream systems connected via connectors or pipelines) is not affected — you must handle erasure in those systems separately.