# Filtering

> Filter captured traffic in Cloak Proxy by URL, host or status, search every header and decoded body at once, and combine conditions, content chips and presets.

Source: https://docs.subcloak.com/cloak-proxy/inspect/filtering/

Filters cut a busy session down to the few requests you care about: one endpoint, every failed call, or every request and response that mentions a user ID, anywhere in its headers or body. Filters only change what you see; nothing is deleted, and clearing a filter brings every request back. To say exactly what you want in one line, such as `status:5xx app:ShopApp dur:>500ms -host:cdn.*`, type a query in the quick filter: see [Query language](https://docs.subcloak.com/cloak-proxy/inspect/query-language/).

There are four kinds of filter, and they all apply at once:

- The **quick filter**: the search field at the right of the filter bar, focused with <kbd>⌘</kbd> <kbd>F</kbd>.
- **Content filters**: the text tabs in the filter bar above the list, for HTTP or HTTPS, JSON, images, GraphQL and more.
- **Multiple filters**: several conditions combined with all or any, which you can save as presets.
- The [sidebar](https://docs.subcloak.com/cloak-proxy/inspect/sidebar/): one app or one domain.

A request is shown only when it passes every active filter. The bottom bar then reads **N of M rows**. Each [traffic tab](https://docs.subcloak.com/cloak-proxy/inspect/traffic-list/#traffic-tabs) keeps its own filters.

## Use the quick filter

1. Press <kbd>⌘</kbd> <kbd>F</kbd>, or click the search field at the right of the filter bar, next to **Filters**.

   The placeholder tells you what it searches: **Filter URLs or type status:5xx…** by default, **Filter host or type status:5xx…** or **Filter status code (regex)** for other choices, and **Search everything** for **All**. Typing a field, such as `status:`, makes it a [query](https://docs.subcloak.com/cloak-proxy/inspect/query-language/).

2. To search somewhere other than the URL, click the magnifying glass at the left of the field.

   - Under **Search in**, choose the part of the request to search.
   - Under **Match**, choose how the text must match.

3. Type your text.

   The list updates as you type for **URL**, **Host**, **Method** and **Status Code**. For headers, bodies and **All**, it waits for a short pause in your typing (a quarter of a second), so searching every body doesn't run on each keystroke. At the right of the filter bar, a count such as **12 of 27,053** shows how many requests match.

4. Press <kbd>Esc</kbd> or click the clear button in the field to remove the text.

### Search in

| Field | Searches |
|---|---|
| **URL** | The full URL, including scheme, host, path and query |
| **Host** | The host name only |
| **Method** | `GET`, `POST` and so on |
| **Status Code** | The response status, such as `404`. Empty for requests without a response. |
| **Request Header** | Each request header as one `Name: Value` line. A request matches if any line matches. |
| **Response Header** | Each response header as one `Name: Value` line |
| **Headers** | Request and response headers |
| **Request Body** | The request body, decompressed |
| **Response Body** | The response body, decompressed |
| **Body** | The request and response bodies |
| **All** | URL, method, status code, every request and response header, and both bodies |
| **Contract** (added in Cloak Proxy 0.4.0) | What [API Contracts](https://docs.subcloak.com/cloak-proxy/testing/contract-checking/) found: `violation`, `error`, `warning` or `passed`, and each problem's kind, JSON path and message. **Contract contains violation** shows the requests that broke their spec. |
| **GraphQL** (added in Cloak Proxy 0.4.0) | The GraphQL operation (`mutation CreateOrder`, its name or type), and for a 2xx response with GraphQL errors the word `errors`, each error's code and message. |
| **Query** (added in Cloak Proxy 0.4.1) | The text is a [typed query](https://docs.subcloak.com/cloak-proxy/inspect/query-language/); words in it search everything. A **Contains** filter on any other field also reads text with a field in it, such as `status:5xx`, as a query. |

With **Contains** and **Not Contains**, bodies are searched in full. With the other conditions, only the first 2 MB of each body is checked.

### Match

All conditions ignore upper and lower case. **Contains** and **Not Contains** compare the letters A to Z without case; accented and non-Latin letters must match exactly.

| Match | Matches when the value… |
|---|---|
| **Contains** | Contains the text anywhere |
| **Not Contains** | Doesn't contain the text. For headers and **All**, none of the values may contain it. |
| **Starts With** | Begins with the text |
| **Ends With** | Ends with the text |
| **Equals** | Is exactly the text |
| **Regex** | Matches the regular expression (ICU syntax, as used by macOS) |

### Examples

| To find | Search in | Match | Text |
|---|---|---|---|
| Every server error | **Status Code** | **Starts With** | `5` |
| Client and server errors | **Status Code** | **Regex** | `^[45]` |
| Requests that send a bearer token | **Request Header** | **Contains** | `Authorization: Bearer` |
| Everything except analytics | **Host** | **Not Contains** | `analytics` |
| A user ID anywhere in the traffic | **All** | **Contains** | `usr_42ab` |
| One versioned endpoint | **URL** | **Regex** | `/v[0-9]+/users/[0-9]+$` |
| Responses that set cookies | **Response Header** | **Starts With** | `Set-Cookie` |

> **Tip:**
> Body searches decompress gzip, deflate and Brotli bodies first, so you can search compressed responses as text.

## Search every request and response

(added in Cloak Proxy 0.2.1)

Set the quick filter to **All** and **Contains** to find a value anywhere in the session: an order ID, a token, an email address or an error message. Cloak Proxy looks in every URL, every request and response header, and every request and response body, decompressed, and shows the requests where it appears.

1. Press <kbd>⌘</kbd> <kbd>F</kbd>.

2. Click the magnifying glass at the left of the field and choose **All** under **Search in** and **Contains** under **Match**.

   To look only in one part, choose **Request Header**, **Response Header**, **Headers**, **Request Body**, **Response Body** or **Body** instead.

3. Type the value, for example `fc68188e`.

   The list shows every request that contains it, and the **Found In** column says where.

Upper and lower case don't matter, and the whole of each body is searched. Searching is fast even for large sessions: in a session of 30,000 requests with 77 MB of bodies, a search takes about 15 ms once the bodies have been searched once. The first search decompresses compressed bodies; Cloak Proxy keeps up to 256 MB of decompressed bodies in memory so later searches don't decompress them again. The search runs on all of your Mac's processor cores.

### The Found In column

While a **Contains** filter searches headers or bodies (any header or body field, or **All**), the traffic list shows a **Found In** column after **URL**. It lists every place the text appears in that request and its response, most useful first:

| Label | The text is in |
|---|---|
| **Res body** | The response body |
| **Req body** | The request body |
| **Res headers** | A response header, name or value |
| **Req headers** | A request header, name or value |
| **URL** | The URL |
| **Method/status** | The method or the status code (with **All**) |

For example, **Res body · Req headers** means the value came back in the response body and was also sent in a request header. The column disappears when you clear the filter or choose another field or condition. You can't sort by it or hide it from the column menu. See [Traffic list](https://docs.subcloak.com/cloak-proxy/inspect/traffic-list/).

### When a URL search finds nothing

If a **Contains** search of **URL**, **Host**, **Method** or **Status Code** matches no requests, the count turns orange and a **Search Everything** button appears next to it. Click it to switch the field to **All** and search headers and bodies too. (This button only changes the filter; it isn't the **Search Everything** panel you open with <kbd>⇧</kbd> <kbd>⌘</kbd> <kbd>A</kbd>.)

### Trace what you found

When the filter text is at least 3 characters (and isn't a [query](https://docs.subcloak.com/cloak-proxy/inspect/query-language/)), a **Trace** button appears next to the count. It opens [Trace Value](https://docs.subcloak.com/cloak-proxy/inspect/trace-value/) for the text: the response the value first came from, every request that sent it afterwards, and exactly where in each one.

> **Note:**
> An AI assistant can run the same search through the [MCP server](https://docs.subcloak.com/cloak-proxy/automation/mcp-server/) with the `search_requests` tool. It searches URLs, headers and decoded bodies of every request and returns where each match was found. See the [MCP tools reference](https://docs.subcloak.com/cloak-proxy/automation/mcp-tools-reference/#search_requests).

## Filter by content type and scheme

The text tabs in the filter bar, above the traffic list, filter by what a request carries.

*[Screenshot: The filter bar above the traffic list, with the All, HTTP, HTTPS, WebSocket, JSON, Form, XML, JS, CSS, GraphQL, Document, Image, Media, Font and Other tabs, the quick filter search field and the Filters button at the right. The content filters, the quick filter and Filters, all in the filter bar.]*

- Click a tab to show only that kind of request. Click it again to turn it off.
- <kbd>⌘</kbd>-click more tabs to show several kinds at once, for example **JSON** and **GraphQL**. <kbd>⌘</kbd>-click a selected tab to remove it.
- **HTTP** and **HTTPS** filter by scheme. They work separately from the other tabs, so **HTTPS** plus **JSON** shows JSON sent over HTTPS.
- **Violations** (added in Cloak Proxy 0.4.0) appears while an [API contract](https://docs.subcloak.com/cloak-proxy/testing/contract-checking/) is checking traffic. It shows only requests that broke their spec, by adding a **Contract contains violation** condition to [Filters](#combine-several-conditions).
- **GraphQL Errors** (added in Cloak Proxy 0.4.0) appears once a GraphQL response has come back with errors, with a count; it adds a **GraphQL equals errors** condition.
- **In Scope** (added in Cloak Proxy 0.5.1): only requests in the active [scope](https://docs.subcloak.com/cloak-proxy/security/scope/), in every tab. Shown while a scope is active.
- **All** turns off every tab, including **HTTP** and **HTTPS**.
- When the list is too narrow for every tab, for example with the inspector on the right, in Split View, or with **Violations** or **GraphQL Errors** showing, the tabs that don't fit go into a **More** menu at the end. Tabs that are on always stay in view. <kbd>⌘</kbd>-click in the menu combines, as on a tab.

To hide the filter bar, click **Filter** in the [bottom bar](https://docs.subcloak.com/cloak-proxy/getting-started/interface-tour/#bottom-bar). The quick filter is part of it; <kbd>⌘</kbd> <kbd>F</kbd> shows the filter bar again and puts the cursor in the quick filter.

| Tab | Shows requests where |
|---|---|
| **HTTP** | The URL scheme is `http` |
| **HTTPS** | The URL scheme is `https` |
| **JSON** | The content type contains `json` |
| **Form** | The request body is `application/x-www-form-urlencoded` or `multipart/form-data` |
| **XML** | The content type contains `xml` |
| **JS** | The content type contains `javascript` or `ecmascript` |
| **CSS** | The content type is `text/css` |
| **GraphQL** | The request is a GraphQL query, mutation or subscription sent over HTTP |
| **AI** (added in Cloak Proxy 0.4.0) | Calls to model APIs: OpenAI Chat Completions and Responses, Anthropic Messages, Gemini, Ollama and OpenAI-compatible servers. See [LLM Inspector](https://docs.subcloak.com/cloak-proxy/inspect/llm-inspector/). |
| **Document** | The content type is `text/html` |
| **Image** | The content type starts with `image/` |
| **Media** | The content type starts with `audio/` or `video/`, or is an HLS playlist (`mpegurl`) |
| **Font** | The content type starts with `font/`, or is WOFF or OpenType |
| **WebSocket** | The request upgrades to a WebSocket |
| **Other** | None of the above |

The content type is the response's `Content-Type`, or the request's when the response has none. A request can belong to more than one tab: a GraphQL request is also **JSON**, and a form post that returns HTML is both **Form** and **Document**.

## Combine several conditions

Use multiple filters when one condition isn't enough, for example “URL contains `users` and status equals `200`”.

1. Click **Filters** at the right of the filter bar.

   A panel opens with one empty condition.

2. For each condition, choose a field, a match and type a value. They use the same [fields](#search-in) and [matches](#match) as the quick filter.
3. Click **Add Condition** for another row, or the minus button to remove one.
4. At the top, choose whether requests must match **all** or **any** of the conditions.

   The panel shows how many requests match as you edit, for example **3 of 38 requests match**.

5. Click outside the panel to close it. The button shows the number of active conditions, such as **Filters 2**.

*[Screenshot: The multiple filters panel: Show requests matching all of these conditions, with URL Contains users and Status Code Equals 200, and the Add Condition, Clear and Save as Preset buttons. Two conditions that must both match.]*

Conditions with no value are ignored. The conditions apply together with the quick filter, the content filters and the sidebar. **Clear** resets the panel to one empty condition.

The panel also shows its conditions **As a query**, and **Move to Query Bar** moves them into the quick filter. A **Query** condition takes a typed query, for conditions the panel has no field for, such as `dur:>500ms`. See [Queries and the Filters panel](https://docs.subcloak.com/cloak-proxy/inspect/query-language/#queries-and-the-filters-panel).

## Save and reuse presets

Presets save a set of conditions under a name so you can bring them back in any session. Cloak Proxy remembers them between launches.

  **Save a preset**

    1. Set up your conditions in the multiple filters panel.
    2. Click **Save as Preset…**. It's available once at least one condition has a value.
    3. Type a name and click **Save** (or press <kbd>Return</kbd>).

       Saving with the name of an existing preset replaces it.

  **Use a preset**

    1. Open the multiple filters panel.
    2. Click **Presets** and choose a preset by name.

       Its conditions and its all or any setting replace what's in the panel.

  **Delete a preset**

    1. Open the multiple filters panel.
    2. Choose **Presets › Delete** and pick the preset.

## Reset every filter

When any filter is on, a **Reset** button appears at the right of the filter bar. It clears the quick filter text, the multiple filter conditions, every content filter, and the sidebar selection (back to **All Traffic**). Saved presets are kept.

You can also reset from the empty list (**Reset Filters**) or from [Search Everything](https://docs.subcloak.com/cloak-proxy/inspect/search-and-command-palette/) (**Reset Filters**). Search Everything also has a **Show Only** action for each content type, such as **Show Only JSON**.

> **Note:**
> Filters hide requests from the list and the bottom bar count. **File › Export** exports the visible requests unless you've selected more than one, so a filter is also a quick way to export a subset. See [Export](https://docs.subcloak.com/cloak-proxy/sessions/export/).

## Related

  - [Query language](https://docs.subcloak.com/cloak-proxy/inspect/query-language/): Filter with one typed line, with autocomplete, saved queries and extract columns.
  - [Traffic list](https://docs.subcloak.com/cloak-proxy/inspect/traffic-list/): Columns, sorting, highlights and comments.
  - [Sidebar](https://docs.subcloak.com/cloak-proxy/inspect/sidebar/): Show one app or one domain.
  - [Trace Value](https://docs.subcloak.com/cloak-proxy/inspect/trace-value/): Follow an ID or token from the response it came from to every request that sent it.
  - [Export](https://docs.subcloak.com/cloak-proxy/sessions/export/): Save the requests you filtered as HAR, CSV, Postman or OpenAPI.
  - [Contract checking](https://docs.subcloak.com/cloak-proxy/testing/contract-checking/): Filter to the requests that break your OpenAPI spec.
