Trawl

Quickstart

Run a scrap with one call and get its data back as JSON. You need a scrap id and an API key; the setup below gives you both in a few minutes.

Setup

  1. Sign up at trawl.me (free, no card: you start with 10,000 compute units).
  2. Click New scrap, paste a URL and say what to extract in plain English. The AI wizard writes the script, tests it on the live page until it gets data, then runs it once (often 60-400s). Copy the scrap id from the URL: trawl.me/scraps/<id>, 24 hex characters.
  3. Open Developers → API Keys, click Create Key and pick the access Full access: it holds the trawl:scraps:run scope this call needs. Copy the key: it starts with trawl_ and is shown once.

Run your scrap

POST /api/scraps/worker/<scrap_id> runs the scrap and answers with its data. Put your scrap id in the URL and your key in the header:

The answer: data.result is the list your script returned.

What to know about this call:

  • It waits for the run to end, often 30-250s. Give your HTTP client a long timeout.
  • The body: {} for a scrap with no parameters. A scrap with parameters needs its values in the body; see Run with your own values.
  • ?wait=false (optional, in the URL): the call answers at once with "status": "queued" and the run goes on in the background. The body is still checked first.
  • 422: the body does not fit the scrap's parameters, or the run failed (the answer says why).
  • 429: a run of this scrap is already going on, or Trawl is at full load. Try again a bit later.

How the run went (success, empty, error, regression) is kept on the run record: see Results & payload.

curl -X POST "https://api.trawl.me/api/scraps/worker/<scrap_id>" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{}'
Response
{
  "type": "success",
  "message": "scrap loaded",
  "data": {
    "result": [
      { "title": "Show HN: Trawl", "points": 128 },
      { "title": "AI search engines", "points": 94 }
    ]
  }
}

Run it from the web app

In the scrap workspace, click the green Run button. The JSON shows up in the output panel when the run ends, and the Run tab keeps every run.

Run it on a schedule

Open Settings → Schedule, turn on Schedule and pick a preset or a cron expression. See Scheduling.

Common problems

  • 401: the key is missing, wrong, expired or revoked. Check the Authorization header, or make a new key.
  • 403: the key lacks the trawl:scraps:run scope (a Read only key), or it is limited to other scraps. Make a Full access key that reaches this scrap; see API keys.
  • Empty result (empty): the page loads its content late. Wait for a key element before reading; see Scraping basics.
  • Worked once, then broke: the site changed. Turn on Auto-fix; see AI features.
  • The page needs a login: see Account & sessions.

What's next

Next step → Scraping basics