Command line

The mock

CommandWhat it does
start [--port 8080] [--admin-port 8081] [--foreground]Start the mock
stopStop it
statusShow the mode, the enabled packs and the active snapshot
url [service]Print the base URL to point a workflow at
log [--service s] [--limit n] [--follow]Show the requests the mock received
up / downStart or remove n8n and the mock together in Docker

Packs

CommandWhat it does
packs list [--installed]List shipped, installed and available packs
packs enable <ids…> / packs disable <ids…>Choose which services are mocked
packs install <ids…> [--ref r] [--no-verify]Download a pack that is not shipped in the package, checking each file's sha256 against the release index
packs init <service> --domain <host>Scaffold a pack to write by hand
packs validate [service] [--json]Check hand-written packs
packs build <service> [--spec f] [--fetch] [--domains a,b]Generate a pack from an OpenAPI file
packs update [services…]Refresh the cached OpenAPI files and rebuild what changed
packs eject <service> [--force]Copy a shipped pack into your project so you can edit it
packs resetReset stored resources to their seed data
packs auditDownload every source OpenAPI file and report on it

Faults

CommandWhat it does
faults set <service> [--status n] [--delay ms] [--empty] [--after n] [--once]Make calls to a service fail or slow down
faults clear [service]Remove faults

Failure scenarios

CommandWhat it does
auth revoke <service>Answer every call with the vendor's invalid-credential error
auth forbid <service>Answer every call with the vendor's missing-permission error
auth clear [service]Accept credentials again
limits set <service> --calls n --per <duration> [--route '<METHOD> <path>']Allow n calls per window, then answer the vendor's rate-limit error until the window ends
limits clear [service]Remove rate limits

Proxy mode and recording

CommandWhat it does
ca install [--host h] [--port n]Print the environment variables that point n8n at the proxy
on / offTurn interception on (replay) or off
record start / record stopRecord real traffic into a pack

Your n8n instance

CommandWhat it does
instances add <name> <url> <apiKey> [--default]Save an n8n instance and its API key
instances use <name> / instances listPick the default instance, or list them
snapshot <id|latest> [--workflow id] [--no-activate] [--commit]Turn one execution into mocks and activate them
diff [id]Compare a later execution against the active snapshot
creds push <type> [--name n] [--field k=v] [--dry-run]Create a placeholder credential on the instance
creds swap <workflow.json> [--in-place] [--real] [--via proxy]Point a workflow's URLs at the mock, or back at the real service
verify <service> --base-url u [--header h] [--param k=v] [--unsafe] [--patch] [--fail-on kinds]Compare a pack against the real service. Exits 1 on a difference

Fault injection

integration-mock faults set slack --status 503 --once

A 503 once, then a 200, and the log marking the fault

FlagEffect
--status nAnswer with this HTTP status
--delay msWait before answering
--emptyAnswer with an empty body
--after nLet the first n calls through
--onceRemove the fault after it fires

Faulted calls are marked FAULT in the log.

Failure scenarios in detail

Switch on what a workflow meets when a credential stops working or a vendor rate-limits it:

integration-mock auth revoke slack
integration-mock limits set hubspot --calls 10 --per 10s --route 'POST /crm/v3/objects/contacts'

Each answer is the vendor's own, from the pack's scenarios block (see packs.md); a pack without one answers a generic 401, 403 or 429. A rate-limit answer always carries Retry-After.

OptionEffect
--calls nCalls allowed per window (at least 1)
--per <duration>Window length: 500ms, 10s, 1m or 1h. The window opens at the first counted call
--route '<METHOD> <path>'Count and limit only this endpoint. The method may be *; the path uses pack-route syntax (:id matches one segment)

Credentials are checked first, then limits, then faults. A rejected or limited call does not count against the limit, and does not use up a fault. auth revoke, auth forbid and limits set refuse a service that is not enabled. Scenarios, like faults, answer only while the mock is serving: in replay mode and in base-URL mode, not while it is off or recording. The log marks these answers AUTH and LIMIT; integration-mock status lists what is switched on. Scenarios last until cleared or the mock restarts; packs reset leaves them in place.

The request log

integration-mock log --limit 3

Each line has the time, method, service, path, status and the route that answered. A call that no route matched shows unmatched.

Admin API

start also opens the admin port (--admin-port, default 8081). The CLI drives the mock through it; other tools can too. On loopback it needs no token. Bound anywhere else (INTEGRATION_MOCK_ADMIN_BIND), it generates one at start, writes it to ~/.integration-mock/proxy.json, and requires it as a bearer token.

Two endpoints exist for tools that run a workflow themselves, such as workflow-tester:

EndpointDoes
PUT /stores/<service>Replaces that service's records for this session, body { "<collection>": [records] }. POST /packs/reset brings back the pack's own seed. 404 for a service no pack provides
POST /serveAnswers one request, body { "method", "url", "headers"?, "body"? }, as if it had been intercepted: faults, scenarios, records and the request log apply. Reply { "status", "headers", "body" }. It never passes through: a URL no enabled pack claims gets a 501, logged as unmatched

Where files live

PathContentsCommit it?
./.integration-mock/packs/Packs you wrote, recorded or ejected. A recorded pack's provenance says when it was recorded, by which release, and that it was redactedYes
./.integration-mock/config.jsonWhich packs are enabledNo. It is gitignored
./.integration-mock/snapshots/SnapshotsNo, unless you pass --commit
~/.integration-mock/config.jsonSaved n8n instances and API keys, in plain text
~/.integration-mock/requests.jsonlThe request log, in plain text
~/.integration-mock/ca.pem, ca-key.pemThe local certificate authority for proxy mode. Created on first start

Set INTEGRATION_MOCK_HOME to move the ~/.integration-mock folder. Set INTEGRATION_MOCK_PACK_INDEX_URL to download packs from a mirror (<url>/<pack id>/<file>).