An API key lets your code call Trawl without a login: list your scraps, run them and read their results.
Keys work on every plan, Free included; what you run is paid from your compute balance. The same key works in the CLI (set TRAWL_API_KEY) and the MCP server.
Authenticate
Send the key after Bearer in the Authorization header of every call. This one lists your scraps (scope trawl:scraps:read):
The answer:
Optional: search (text found in a scrap's title or script), page (from 0) and perPage (default 50). The X-Total-Count header gives the number of scraps. The fields of a scrap are in Scrap Payload.
curl https://api.trawl.me/api/scraps \
-H "Authorization: Bearer <YOUR_API_KEY>"{ "type": "success", "message": "scrap list",
"data": [{ "id": "64a1f2e3b5c6d7e8f9a0b1c2", "title": "Hacker News — AI search", "url": "https://news.ycombinator.com/search", "cron": "0 9 * * 1" }] }Get an API key
In the web app, open Developers → API Keys, click Create, then pick a name, an expiry date, an access and, if you want, the scraps the key may reach. Copy the key at once: it is shown only once. A key is trawl_ followed by 40 characters.
The access is a fixed set of scopes:
- Shops data, read only:
trawl:shops:read. Offered, and preselected, in a Shops client organization only. It cannot be limited to scraps. - Read only:
trawl:scraps:readandtrawl:history:read. It cannot run a scrap or read Shops data. - Full access: every scope. A key made before this choice existed has full access too.
Create a key over the API
Keys are managed from your logged-in session, not with a key. Your session token is the TOKEN cookie of the web app. Only name is needed:
The answer: plainKey is the key, shown this once.
Optional fields:
| Field | What it does | Where the value comes from |
|---|---|---|
expiresAt |
When the key stops working. Default: one year from now. It must be in the future and at most 2 years away, or the answer is 422. |
A date you pick, ISO 8601 (2027-06-01T00:00:00Z) |
scopes |
The actions the key may do. Empty or left out: every action. | The scope table |
scrapIds |
The only scraps the key may reach. Empty or left out: every scrap of the organization. | The id of each scrap, from GET /api/scraps |
A key cannot be changed: create a new one and revoke the old one. A key made before expiry dates existed works until you revoke it.
curl -X POST https://api.trawl.me/api/developers/keys \
-H "Cookie: TOKEN=<YOUR_SESSION_TOKEN>" \
-H "Content-Type: application/json" \
-d '{ "name": "ci-pipeline" }'{ "type": "success", "message": "api key created",
"data": { "id": "6650a1b2c3d4e5f6a7b8c9d0", "name": "ci-pipeline", "prefix": "trawl_3f9a1c", "expiresAt": "2027-11-23T10:00:00.000Z",
"scopes": [], "scrapIds": [], "revoked": false, "plainKey": "trawl_3f9a1c…" } }Revoke a key
In the web app, open Developers → API Keys and revoke the key. Over the API, revoke it from your logged-in session, as you create one. The key id is the id of the create answer, or of GET /api/developers/keys:
The answer, trimmed: the key, now revoked. From then on, a call with it answers 401.
An unknown id answers 404 ("description": "No API key with that identifier has been found").
curl -X DELETE https://api.trawl.me/api/developers/keys/<KEY_ID> \
-H "Cookie: TOKEN=<YOUR_SESSION_TOKEN>"{ "type": "success", "message": "api key revoked",
"data": { "id": "6650a1b2c3d4e5f6a7b8c9d0", "name": "ci-pipeline", "prefix": "trawl_3f9a1c", "expiresAt": "2027-11-23T10:00:00.000Z",
"scopes": [], "scrapIds": [], "revoked": true } }Run a scrap
A key with trawl:scraps:run starts a run and waits for its rows. The scrap id comes from GET /api/scraps:
The answer:
A scrap with stored parameters needs them as a JSON body; that, ?wait=false and the errors of a run are in Quick start.
curl -X POST https://api.trawl.me/api/scraps/worker/<SCRAP_ID> \
-H "Authorization: Bearer <YOUR_API_KEY>"{ "type": "success", "message": "scrap loaded", "data": { "result": [{ "title": "Show HN: Trawl", "points": 128 }] } }Read the runs
A key with trawl:history:read reads the runs of your scraps:
The answer:
Every field of a run is in Run row fields. Shops data (trawl:shops:read) has its own calls in the Shops guide.
curl https://api.trawl.me/api/runs \
-H "Authorization: Bearer <YOUR_API_KEY>"{ "type": "success", "message": "history list",
"data": [{ "id": "65a0f2e3b5c6d7e8f9a0b1c4", "scrap": "64a1f2e3b5c6d7e8f9a0b1c2", "status": true, "statusDetail": "success", "length": 3, "time": 2384, "triggeredBy": "api" }] }Routes a key can reach
| Method | Path | Scope | What you get |
|---|---|---|---|
GET |
/api/scraps |
trawl:scraps:read |
Your scraps (?search=, ?page=, ?perPage=) |
GET |
/api/scraps/:id |
trawl:scraps:read |
One scrap |
POST |
/api/scraps/worker/:id |
trawl:scraps:run |
Runs a scrap |
GET |
/api/scraps/load/:id |
trawl:scraps:run |
Runs a scrap, same effect as the worker route |
POST |
/api/scraps |
trawl:scraps:write |
Creates a scrap from your own script |
POST |
/api/ai/wizard |
trawl:scraps:create |
Writes and creates a scrap from a description (see MCP Server) |
GET |
/api/scraps/:id/data |
trawl:history:read |
The rows of the scrap's last run, without a new run. Growth and Pro only (403 PLAN_REQUIRED on Free) |
GET |
/api/scraps/:id/activities |
trawl:history:read |
The activity log of a scrap |
GET |
/api/runs |
trawl:history:read |
Your latest runs (?triggeredBy=user, api or cron) |
GET |
/api/runs/:id |
trawl:history:read |
One run |
GET |
/api/shops/summary, /sales, /matches, /fixes, /export |
trawl:shops:read |
Your Shops data (Shops clients only, 404 otherwise); see the Shops guide |
GET, POST |
/api/shops/lookup |
trawl:shops:read |
One or many of your rows matched to the brand's products; see the Shops guide |
Changing or deleting a scrap, and managing keys and webhooks, take a logged-in session.
Action scopes
scopes lists the actions a key may do. Scopes add to the scrap limit: a call needs both the right scope and an allowed scrap.
| Scope | Grants |
|---|---|
trawl:scraps:read |
List your scraps, read one |
trawl:scraps:run |
Run a scrap |
trawl:scraps:create |
Create a scrap with the AI wizard |
trawl:scraps:write |
Create a scrap from your own script (POST /api/scraps) |
trawl:history:read |
Read runs, a scrap's last rows and its activity log |
trawl:shops:read |
Read your Shops data |
trawl:tasks:read, trawl:webhooks:manage, trawl:api-keys:manage |
Reserved: no route takes them yet |
A call outside the key's scopes answers 403, and the WWW-Authenticate header names the missing scope (RFC 6750):
{ "type": "error", "message": "Forbidden", "description": "API key missing required scope(s): trawl:scraps:run" }Scoping keys to specific scraps
A key with scrapIds reaches only those scraps. Each id must be a scrap of your organization, or the creation is refused. Then:
GET /api/scrapslists only the allowed scraps.- A call on another scrap by id answers
403with"description": "API key not scoped to this scrap". - Shops data is refused (
403): it is not a scrap.
Rate limits
| Calls | Limit |
|---|---|
Reads: /api/scraps…, /api/runs…, /api/shops/* |
120 a minute per key owner, shared by all the owner's keys and web session (Shops: see below) |
POST /api/scraps/worker/:id and POST /api/ai/wizard |
60 per 15 minutes per key owner |
GET /api/scraps/load/:id |
30 per 15 minutes per key owner |
POST /api/mcp |
60 a minute per IP address, then 120 a minute per caller |
Shops.
| Calls | Limit |
|---|---|
| Every call | 120 a minute per person (a key counts for its owner, with that person's web session) |
Shops reads: the matches, a product page, the fixes, the export, a one-product lookup (GET /api/shops/lookup) |
30 a minute per person, all together |
| The matches, a product page, the fixes, a one-product lookup | 200 a day per person, all together |
The export (GET /api/shops/export) |
10 a day per organization, all its people and keys together |
Lookup batches (POST /api/shops/lookup) |
10 a day per organization, 200 rows of 20 brands each |
Lookups (GET and POST /api/shops/lookup together) |
3 a minute per person |
A brand we do not read yet is noted: the brands asked most are added to the next day's brand scraps, at most 5 a day.
Past a limit the answer is 429 (JSON-RPC -32005 rate_limited on MCP): wait for the RateLimit-Reset header (seconds), then go on. For the Shops answers, see When it goes wrong.
See also: MCP Server · Webhooks · Scrap Payload
Next step → Webhooks