Updated Apr 27, 2026
core concepts

Retention policies #

How long uploaded files and extraction results are kept. Per-artifact, set at submission time.

Every artifact carries a retention_policy that controls how long the uploaded file and its extraction results live in storage. The default is 30 days. Set it at submission time per-artifact, or globally per pipeline.

Available policies

retention_policySource file kept for
immediateDeleted as soon as extraction completes
3h3 hours
6h6 hours
12h12 hours
1d1 day
3d3 days
7d7 days
30d30 days (default)
90d90 days
365d1 year
neverIndefinite, manual delete only

The artifact record (metadata, status, extracted JSON result) is retained longer than the source file in most policies; typically until you delete the artifact explicitly. Only the raw upload is purged on the schedule.

Setting a policy

Pass retention_policy on submit:

json
{
  "filename":         "passport-scan.png",
  "artifact_type":    "image/png",
  "artifact_size":    921384,
  "retention_policy": "immediate",
  "template_id":      "tpl_id_card"
}

Or as a form field on POST /artifacts/upload:

bash
curl -u "$DD_KEY:$DD_SECRET" \
  -X POST https://api.datadistillers.com/api/v1/artifacts/upload \
  -F 'file=@./passport.png' \
  -F 'retention_policy=immediate'

The chosen policy is stored on the artifact and visible in subsequent GET /artifacts/{id} responses. It cannot be changed after submission; delete and re-submit if you need a different policy.

Picking a policy

A useful starting point keyed by document sensitivity:

Document typeSuggested policyRationale
Government IDs, passportsimmediateReduce PII exposure window. Result JSON stays.
Medical records1d or 3dAllows reprocessing within a workday for QA.
Standard invoices, receipts30d (default)Covers most reconciliation cycles.
Audit / compliance source documents365d or neverStatutory retention windows usually exceed this.

For regulated workloads (HIPAA, GDPR's "right to be forgotten"), prefer the shortest policy that still allows your processing window, and pair it with explicit DELETE /artifacts/{id} calls when a user requests removal.

Retention vs explicit delete

Retention is the safety net. Explicit DELETE /artifacts/{id} is the authoritative removal; it deletes the source file, the result, and the artifact record itself, all at once.

bash
curl -u "$DD_KEY:$DD_SECRET" \
  -X DELETE https://api.datadistillers.com/api/v1/artifacts/art_b4d8c0f1

Returns 204 No Content on success. There's no soft delete; the record is gone the moment the call returns. Orchestrate this from your application when a user-initiated deletion event fires (account closure, GDPR request, etc.); don't rely on retention alone.

What happens after the policy expires

Once the source file is purged:

  • GET /artifacts/{id}/download?file_type=raw returns 404.
  • GET /artifacts/{id}/download?file_type=json still works as long as the artifact record exists.
  • POST /artifacts/{id}/rerun returns 400; there's no source to re-process.
  • Job status APIs continue to return historical data.

If you anticipate needing to re-process, choose a longer retention policy upfront. There's no recovery once the file is gone.

Esc
↑↓Navigate↵OpenEscClose