POST /v2/batch/scrape takes the URLs and the options every document of the batch scrape gets:
{"urls": ["https://example.com", "not a url"], "responseOptions": {"format": "html", "onlyMainContent": false},
"ignoreInvalidURLs": true,
"webhook": {"url": "https://receiver.example/hook", "headers": {"X-Token": "t"}, "metadata": {"run": "7"},
"events": ["start", "finish"], "secret": "at-least-16-characters"}}and answers:
{"success": true, "id": "<id>", "url": "https://api.elisebot.dev/v2/batch/scrape/<id>", "invalidURLs": ["not a url"]}- A URL without a scheme, such as
example.com, is taken as https. - Invalid URLs are dropped and listed; with
ignoreInvalidURLs: falsethey are a 422, and so is a batch scrape with no valid URL left. - The POST always answers at once, whatever the URL count; the documents come in one package once the batch scrape ends.
webhookis described under Webhooks.
Status
GET /v2/batch/scrape/{id}, with the organization’s API key, answers:
{"success": true, "status": "completed", "total": 3, "completed": 3, "createdAt": "...", "expiresAt": "...",
"completedAt": "...", "package": {"status": "ready", "bytes": 4120,
"url": "https://api.elisebot.dev/v2/batch/scrape/<id>/download?token=<token>"}}statusisscraping,completedorcancelled.completedcounts the URLs with a result, failed and cancelled ones included, so a finished batch scrape hascompleted == total;completedAtmarks it.package.statusispendinguntil the batch scrape ends and its results are packaged, thenready, withurland its size inbytes. It isfailedwhen packaging gave up; the batch scrape’s credits are then refunded.webhookStatusandwebhookErrorgive each chosen webhook event’s state (pending,delivered,failed) and failure.- A batch scrape and its content live 1 day, then answer 404
BATCH_SCRAPE_NOT_FOUND, as does another organization’s batch scrape or a scrape id.
Download
GET on package.url answers 302 to a presigned URL, valid for 5 minutes, that serves the file as
<id>.ndjson.gz. The token in the URL is the capability, so no API key is needed:
curl -L -o results.ndjson.gz '<package.url>'
gunzip -c results.ndjson.gz | jq -r .metadata.url- The file is gzipped NDJSON: one document per line, in URL order, failed and cancelled URLs included. Each line has
the shape
POST /v2/scrapereturns asdata. - A package that is not ready yet is a 409
PACKAGE_NOT_READY, and a failed one a 409PACKAGE_FAILED. An unknown batch scrape or a wrong token is a 404BATCH_SCRAPE_NOT_FOUND. - Each batch scrape has 10 result reads an hour, past which the answer is 429 with
Retry-After. Every download counts, a 409 included; status reads do not.