Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt

Use this file to discover all available pages before exploring further.

POST /api/v1/gdpr/erasure

Permanently deletes all records associated with a customer ID across nine data tables (plus dynamic schema tables) in a single atomic transaction. This implements the GDPR “right to erasure” (right to be forgotten) as defined in Article 17 of the General Data Protection Regulation. The deletion is transactional — either all tables are cleaned or none are, ensuring no partial erasure. An audit log entry is recorded after successful erasure to maintain a compliance trail (the audit entry records that an erasure occurred but does not retain the deleted data).

Authentication

Requires a valid tenant and the admin role.
HeaderRequiredDescription
X-Tenant-IdYesTenant identifier
AuthorizationYesBearer token or API key
This operation is irreversible. All interaction history, decision traces, suppressions, attribution results, interaction summaries, variant assignments, identity links, journey enrollments, and dynamic schema rows for the specified customer will be permanently deleted. There is no undo.

Request Body

{
  "customerId": "CUST001"
}
FieldTypeRequiredDescription
customerIdstringYesThe unique identifier of the customer whose data should be erased

Example Request

curl -X POST https://playground.kaireonai.com/api/v1/gdpr/erasure \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: my-tenant" \
  -H "Authorization: Bearer sk_live_abc123" \
  -d '{
    "customerId": "CUST001"
  }'

Example Response

{
  "success": true,
  "customerId": "CUST001",
  "deletedCounts": {
    "interactionHistory": 142,
    "interactionSummary": 12,
    "suppression": 8,
    "decisionTrace": 37,
    "attributionResult": 23,
    "variantAssignment": 4,
    "identityLink": 2,
    "journeyEnrollment": 6,
    "dynamicSchemaRows": 18
  },
  "totalDeleted": 252
}

Response Fields

FieldTypeDescription
successbooleantrue if the erasure completed successfully
customerIdstringThe customer ID that was erased
deletedCountsobjectBreakdown of records deleted per table
deletedCounts.interactionHistoryintegerNumber of interaction history records deleted (impressions, clicks, outcomes)
deletedCounts.interactionSummaryintegerNumber of interaction summary records deleted (aggregated interaction stats)
deletedCounts.suppressionintegerNumber of suppression records deleted (frequency cap and cooldown entries)
deletedCounts.decisionTraceintegerNumber of decision trace records deleted (forensic traces of pipeline execution)
deletedCounts.attributionResultintegerNumber of attribution result records deleted (outcome-to-recommendation mappings)
deletedCounts.variantAssignmentintegerNumber of experiment variant assignment records deleted
deletedCounts.identityLinkintegerNumber of identity cluster link records deleted
deletedCounts.journeyEnrollmentintegerNumber of journey enrollment records deleted
deletedCounts.dynamicSchemaRowsintegerNumber of rows deleted from customer-type dynamic schema tables
totalDeletedintegerSum of all deleted records across all tables

Data Categories Affected

The erasure targets these customer-scoped categories within the tenant boundary:
CategoryDescription
Interaction historyRaw interaction events (impressions, clicks, conversions, dismissals)
Interaction summariesAggregated interaction statistics per customer-offer pair
SuppressionsActive suppression rules (frequency caps, cooldown periods)
Decision tracesForensic traces of the decision pipeline for debugging and auditing
Attribution resultsLinks between outcomes and the recommendations that generated them
Variant assignmentsExperiment variant assignments for A/B tests
Identity linksIdentity-cluster membership records (cross-device/cross-channel identity resolution)
Journey enrollmentsCustomer-journey enrollment records
Dynamic schema rowsRows from all active customer-type schema tables (prefixed with ds_) where customer_id matches
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 deletedCounts breakdown
This entry appears in the Change History feed and can be filtered with action=gdpr_erasure.

Error Responses

StatusCause
400Missing customerId, invalid JSON body, or customerId is not a string
401Missing or invalid authentication credentials
403Insufficient role (requires admin)
500Erasure transaction failed (no data was deleted — the transaction rolls back entirely)

If the customer has no data in any of the five tables, the endpoint still returns success: true with all counts at 0. This is expected behavior — the erasure request is idempotent.
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.
See also: Change History | Interaction History | Decision Traces