# HTTP history

Every exchange the proxy captures, every request sent from Repeater or
replay, every HAR entry imported and every Intruder result saved becomes
one flow in the vault's HTTP history. This page describes what a flow
stores, how bodies are decoded for display, the message viewer shared by
every module, downloads, deletion and replay.

What is recorded in the first place (scope, static assets, include and
exclude rules) and how long it is kept is in [Capture and retention](./capture.md).

## What is captured

Each exchange is one `ProxyFlow` row (see [Data models](../../reference/models/traffic.md#proxyflow)).

- **Raw bytes.** Bodies are stored as they crossed the wire after transfer
  framing was removed. Content codings are kept: a gzip response is stored
  gzipped. The stored messages are the ones actually sent, so a request
  edited in Intercept is stored with the edit.
- **Body limit.** Each body is stored up to `max_body_bytes` (the
  `proxy.capture` setting, `PROXY_BODY_LIMIT` by default), and all bodies
  in flight share a memory budget. `request_size` and `response_size`
  record the full size seen; `request_truncated` and `response_truncated`
  are set when bytes were discarded.
- **Headers** are stored as ordered `[name, value]` pairs, so order and
  duplicates (several `Set-Cookie`) are preserved.
- **Metadata.** `mime_type` is the response `Content-Type` without
  parameters. Each flow also stores `duration_ms`, `status_code`, `error`
  (for example a timeout or `Dropped in intercept`), `in_scope`, `source`
  (`proxy`, `replay`, `import` or `intruder`) and the `intercepted` and
  `edited` flags.

## Display decoding

`GET /api/v1/vaults/{vault_id}/flows/{flow_id}` returns the flow with
bodies prepared for display. The stored bytes are never changed.

- Content codings `gzip`, `x-gzip`, `deflate` (zlib or raw), `br` and
  `zstd`, including stacked codings, are removed on a copy capped at 8 MiB.
  Output beyond the cap is cut and `decoded_truncated` is set, so a
  decompression bomb cannot use more memory than that. `br` needs the
  `brotli` package; `zstd` uses the standard library module or the
  `zstandard` package. Without them the body is shown undecoded.
- The media type comes from `Content-Type`, or is sniffed from magic
  numbers when that header is missing. A body is returned as UTF-8 text
  when its type is textual or unknown and it decodes; otherwise it is
  returned as base64. `kind` is `text`, `image` or `binary`.

## Message viewer

Every request and response view in Phantom uses the same viewer:

- **Modes:** Pretty, Raw, Headers (a table), Params (query, form and
  top-level JSON fields of a request), Parts (multipart bodies), Hex and
  a sandboxed Preview, offered only where they apply.
- **Reading:** line numbers, folding of pretty JSON and markup, and
  **Ctrl+F** inside a viewer to find text, with case and regular
  expression options. Find searches what the view shows, so masked
  secrets cannot be found until revealed. Regular expressions with nested
  repetition are refused.
- **Metadata row:** content type, size, the decoding pipeline (for example
  `br → 853.6 KB decoded from 117.3 KB`), truncation and binary flags, and
  image dimensions in Preview.
- Long bodies are virtualized: only visible lines are rendered.
- **Narrow panes:** a viewer narrower than 460 px wraps long lines by
  default; Wrap there is remembered separately from wider viewers, which
  keep long lines on one row and scroll them inside the pane. When the
  toolbar would not fit on one row, Wrap and the secrets toggle become
  icons, and line numbers, fold / unfold and the download move into a
  **⋯** menu.

## Layout

The request detail opens **below** the table by default, as in Burp and
Caido: the table keeps the full width, so paths are not cut short, and the
right side stays free for the agent panel.

- **Bottom:** the summary row (method, URL, status, timing and the
  Repeater, Intruder, Replay, cURL, Ask agent and delete actions) spans
  the width, with bookmark, tags and note under it. Request and Response
  sit side by side, each with its own viewer toolbar (modes, find, wrap,
  copy). When the detail is narrower than 900 px they become Request /
  Response tabs. Cookies and Messages (WebSocket) keep their own tabs.
- **Right:** the detail opens beside the table as before, one part at a
  time or both stacked with **Split**.
- **Switching:** the two icons in the History toolbar, **Alt+L**, or the
  palette command *History: show request detail beside / below the
  table*. The choice is an interface preference kept in the browser.
- **Dividers:** the divider between table and detail and the one between
  Request and Response can be dragged, moved with the arrow keys when
  focused (5 % per step), and reset with a double-click (55 / 45 for the
  table, 50 / 50 for the messages). Both are remembered. The table keeps
  at least 120 px and the detail at least 200 px.
- **Agent panel:** when it is open and the history is narrower than
  1,100 px, the detail is shown below even if Right was chosen. The
  choice is kept; the Right icon carries a dot and its tooltip says why.
- **Sidebar:** while the agent panel is open in a window narrower than
  1,440 px, the sidebar steps aside so the history keeps its room. The
  rail button or **Ctrl+B** opens it over the page; it docks again when
  the panel closes or the window widens. Your sidebar setting is not
  changed.
- **Columns fit the table:** Tags is left out while no listed request
  has a tag. When the table is narrow, Path and Host shrink first, then
  Tags, Source, Captured at and Type are left out; Status, Size and Time
  always stay visible. The saved column layout is not changed, so a
  wider table shows it again.
- The selected row stays in view when the detail opens, when a divider
  is dragged and when the arrow keys move the selection.

Intruder results offer the same Bottom / Right switch and Alt+L, with a
preference of their own. The WebSocket Messages view already lists
messages above the selected payload and is unchanged.

## Listing and filtering

`GET /api/v1/vaults/{vault_id}/flows` pages the history, newest first,
with filters for scope, host, method, status class, search text, tags,
bookmarks and saved views; `GET /api/v1/vaults/{vault_id}/flows/hosts`
lists the hosts seen. Tags, bookmarks, notes and saved views are described
in [Annotations](../annotations.md).

`sort` orders by `method`, `host`, `status`, `size` or `duration` instead
of capture order (`id`), with `order=asc|desc`; ties are broken by id,
and a missing status, size or duration sorts as 0. The next page of a
sorted list passes the last row's id as `before_id` and its sort value
as `sort_value`. Clicking those column headers in the table (and #, Time
or Captured for oldest first) sorts the whole history on the server, so
paging continues in that order; other columns sort the loaded rows.

The Proxy sidebar lists every host seen, busiest first, with a filter
field and a switch to group hosts by site (`api.app.example.com` under
`example.com`, `shop.example.co.uk` under `example.co.uk`; addresses stay
on their own); groups expand and collapse, and the group of the chosen
host stays open. Right click a host (or Shift+F10 on it) to show only
its requests (or every host again), scan it, open it in the browser, add
it to, remove it from or exclude it from scope, or copy it. A saved view's
menu opens, renames (F2), pins and deletes it (Delete, confirmed in the
row).

### Row menu

Right click a request (or Shift+F10 on it; on a selection, the menu acts
on every selected row): send to Repeater (with or without sending),
Intruder, compare, attach to the agent conversation, **create a finding
from this request** (its target, URL and a `[[flow:id]]` reference
filled in), scan its host, bookmark, tag, note, copy the URL or cURL
(masked, or with secrets when the export policy allows), export HAR, add
its host to or remove it from scope, exclude it, show only its host, and
delete.

### Search

The search field (and `search` on the route, saved views and the
`flow_list` tool) takes words and operators:

| Write | Finds |
|---|---|
| `login` | Host or path containing the words |
| `type:json` | Response content type containing `json` |
| `body:token` or `body:"session expired"` | Request or response body containing the text |
| `since:2026-11-30`, `until:2026-11-30T18:00` | Captured on or after, or before; a date covers the whole day (UTC) |
| `source:browser`, `source:repeater`, `source:intruder`, `source:import`, `source:scan` | Traffic of one origin: captured by the proxy, sent from the workstation (Repeater, replay), saved attack results, imported HAR, or requests a scan sent with Record requests in history on |
| `label:admin`, `label:none` | Traffic captured under a session label (case-insensitive), or without one |

Operators combine with each other and with words. Quotes keep spaces in
a value; an operator Phantom does not know stays a word. `body:` looks
at stored bytes as captured, so a compressed response body is only found
by what it contains compressed; new requests matching a `body:` search
appear when the list reloads.

### Session labels

The **Session label** field in the Proxy header names the account or
role the browser is signed in as (`admin`, `guest`, `tenant-b`). Every
request captured while it is set stores the label; the Source column
shows it and `label:` finds it, so traffic of two identities can be told
apart and compared. An empty field stops labelling. The label applies to
what the proxy captures, not to Repeater or Intruder sends, and is kept
in memory only: after a restart capture starts unlabelled, so traffic is
never labelled with a sign-in that may no longer hold. Through REST:
`PUT /api/v1/proxy/session-label` with `{"label": "admin"}` or
`{"label": null}`; the current label is in `GET /api/v1/proxy/status`.

**Presets**, next to the search field, set common filters in one step:
client and server errors, requests that change state (POST, PUT, PATCH,
DELETE), JSON responses, HTML pages, scripts, captured today, browser
traffic, and what Repeater or Intruder sent. A preset replaces the
search, method and status filters with its own, built from the filters
and operators above, so it runs on the server and can be saved as a
view; the button names the preset the filters match.

## Body download

`GET /api/v1/vaults/{vault_id}/flows/{flow_id}/body/{request|response}`
returns the stored bytes as an attachment. With `?decoded=true` it returns
the bounded decoded copy instead. Bytes that still carry a content coding
are served as `application/octet-stream`. Every download has
`X-Content-Type-Options: nosniff`, `Content-Security-Policy: sandbox;
default-src 'none'` and `Cache-Control: no-store`, so captured content
cannot render in the workstation's origin.

Downloads follow the export redaction policy (`GET` and `PUT
/api/v1/settings/redaction`, `export.mode`):

| Mode | Download |
|---|---|
| `redact` (default) | Credentials masked. A body that still carries a content coding is served decoded, because coded bytes cannot be masked. `?reveal=true` is refused with 403. |
| `reveal` | The stored bytes. `?reveal=false` masks this one download. |
| `ask` | 409 `conflict` until the request says `?reveal=true` or `?reveal=false`. |

`X-Phantom-Redacted: true|false` tells which one was served.

## HAR import and export

The history can be exported as HAR 1.2 under the same export policy, and
HAR files can be imported as flows with `source = import`. See
[HAR import and export](./har.md).

## Deleting flows

`DELETE /api/v1/vaults/{vault_id}/flows/{flow_id}` deletes one flow (404
when it is not in that vault). `POST /api/v1/vaults/{vault_id}/flows/delete`
with `{"ids": [...]}` (1 to 1000 ids, repeats dropped) deletes the vault's
flows among them; ids of other vaults and unknown ids are ignored. Both
answer `{deleted, ids}` with the ids actually deleted, ascending.
`DELETE /api/v1/vaults/{vault_id}/flows` clears the whole history
(`proxy.cleared`).

One transaction removes the flows, their annotations (notes, bookmarks,
tag links), their WebSocket summaries and frames, and clears
`source_flow_id` on Intruder attacks built from a deleted flow (the attack
keeps its template and endpoint). A live WebSocket session whose flow is
deleted stops recording. One `proxy.flows.deleted {vault_id, ids}` event
follows a delete that removed something.

Agents cannot delete chosen flows: flows do not record who created them,
so an agent cannot be limited to its own replays or imports. The MCP tool
`flow_delete` is listed (destructive) but always fails with
`permission_denied`, and replay, Intercept edits and agent attacks cannot
reach `/flows/delete` or any other path of the workstation's own API.

In the interface, History deletes from the row menu ("Delete", or "Delete
N selected" on a multi-selection), the bulk bar, the Delete or Backspace
key on the selection, and the trash button in the request panel. Every
path asks first ("Delete 2 requests? Their tags, notes and WebSocket
messages go with them."): Enter deletes, Esc keeps them. There is no undo.
The `proxy.flows.deleted` event, from this window or another, removes the
rows from the history, the selection and the Comparer slots, opens the
next row when the open one was deleted, and refreshes the host counts.

## Replay

`POST /api/v1/vaults/{vault_id}/replay` sends a request, checks it against
the vault's scope and records it with `source = replay`. Header values are
sent as UTF-8 bytes exactly as written, so non-ASCII values reach the
target unchanged. Header names must be ASCII; anything else is refused
with 422 `invalid_value`. For a persistent workspace of edited requests,
use [Repeater](../repeater.md).
