Rules
A rule changes traffic as it passes through: redirect it, rewrite it, pause it, delay it, or answer it from a file. Rules live in the Rules tab (⇧⌘R), group into folders, and each rule can bundle several changes. Each rule family also has a master on/off switch.
Match conditions
Every rule matches the request first. The common fields:
| Field | Matches |
|---|---|
| Pattern | Host and path. * matches anything; a leading ~ makes it a regex; otherwise it is a prefix glob over host/path?query. |
| Method | A specific method, or empty for any. |
| GraphQL | A GraphQL operation name. |
| Only if header | name, name: text, or name: ~regex. |
| Only if body contains | Text, or ~regex. |
| Folder | Group rules; a folder toggles as a unit. |
Paste a URL into the filter bar to see which rules would match it.
Rule types and their fields
| Type | What it does & its fields |
|---|---|
| Breakpoint | Pause to edit by hand. Fields: Request, Response, WebSocket messages. |
| Map local | Answer from a local file; the server is never hit. Fields: Status, Content-Type, Delay (ms), Headers, Body or a body file. |
| Map remote | Redirect to another URL. Field: Send to (e.g. http://localhost:3000). |
| Map folder | Serve a whole directory for a matching path. Field: Folder. |
| Header | Add, change or remove a header. Fields: On request / On response, Name, Value (empty removes it). |
| Rewrite | Find and replace with regex groups. Fields: Target (URL, request header, request body, status, response header, response body), Find (regex), Replace ($1 groups). |
| JSON patch | Change fields in a JSON body, leaving the rest live (RFC 7386 merge; null deletes). Fields: Request body / Response body, the patch. |
| Script | Run code on the request or response — see scripting. Fields: Language (Rhai, JavaScript, Python), On request / On response, the code. |
| Block | Return a status (e.g. 403) instead of reaching the server. |
| Drop connection | Cut the connection, to test a hard network failure. |
| Suspend | Delay the request or response, to test slow networks and timeouts. |
| Replay HAR | Answer from a recorded HAR file, offline. Field: the recording (.har from elcapture, a browser, Charles or Proxyman). |
Edit rules as JSON
Rules are plain JSON. Export them, check them into a repo, import them back, or set them from a script or an AI agent — see the command line and MCP. You can also add most rule types straight from a request's right-click menu (Mock, Rewrite, JSON patch, Map remote, Header, Script, Block this host).