# Compare Requests

> Put two requests side by side and see exactly how their headers and bodies differ

Source: https://www.apitraffic.io/docs/compare-requests

When one call works and a nearly identical one fails, the answer is usually in a header or a
field you would never spot by reading both. Compare puts any two requests from the same bucket
next to each other and highlights what changed.

## Comparing two requests

1. In the request list, open the first request's **⋮** menu and choose **Compare**. It becomes
   request **A** and a tray appears at the bottom of the screen.
2. Open a second request's **⋮** menu and choose **Compare with A**. It becomes request **B** and
   the comparison opens.

To take a request back out, choose **Remove from Compare** in its menu, or use the **×** beside it
in the tray. The tray stays while you move between pages in the bucket, so the second request can
come from a search, the Errors page or another time range. Closing the comparison leaves both picks in the tray; **Compare** reopens it.

## What the comparison shows

- **Overview**: method, URL, status, duration, sizes and direction, with the rows that
  differ marked.
- **Request** and **Response** tabs, each with:
  - **Headers**, matched by name regardless of case. Each one is marked as changed, only in A,
    or only in B.
  - **Body**, as a side-by-side line diff. The changed part of an edited line is highlighted.

A dot on a tab means that half has differences. The comparison opens on the half that differs,
so it starts on the response when the requests themselves are identical.

## Options

| Option | Default | What it does |
| --- | --- | --- |
| Only show differences | Off | Hides identical headers and folds unchanged body lines (click a fold to expand it) |
| Sort JSON keys | Off | Sorts the keys of JSON bodies, so a difference in key order alone is not reported as a change. JSON is always re-indented, so whitespace never is |
| Swap (⇄) | | Swaps A and B |

## Notes

- You compare two requests at a time. Picking a third replaces **B**, so **A** stays as the
  baseline.
- Both requests have to come from the same bucket. Picking one in a different bucket starts
  a new comparison.
- Bodies that have passed your plan's retention period, captures (which have no response) and
  requests blocked by the firewall are labelled as such instead of being shown as empty.
- Your picks are kept for the browser tab, so a reload does not lose them.
