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.
| Parameter | Type | Description |
|---|---|---|
session_id | string | Delete all data for this session |
agent_id | string | Delete all data for this agent |
trace_ids | string[] | 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
200with accuratespans_deletedcounts 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."
}| Status | Meaning |
|---|---|
200 | Deletion submitted successfully |
400 | No identifiers provided |
401 | Invalid or missing API key |
500 | Deletion failed — safe to retry |
What Gets Deleted
| Identifier | Spans | Sessions | Traces |
|---|---|---|---|
session_id | All spans in session | The session record | All traces in session |
agent_id | All spans by agent | — | All traces with agent |
trace_ids | All spans in traces | — | The 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:
| Plan | Default Retention |
|---|---|
| Free | 7 days |
| Pro | 30 days |
| Enterprise | 90 days (configurable) |
Configure retention in Project Settings.