Set fault rule
set_fault_ruleInject failures into a workspace's mock responses so you can test how the client copes: error statuses (e.g. 503, or 429 with Retry-After), latency, null or dropped JSON fields, or empty lists. Matches by optional method and a path glob, fires with the given probability, and expires automatically (default 60 minutes). For a fault on a single request, send the X-APIMock-Fault header instead (e.g. X-APIMock-Fault: 429;retry-after=2).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | kind=status: response body. Defaults to a gateway-style JSON error. | |
| kind | Yes | status: return an error status. latency: delay the response. nullify / drop_field: damage JSON fields. empty: return an empty list. | |
| name | No | Label shown in the dashboard. | |
| method | No | Only match this HTTP method. Omit to match every method. | |
| status | No | kind=status: HTTP status. | |
| delay_ms | No | kind=latency: base delay in ms (max 30000). | |
| spike_ms | No | kind=latency: extra delay added on a spike. | |
| jitter_ms | No | kind=latency: uniform ± jitter in ms. | |
| workspace | Yes | Target workspace slug (from list_workspaces). | |
| probability | No | Chance (0-1) that a matching request gets this fault. | |
| retry_after | No | kind=status: Retry-After seconds (useful with 429 and 503). | |
| route_pattern | No | Glob over the request path. `*` matches any characters, including `/`. | /* |
| field_probability | No | kind=nullify/drop_field: per-field chance of damage (0-1). | |
| spike_probability | No | kind=latency: chance of an extra spike. | |
| expires_in_minutes | No | Minutes until the rule switches itself off (default 60, max 10080 = 7 days). |