Data lifecycle and backups
How long Phantom keeps what it records, what archiving and deleting do, and how to back up and restore an installation.
Retention
| What | Kept | Where it is set |
|---|---|---|
| HTTP history | Until deleted, or by the retention policy: flows per vault, stored body bytes per vault, age in days; off by default | Proxy → Settings, GET/PUT /proxy/retention (docs/guides/proxy/capture.md) |
| File revisions | The newest revisions per file within a byte bound; the current revision and revisions pinned as evidence are always kept | FILES_REVISIONS_KEPT, FILES_REVISION_BYTES (docs/files/index.md) |
| Note revisions | At most 200 per note, oldest dropped first | Fixed |
| Agent Bridge events | The newest 50,000 events | BRIDGE_EVENT_RETENTION |
| Report snapshots | Until the report is deleted | — |
| Everything else | Until deleted | — |
Archiving
Archiving hides something from default lists without deleting it or breaking references to it: notes, files, payload collections and agent conversations. Archived items keep their history and can be brought back at any time.
Deleting
- Files go to the trash first; restoring brings them back unchanged. Purging, from the trash and by the user only, removes the rows and any stored bytes no other file or revision uses. Evidence attachments survive a purge with the name and SHA-256 that were evidence.
- Findings, reports, targets and other objects are deleted at once, with what belongs only to them (a finding's attachments, a report's sections and snapshots). Notes and reports that referenced them show the reference as missing; nothing else changes.
- HTTP history is deleted by the user (selection, filters, clear) or by the retention policy. Agents cannot delete history.
- A vault is deleted with everything in it: the database rows go through
ON DELETE CASCADE, and its file storage directory is removed right after, or on the next start if Phantom was stopped in between.
Backups
A backup is one archive with the whole installation: an online snapshot of the SQLite database, the stored file contents, the configuration key (encrypted provider credentials cannot be read without it) and, unless left out, the interception CA. A manifest lists every file with its SHA-256. Run from the backend directory:
python -m scripts.backup create --output phantom-backup.tar.gz
python -m scripts.backup verify phantom-backup.tar.gzcreate is safe while Phantom runs: the database is copied with SQLite's backup API, and stored contents never change once written; uploads still in progress are left out. --no-ca leaves the CA out (browsers that trust it then need the new one). The archive is written with owner-only permissions and holds captured secrets and the configuration key: keep it as safe as the installation itself.
Restoring
Stop Phantom, then:
python -m scripts.backup restore phantom-backup.tar.gzEvery file is checked against the manifest before anything is written; an altered, incomplete or unsafe archive (absolute paths, .., links, unknown folders) is refused. Restoring into an installation that already holds a database or files is refused unless --replace is given, and then the existing database, files, key and CA are renamed to <name>.before-restore-<time>, never deleted. Start Phantom again afterwards; migrations newer than the backup are applied on start.
Backups cover SQLite installations (local development and run.py). For PostgreSQL (Docker), back up the database with pg_dump and copy the files volume and the configuration key alongside it.