The trawl CLI lets you create, run and debug your scraps from a terminal or a CI job. Each section below shows one command and what it prints.
Every command takes --json to print one JSON payload on stdout and nothing else, which is what a script or an agent should read. Commands that work on a scrap take its id, shown by trawl list.
Install
The quickest way: paste this to your AI agent. It installs the CLI and the Claude Code skills, asks you for an API key, checks the setup and creates a first scrap.
Or install it yourself (Node.js 22.12 or newer):
The answer:
npx @trawlme/cli <command> runs a command without installing. trawl upgrade moves the CLI to its latest version.
Install Trawl: https://trawl.me/install.mdnpm install -g @trawlme/cli
trawl --version4.0.8Sign in
Sign in once with your Trawl email and password. The session lasts 7 days.
The answer:
The first interactive trawl login also installs the Claude Code skills you don't have yet; restart Claude Code to see them. Set TRAWL_SKILLS_SYNC=0 to skip that.
For a script or CI, use an API key instead: it lasts up to 2 years and you can revoke it on its own. Create it under Developers → API Keys (see API keys), then set it for every command:
Optional: trawl login --url <url> points the CLI at another API, and trawl login --token <YOUR_SESSION_TOKEN> stores a session token you already have. trawl logout removes the stored session.
trawl login✓ Logged in as you@example.comexport TRAWL_API_KEY=<YOUR_API_KEY>
trawl listCreate a scrap from a goal
Give a page and what you want from it in plain words. Trawl writes the script, tests it on the live page, creates the scrap and runs it once.
The answer:
It can take several minutes; the CLI prints each step while it waits. The new scrap runs every Monday at 07:00 UTC: change it with trawl scraps update <id> --cron <expr>.
Optional:
--no-autofix: do not let AI fix the first run if it fails. Default: on.--no-digest: no AI summary mail after each run. Default: on when your account has an email.
If the command is cut before it answers, run trawl list before you try again: the scrap may already exist.
trawl create https://news.ycombinator.com --prompt "Title, link and points of each story"✓ Hacker News front page
Scrap ID: 64a1f2e3b5c6d7e8f9a0b1c2
Run ID: 65a0f2e3b5c6d7e8f9a0b1c4
First run: succeeded
Schedule: weekly Monday 07:00 UTC (cron 0 7 * * 1)
Sample: 30 items
Fields: title, url, points
Next step: trawl data 64a1f2e3b5c6d7e8f9a0b1c2 (details: trawl get 64a1f2e3b5c6d7e8f9a0b1c2)List your scraps
The answer:
status is the last run: ✓ success, ✗ failure, ▼ fewer items than usual, ↻ running, — never run. health shows ⚠ cron paused when the schedule skipped a run because the scrap keeps failing (see Schedule).
Optional:
--status <value>: only scraps whose last run issuccess,failure,never,runningorregression.--unhealthy: only scraps that failed their last 3 runs in a row.--limit <n>: the firstnscraps.--page <n>: one page of 50.
trawl listid title cron status health last run updated
64a1f2e3b5c6d7e8f9a0b1c2 Hacker News front page 0 7 * * 1 ✓ — 23/11/26 07:00 20/11/26 10:12
64a1f2e3b5c6d7e8f9a0b1c3 Shop prices 0 9 * * * ✗ ⚠ cron paused 23/11/26 09:00 18/11/26 16:40Get one scrap
The answer:
Without --json it prints the same scrap as a short summary. Every field is in Scrap Payload.
trawl get 64a1f2e3b5c6d7e8f9a0b1c2 --json{ "_id": "64a1f2e3b5c6d7e8f9a0b1c2", "title": "Hacker News front page", "url": "https://news.ycombinator.com",
"cron": "0 7 * * 1", "autoFix": true, "runs": [{ "_id": "65a0f2e3b5c6d7e8f9a0b1c4", "status": true, "statusDetail": "success", "length": 30 }] }Run a scrap and wait
run starts a run and waits until it ends, often 30 seconds to 4 minutes.
The answer:
Optional: --watch prints each step of the run until it ends. Read the rows with trawl data <id>.
trawl run 64a1f2e3b5c6d7e8f9a0b1c2✔ Scrap launchedStart a run without waiting
trigger queues a run and returns at once. Use it in CI: it does not hold the job open.
The answer:
Optional:
--wait: wait for the run to end.--watch: print each step until it ends. With either, the exit code tells whether the run succeeded.--param <key=value>, repeatable: run with your own values instead of a stored scenario. The keys are those of the scrap's first stored set (trawl get <id>shows them), all required;qandTRAWL.qare the same key. With an API key, this needstrawl:scraps:readbesidestrawl:scraps:run.
A scrap with stored params needs --param for each key: without it the run fails. When the scrap has no cron, trigger warns you on stderr, since nothing will check its health after this one run.
trawl trigger 64a1f2e3b5c6d7e8f9a0b1c2✔ Worker triggeredRead the latest results
data reads the rows of the last run. It does not start a run and costs nothing.
The answer:
Optional:
--json: the rows themselves, as a JSON array.[]means the run succeeded with no rows.--errors: why the last run failed, when it failed.--fresh: start a new run and print its rows. It costs a run.
trawl data 64a1f2e3b5c6d7e8f9a0b1c2Last run data:
Items: 30
First item keys: title, url, points
Use --json for full output.List past runs
The answer:
Newest first, 20 at most; -n <n> changes that. trawl history is the same command. hid is the run id: trawl run-info <hid> shows that one run with its error and the last selector it tried.
trawl runs 64a1f2e3b5c6d7e8f9a0b1c2 --json[{ "hid": "65a0f2e3b5c6d7e8f9a0b1c4", "status": "success", "time": 2384, "tier": "tier1", "failureKind": null, "blockType": null, "createdAt": "2026-11-23T07:00:12.000Z" }]Find why a run failed
scraps doctor explains the last run: status, error, the selector that failed, whether the site blocked it, and what auto-fix did.
The answer:
When the run landed on a login page, doctor says so and gives the command that fixes it, trawl scraps account session capture <id>.
Then, if you need more:
trawl scraps autofix <id>: the auto-fix decision, the code change and its test runs.trawl scraps snapshot <id> --error -o page.html: the page the run saw when it failed. Without--error, the page at the end of the run.
trawl scraps doctor 64a1f2e3b5c6d7e8f9a0b1c3Shop prices ● empty (empty)
Run ID: 65a0f2e3b5c6d7e8f9a0b1c9
Last selector tried: .product-card .price
Blocked: no
Proxy: Tier 1
Autofix: applied — selector_fix
→ full diff/dry-run: trawl scraps autofix 64a1f2e3b5c6d7e8f9a0b1c3 (or doctor --autofix)
Run at: 23/11/26 09:00Change a scrap
Create a scrap from a script you already have, change it, or delete it.
The answer:
scraps update options:
--cron <expr>or--no-cron: the schedule (see Schedule).--alert <email>or--no-alert: the mail sent when a run fails.--autofixor--no-autofix: let AI fix the script when the site changes.--digest,--no-digest,--digest-mode <latest|changes|changes_only>,--digest-prompt <text>: the AI summary mail (see AI features).-p '<json>'or--params-file <path>: the stored scenarios, a JSON array of objects. Each run picks one at random.-t,-u,-r,-d: title, target URL, script, description.
Other commands:
trawl scraps create -t <title> -u <url> [-r <script>]: a new scrap from your own script.-uis required.trawl scraps delete <id>(orrm): asks first;--forceskips the question.trawl scraps banner <id> -f <image>: the picture shown on the scrap's card (png, jpg or webp).trawl scraps watch <id>: follow the scrap's activity live.
trawl scraps update 64a1f2e3b5c6d7e8f9a0b1c2 --cron "0 * * * *" --alert you@example.com✔ Scrap updated: 64a1f2e3b5c6d7e8f9a0b1c2Scrap a site behind a login
Give Trawl a session, so the scrap runs as you.
A Chrome window opens on the scrap's site. Log in there (two-factor included), then press Enter in the terminal. The CLI keeps the cookies and local storage of that site and uploads them; Trawl never sees your password. It needs a screen, so it does not work in CI: there, upload a cookie file with trawl scraps account session set <id> -c cookies.json.
The answer, with --json (it never prints the session itself):
The other account commands are scraps account set <id> -u <user> (Trawl logs in for you), status, clear-session and delete. The full flow is in Account & sessions.
trawl scraps account session capture 64a1f2e3b5c6d7e8f9a0b1c2{ "account": { "hasSession": true, "sessionSavedAt": "2026-11-23T10:00:00.000Z" }, "targetDomain": "example.com",
"capture": { "cookiesCaptured": 4, "cookiesDroppedOutOfScope": 1, "cookiesDroppedInvalid": 0, "originsCaptured": 1, "originsDroppedOutOfScope": 0, "originsUnreadable": 0, "closedEarly": false } }Other commands
| Command | What it does |
|---|---|
trawl whoami |
Your user: id, email, roles. Needs trawl login, not a key. |
trawl ping |
Checks that the API answers. |
trawl token |
Prints the stored credential, for an MCP config. --json adds mode (apiKey or jwt) and the expiry. |
trawl orgs list, orgs current, orgs switch <id> |
Your organizations, and which one the CLI works in. Needs trawl login. |
trawl referral |
Your referral link. Needs trawl login. |
trawl skills install, list, update, uninstall |
The Claude Code skills: see Skills. |
trawl spec --json |
Every command and option, for a script or an agent. |
trawl upgrade [--check] |
Installs the latest CLI, or only says if there is one. |
trawl telemetry off, on, status |
Anonymous usage data, on by default. |
Run in CI
Store an API key as a secret named TRAWL_API_KEY, then trigger the scrap. --watch makes the step fail when the run fails.
Any other CI or deploy hook works the same: set TRAWL_API_KEY, then call npx @trawlme/cli trigger <id>.
- name: Run scrap
env:
TRAWL_API_KEY: ${{ secrets.TRAWL_API_KEY }}
run: npx @trawlme/cli trigger ${{ vars.SCRAP_ID }} --watchEnvironment variables
| Variable | What it does |
|---|---|
TRAWL_API_KEY |
An API key, used for every command except whoami, orgs and referral: they need trawl login and refuse to run while it is set. Wins over TRAWL_TOKEN and the stored login. |
TRAWL_TOKEN |
A session token, used for every command instead of the stored login. Lasts 7 days. |
TRAWL_API_URL |
Another API address. Default: https://api.trawl.me. |
TRAWL_CONFIG_DIR |
Where the CLI keeps its config file, e.g. an empty folder per CI job. |
TRAWL_TIMEOUT |
Time limit of every request, in milliseconds. It also cuts long commands like create. |
TRAWL_CHROME_PATH |
The Chrome used by session capture. PUPPETEER_EXECUTABLE_PATH and CHROME_PATH work too. |
TRAWL_SKILLS_SYNC |
0: never install or update the Claude Code skills on your behalf. |
TRAWL_TELEMETRY |
0: no usage data. DO_NOT_TRACK=1 does the same. |
TRAWL_NO_TIPS |
Set: no tips after a command. |
TRAWL_NO_UPDATE_NOTIFIER |
Set: no "new version" notice. |
Exit codes
| Code | Meaning |
|---|---|
0 |
Success. |
1 |
The command or the run failed. |
2 |
Wrong option or value. The CLI never waits for an answer when --json is set or there is no terminal: pass the value, or --force for a confirmation. |
3 |
Not signed in, or the session expired: run trawl login. |
4 |
Not found. |
5 |
The API could not be reached, or the request timed out. |
With --json, a failure prints { "error": { "message", "kind", "retryable" } } on stdout.
See also: API keys · Skills · Using Trawl with Claude
Next step → Skills