> ## Documentation Index
> Fetch the complete documentation index at: https://www.unsiloed.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Retention

> Choose what Unsiloed keeps after a job finishes: everything, results only, or nothing. Delete any job on demand.

## Overview

By default Unsiloed keeps a job's uploaded document, its derived files and its results until you delete the job. An organization can instead choose to have the document, or the document and the results, deleted automatically **24 hours after each job finishes**. Any job can also be deleted immediately with a `DELETE` call.

The setting covers parse, extraction, classification, splitting and form-fill jobs.

| Mode | Deleted 24 hours after the job finishes | Kept |
| - | - | - |
| `keep` (default) | Nothing | Everything |
| `delete_files` | The uploaded document, converted PDF, page images, segment crops and exports | Results (JSON, markdown, HTML); the job record |
| `delete_all` | Everything above **and** the results | The job record |

The setting never deletes the job record: its id, status, timing and page count stay, and so do usage and billing records. Only the content goes.

> [!NOTE]
>
> The 24-hour window is fixed. It is counted from when the job reaches a final status (`Succeeded`, `Failed` or `Cancelled`) and cannot be shortened or extended. To remove content sooner, [delete the job](#delete-a-job).

## Organization setting

The policy is set per organization and applies to every job the organization runs, whether it was started with an API key or by a signed-in user in the web app.

Org admins change it in the web app under **Account settings → Data retention**, or with the API:

```bash theme={null}
curl -X PATCH 'https://platformbackend.unsiloed.ai/api/v1/org/update_retention/{org_id}' \
  -H 'Authorization: Bearer <session token of an org admin>' \
  -H 'Content-Type: application/json' \
  -d '{"data_retention_mode": "delete_files"}'
```

`data_retention_mode` is `keep`, `delete_files` or `delete_all`. This endpoint takes an org admin's session token, not an API key.

A new setting applies to jobs started after it is saved, within about a minute. Jobs that were already running or finished keep the policy they were created under, including when you later switch back to `keep`.

## Per-request override

Every job-creating endpoint accepts a `data_retention` field with the value `delete_files` or `delete_all`. It applies to that job only and can only be **stricter** than the organization's policy: `keep` \< `delete_files` \< `delete_all`, and the stricter of the two wins. A value looser than the policy has no effect. Any other value is rejected (`400` on `/parse`, `422` on the extraction, classification, splitting and form-fill endpoints).

```bash theme={null}
curl -X POST 'https://prod.visionapi.unsiloed.ai/parse' \
  -H 'api-key: your-api-key' \
  -F 'file=@document.pdf;type=application/pdf' \
  -F 'data_retention=delete_all'
```

The same form field works on `POST /v2/extract`, `POST /classify`, `POST /splitter` and `POST /auto-fill/process`.

The web app's playground offers the same choice per job: the **Retention** select next to **Run** starts on **Organization policy** and lists only the modes stricter than it.

## Reading a job's retention state

Parse responses from `POST /parse` and `GET /parse/{job_id}` carry a `data_retention` object when a mode applies. It is absent for jobs on `keep`.

```bash theme={null}
curl 'https://prod.visionapi.unsiloed.ai/parse/{job_id}' \
  -H 'api-key: your-api-key'
```

```json theme={null}
{
  "job_id": "7c1f...",
  "status": "Succeeded",
  "data_retention": {
    "mode": "delete_files",
    "delete_at": "2026-11-24T09:12:40Z",
    "files_deleted_at": null,
    "data_deleted_at": null
  }
}
```

**mode** `string`

`delete_files` or `delete_all`: the mode the job runs under (the stricter of the request and the organization's policy at the time it was created).

**delete\_at** `string`

When the content is due for deletion: 24 hours after the job finished, or the job's `expires_in` deadline if that comes first. `null` while the job is still running.

**files\_deleted\_at** `string | null`

Set once the document and derived files are gone.

**data\_deleted\_at** `string | null`

Set once the results are gone too.

### After the files are deleted

Under `delete_files`, `GET /parse/{job_id}` keeps returning the results. `pdf_url`, `file_url`, export URLs and every segment `image` are `null`, and `data_retention.files_deleted_at` is set. Extraction, classification, splitting and form-fill jobs behave the same way: results are served and file URLs are `null`.

### After everything is deleted

Under `delete_all`, reading the job returns `410 Gone` with the error code `job_deleted`. The record still exists, so the owner sees the `410`; anyone else gets the same `404` as for a job that never existed. Public share links of the job also answer `410`. A parse job you delete yourself with `scope=all` answers `410` the same way.

An extraction, classification, splitting or form-fill job you delete yourself with `scope=all` is different: the delete also removes the job from your history, so reading or deleting it afterwards returns `404`, not `410`.

```json theme={null}
{
  "error": {
    "code": "job_deleted",
    "message": "Deleted by the organization's data retention setting",
    "details": {
      "job_id": "7c1f...",
      "status": "Succeeded",
      "finished_at": "2026-11-23T09:12:40Z",
      "data_deleted_at": "2026-11-24T09:15:02Z"
    }
  }
}
```

The extraction, classification, splitting and form-fill endpoints return the same code with `details.data_deleted_at`.

## Delete a job

Delete a finished job's content at any time, in either scope:

```bash theme={null}
# Delete the document and derived files; keep the results
curl -X DELETE 'https://prod.visionapi.unsiloed.ai/parse/{job_id}?scope=files' \
  -H 'api-key: your-api-key'

# Delete everything
curl -X DELETE 'https://prod.visionapi.unsiloed.ai/parse/{job_id}?scope=all' \
  -H 'api-key: your-api-key'
```

```json theme={null}
{ "job_id": "7c1f...", "deleted": "files" }
```

The same `?scope=` applies to `DELETE /jobs/{job_id}` (extraction), `DELETE /splitter/{job_id}`, `DELETE /classify/{job_id}` and `DELETE /auto-fill/{job_id}`.

Without `scope`, the organization's policy decides: `delete_files` means `files`; `keep` or `delete_all` means `all`.

Deletes only ever widen, and repeating one is safe:

| Request | Result |
| - | - |
| `scope=files` on a job whose files are already gone | `200`, nothing more to do |
| `scope=all` after `scope=files` | `200`, the results are removed |
| Any delete on a job emptied by the 24-hour deletion, or on a parse job already deleted with `scope=all` | `410 job_deleted` |
| Any delete on an extraction, classification, splitting or form-fill job already deleted with `scope=all` | `404`; that delete removed the job |
| Job still running | `409`; wait for it to finish |
| A job of another organization, or an unknown id | `404` |
| A `scope` other than `files` or `all` | `400` on `/parse`, `422` on the other endpoints |

A parse job's record stays after every delete. On extraction, classification, splitting and form-fill, `scope=files` keeps the record and `scope=all` removes it.

> [!NOTE]
>
> Files in your own storage are never touched: a document passed by `url` or `input_file_url`, or a file in a connected bucket, stays where it is. Only the copies Unsiloed stored for the job are deleted.

## Deleting past data

Turning on a retention mode does not touch jobs that finished before the change. There is no bulk delete; delete past jobs one by one with the scope you want, then read each back to confirm the markers.

```python theme={null}
import os
import requests

API_KEY = os.environ["UNSILOED_API_KEY"]
BASE_URL = "https://prod.visionapi.unsiloed.ai"
HEADERS = {"api-key": API_KEY}

# The parse job ids you want to clear, from your own records.
job_ids = ["7c1f...", "a9e0...", "d412..."]

for job_id in job_ids:
    response = requests.delete(f"{BASE_URL}/parse/{job_id}", headers=HEADERS, params={"scope": "all"})
    if response.status_code == 410:
        print(job_id, "already deleted")
        continue
    if response.status_code == 409:
        print(job_id, "still running; retry later")
        continue
    response.raise_for_status()

    check = requests.get(f"{BASE_URL}/parse/{job_id}", headers=HEADERS)
    if check.status_code == 410:
        print(job_id, "results and files deleted")
    else:
        markers = check.json().get("data_retention") or {}
        print(job_id, "files deleted at", markers.get("files_deleted_at"))
```

With `scope=files` the final `GET` returns `200` and `data_retention.files_deleted_at` is set. With `scope=all` it returns `410`. The loop is for parse jobs: an extraction, classification, splitting or form-fill job deleted with `scope=all` reads back as `404`.

## `expires_in`

The per-request `expires_in` keeps its meaning: the number of seconds after the job finishes until the job, including its record, is removed. Under a retention mode the content is deleted at the sooner of the two deadlines and the record is still removed when `expires_in` passes.

## What the setting does not cover

* **Job records.** Status, timing, page count and billing or usage records are kept for every job, in every mode.
* **Logs and metrics.** These hold no document content, but they keep job ids and sizes.
* **Backups.** Deleted content is not restored. Short-term backups kept for recovering from outages roll over within seven days.
* **Third-party services.** We use third-party services to process documents on our behalf. They act only on our instructions and may not use your data for training.
* **Excel field extraction in the web app.** Extracting fields from an Excel workbook in the extraction playground creates no job, history entry or stored result, so there is nothing for the policy to delete. Parsing an Excel file (`/parse/excel` or the parser playground) is a normal job and follows the policy.

Whatever the policy, `DELETE` and the web app's delete dialog ("Delete documents" / "Delete everything") work on every job.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.