# Documents API
Erase uploaded documents and derived data for privacy workflows
Source: https://www.klarefi.com/docs/api/documents

> **Use your workspace API base URL**
>
> Set `KLAREFI_API_BASE_URL` to the value in **Settings → Developer** before
> using the example. Current workspaces may use a
> `https://<deployment>.convex.site` URL.

## DELETE /api/v1/documents/\{docId\}

Required scope: `privacy:erase`

```bash
curl -X DELETE "$KLAREFI_API_BASE_URL/api/v1/documents/doc_def456" \
  -H "Authorization: Bearer $KLAREFI_API_KEY"
```

The erasure job deletes the document and derived evidence, candidates, case
document links, artifacts, uploads, and storage objects where present.

`200` means the erasure completed in the current batch. `202` means Klarefi
deleted a batch and more work remains.

```json
{
  "erasure_receipt": {
    "doc_id": "doc_def456",
    "audit_id": "audit_001",
    "completed": true,
    "batch_count": 8,
    "batch_limit": 100,
    "remaining_budget": 92,
    "deleted_evidence": 5,
    "deleted_candidates": 3,
    "deleted_case_documents": 1,
    "deleted_artifacts": 2,
    "deleted_uploads": 1,
    "deleted_storage_objects": 1,
    "deleted_document": true,
    "timestamp": "2026-01-15T10:30:00.000Z"
  }
}
```

If the document does not exist for the organization, Klarefi returns
`404 not_found`.
