Skip to content

Retention and deletion

Administrators read and update tenant settings:

GET /v1/settings/retention
PUT /v1/settings/retention
Content-Type: application/json
{ "captureRetentionDays": 365, "uploadRetentionDays": 30 }

null means retain indefinitely. Values are whole days from 1 to 3650. Settings are tenant-scoped and never affect another tenant.

DELETE /v1/captures/:id requires an administrator session and a same-origin request. The API:

  1. loads the capture and its attachments for the reviewer’s tenant,
  2. deletes attachment objects from storage,
  3. sets deleted_at,
  4. appends one capture.deleted audit event.

Deleted captures disappear from lists, detail, search, and exports. Earlier audit events are retained. The request returns 404 for another tenant’s capture.

The API exposes POST /v1/maintenance/retention for administrators and runs the same pass on a schedule in both runtimes. For each tenant with a capture retention period, it finds terminal captures (accepted, returned, rejected) older than the cutoff, removes their evidence objects, marks them deleted, and appends a system-attributed capture.deleted event. Unconsumed uploads older than the upload retention period are removed with their objects.

  • Audit events, including the deletion event and every earlier transition.
  • Capture metadata needed to interpret the audit trail. Evidence bytes are removed.
  • Webhook delivery history and tenant settings.

If a stricter hard purge is required, treat it as a new policy decision and ADR. Backups may still contain deleted data according to the operator’s backup retention; document and enforce that separately.

Use synthetic data to confirm that a deleted capture is absent from:

Terminal window
curl -H "Cookie: $SESSION" "$API/v1/captures"
curl -H "Cookie: $SESSION" "$API/v1/exports/captures?format=json"

and that its object keys are gone from the bucket. The shared contract suite exercises deletion, retention, and export exclusion.