Skip to main content
GitHub

Data Management

Delete user data for GDPR compliance.

Risicare provides a data deletion API for GDPR Article 17 (Right to Erasure) compliance. Use it to delete all traces and sessions associated with a data subject.

Delete by Subject

POST /v1/data/delete-by-subject
Content-Type: application/json
Authorization: Bearer rsk-...
 
{
  "session_id": "user-session-abc",
  "agent_id": "support-agent",
  "trace_ids": ["trace-id-1", "trace-id-2"]
}

Provide at least one identifier. All matching spans and sessions are deleted, scoped to your project.

ParameterTypeDescription
session_idstringDelete all data for this session
agent_idstringDelete all data for this agent
trace_idsstring[]Delete specific traces by ID

Response

{
  "spans_deleted": 42,
  "sessions_deleted": 1,
  "traces_affected": 3
}

Example: Delete a User's Session

curl -X POST https://app.risicare.ai/api/v1/data/delete-by-subject \
  -H "Authorization: Bearer rsk-..." \
  -H "Content-Type: application/json" \
  -d '{"session_id": "user-123-session"}'

Example: Delete Specific Traces

import httpx
 
resp = httpx.post(
    "https://app.risicare.ai/api/v1/data/delete-by-subject",
    headers={"Authorization": "Bearer rsk-..."},
    json={"trace_ids": ["abc123", "def456"]},
)
print(resp.json())  # {"spans_deleted": 5, "sessions_deleted": 0, "traces_affected": 2}

Important: Deletion is Asynchronous

Data may remain visible briefly after deletion

Risicare uses ClickHouse for trace storage. Deletions are submitted as background mutations — the API returns a success response immediately, but deleted data may remain visible in queries for up to 5 minutes while ClickHouse processes the mutation.

This is a storage engine characteristic, not a bug. The data is deleted — it just takes time for the physical removal to complete.

What this means in practice:

  • The API returns 200 with accurate spans_deleted counts immediately
  • Queries may still return the deleted traces for a few minutes
  • No action is needed — the data will disappear once the background merge runs
  • For compliance purposes, the deletion is considered effective at the time of the API response

Error Handling

If the deletion fails (e.g., database unreachable), the API returns 500 with an error message. A 200 response means the deletion was successfully submitted.

{
  "detail": "Data deletion failed. Please retry. If this persists, contact support."
}
StatusMeaning
200Deletion submitted successfully
400No identifiers provided
401Invalid or missing API key
500Deletion failed — safe to retry

What Gets Deleted

IdentifierSpansSessionsTraces
session_idAll spans in sessionThe session recordAll traces in session
agent_idAll spans by agentAll traces with agent
trace_idsAll spans in tracesThe specified traces

All deletions are scoped to your project — you can only delete data that belongs to the API key's project.

Automatic Data Retention

In addition to on-demand deletion, Risicare automatically purges data based on your project's retention setting:

PlanDefault Retention
Free7 days
Pro30 days
Enterprise90 days (configurable)

Configure retention in Project Settings.