Batch analysis
Submit up to 1,000 domains, poll for status, stream partial results, download the finished set as NDJSON, and get a signed webhook on completion.
The batch API takes a list of domains and profiles them in the background. You submit once, get a batch id back in milliseconds, then poll for status and page through results while the batch is still running - or wait for a signed webhook when it finishes. Each item returns exactly what the single-URL endpoint (Website Insights) would return for that domain, so one parser serves both surfaces.
The flow is always the same four steps:
POST /v2/insights → 202 with the batch object (billed here)
GET /v2/insights/{id}/status → progress counters (free)
GET /v2/insights/{id}/results → paginated per-domain results (free)
GET /v2/insights/{id}/download → NDJSON of every result (free, when finished)All batch endpoints sit under the same prefix as the rest of the API,
e.g. https://api.dataloom.dev/website-insights/v2/insights.
1. Submit a batch
curl "https://api.dataloom.dev/website-insights/v2/insights?dataset=all-insights" \
-X POST \
-H "Authorization: Bearer $DATALOOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": ["stripe.com", "github.com", "not-a-domain"]}'Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset | string | all-insights | Which dataset to compute for every domain: all-insights (the full profile) or similar-sites. |
wait | int 0–30 | 0 | Long-poll: hold the response up to this many seconds for the batch to finish. Returns 200 with the final batch object when it finishes in time, 202 otherwise. |
Body:
| Field | Type | Required | Description |
|---|---|---|---|
urls | string[] | yes | 1 to 1,000 domains or URLs. |
callback_url | string | no | HTTPS URL to POST a signed completion notification to - see webhooks. |
The response is the batch object (202 Accepted, or 200 when
wait caught the finish):
{
"id": "batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77",
"object": "batch",
"status": "queued",
"dataset": "all-insights",
"created_at": "2026-11-19T12:00:00.000000+00:00",
"completed_at": null,
"expires_at": null,
"summary": {
"submitted": 3,
"unique": 3,
"duplicates": 0,
"failed": 1,
"pending": 2,
"insight_level": {}
},
"status_url": "/website-insights/v2/insights/batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77/status",
"results_url": "/website-insights/v2/insights/batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77/results"
}When you submitted a callback_url, the submit response additionally
carries webhook_secret - the key used to verify the callback's
signature. It is returned only here, once; store it alongside the
batch id.
Store the id - everything else keys off it.
Deduplication and item indexing
Items are deduplicated on their registered domain, so URL variants,
subdomains of the same root, and case differences collapse into one
item: https://www.GitHub.com/docs and GITHUB.COM are one entry.
- Each result row's
indexis the position of the item's first occurrence in your list; theurlfield echoes the item exactly as you submitted it (whitespace-stripped). - Later duplicates are reported in the row's
duplicate_indexes, so you can map results back onto your original list positions. - Invalid items (not parseable as a domain) become immediate
INVALID_URLerror rows at submit time and cost nothing.
Billing is 1 credit per unique valid domain, charged once at submission - duplicates and invalid items are free, and every status, results, download, and cancel call afterwards is free (0 credits). See billing.
Idempotent submissions
Send an Idempotency-Key header to make retries safe - a network
timeout after submit will never create a second batch:
-H "Idempotency-Key: my-cron-2026-11-19"- Same key + same body: the existing batch is returned, with no new work and no new charge.
- Same key + a different body:
409 IDEMPOTENCY_CONFLICT- nothing is processed. - Keys are remembered for 24 hours.
2. Poll status
curl "https://api.dataloom.dev/website-insights/v2/insights/batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77/status" \
-H "Authorization: Bearer $DATALOOM_API_KEY"The batch object's status moves through this lifecycle:
| Status | Meaning |
|---|---|
queued | Accepted, waiting for a worker. |
running | Being processed. |
cancelling | Cancel was requested; stops scheduling new fetches. Transient. |
completed | Every domain succeeded. |
partial | Some succeeded, some failed. |
failed | Every domain failed. |
cancelled | Cancelled by you. |
The summary counters tell you how far along it is:
{
"submitted": 3,
"unique": 3,
"duplicates": 0,
"failed": 1,
"pending": 2,
"insight_level": { "complete": 1, "insufficient_data": 1 }
}Two of the counters split by meaning:
failedandpendingcount execution outcomes: every error row (including the submit-time invalid items) and every item that has not finished yet. Aninsufficient_dataitem was processed without error, so it is notfailed.insight_levelcounts what the successful bodies actually contain:complete,zero_traffic,insufficient_data, orcrawler_blocked.
completed_at and expires_at are set once the batch reaches a
terminal status.
Poll at a reasonable interval - a few seconds is plenty. Crashed work
is detected and resumed automatically (in-progress results are kept), so
an occasional running status for longer than expected does not mean
the batch is lost.
3. Read results
Results are available while the batch is still running - you never have to wait for the whole list before acting on the first rows.
curl "https://api.dataloom.dev/website-insights/v2/insights/batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77/results?offset=0&limit=100" \
-H "Authorization: Bearer $DATALOOM_API_KEY"| Parameter | Type | Default | Description |
|---|---|---|---|
offset | int | 0 | Result index to start from. |
limit | int 1–500 | 100 | Max results per page. |
{
"id": "batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77",
"object": "batch.results",
"status": "running",
"offset": 0,
"limit": 100,
"next_offset": 2,
"results": [
{
"url": "https://www.Example.com/path",
"index": 0,
"duplicate_indexes": [2],
"attempts": 1,
"data": {
"status": "success",
"website": "example.com",
"snapshot_date": "2026-10-01",
"insight_level": "complete",
"rankings": { "global": 826 }
},
"error": null
},
{
"url": "not-a-domain",
"index": 1,
"duplicate_indexes": [],
"attempts": 0,
"data": null,
"error": {
"code": "INVALID_URL",
"message": "The submitted item is not a valid domain or URL.",
"retryable": false
}
}
]
}How to read a page:
- Rows arrive in submission order (
indexascending) - the same order the download uses - not completion order. Keep paging whilenext_offsetis set; once the batch is terminal,next_offsetisnullon the last page. While the batch is still running, paging can re-deliver an entry that completed after your cursor (dedupe byindex), but it never skips one. datavserroris the only discriminator - a row never has both.datacarries the flattened body of the dataset you chose, byte-identical in shape and field order to what the single-URL endpoint returns; its own top-levelstatus/insight_levelsaycomplete,zero_traffic, orinsufficient_data. Anulldatameans the row failed anderrorexplains why.attemptsis the number of internal lookup passes:0for submit-timeINVALID_URLrows,1otherwise (proxy rotations happen inside that one pass and are not surfaced).- A
retryable: trueerror (transient upstream failure) is worth resubmitting as a new batch later;retryable: falseis a bad item - see item-level errors below.
Python polling example
import time, requests
BASE = "https://api.dataloom.dev/website-insights/v2/insights"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
batch = requests.post(BASE,
params={"dataset": "all-insights"},
json={"urls": domains},
headers=HEADERS).json()
while batch["status"] not in ("completed", "partial", "failed", "cancelled"):
time.sleep(5)
batch = requests.get(f"{BASE}/{batch['id']}/status",
headers=HEADERS).json()
results, offset = [], 0
while offset is not None:
page = requests.get(f"{BASE}/{batch['id']}/results",
params={"offset": offset, "limit": 500},
headers=HEADERS).json()
results.extend(page["results"])
offset = page["next_offset"]4. Download everything at once
Once the batch is terminal, fetch every result as
NDJSON - one JSON result row per line,
sorted by submission index:
curl "https://api.dataloom.dev/website-insights/v2/insights/batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77/download" \
-H "Authorization: Bearer $DATALOOM_API_KEY"{"url": "https://www.Example.com/path", "index": 0, "duplicate_indexes": [2], "attempts": 1, "data": {...}, "error": null}
{"url": "github.com", "index": 1, "duplicate_indexes": [], "attempts": 1, "data": {...}, "error": null}
{"url": "not-a-domain", "index": 3, "duplicate_indexes": [], "attempts": 0, "data": null, "error": {...}}The download stream lines up with your original submission order -
line[N] corresponds to list position N (duplicated list positions
resolve to their first occurrence). Calling it before the batch is
terminal returns 409 BATCH_NOT_FINISHED.
Cancel a batch
curl -X POST "https://api.dataloom.dev/website-insights/v2/insights/batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77/cancel" \
-H "Authorization: Bearer $DATALOOM_API_KEY"- A queued batch is cancelled immediately - no work is done.
- A running batch moves to
cancellingand landscancelledas soon as workers stop scheduling new fetches. - Results fetched before the cancel remain retrievable until expiry.
- Billed credits are not refunded - billing happened at submission.
Cancelling an already-finished batch is a no-op that returns its status unchanged.
Webhooks
Set callback_url in the submit body (HTTPS only; URLs that resolve to
private, loopback, or link-local addresses are rejected with
400 INVALID_CALLBACK_URL) and the platform POSTs one signed
notification when the batch reaches a terminal status.
Verify the signature before trusting the body:
X-WebInsights-Signature: sha256=HMAC-SHA256("{timestamp}.{raw body}", webhook_secret)
X-WebInsights-Timestamp: <unix seconds>webhook_secretis the per-batch key from the submit202response.- Compute the HMAC over the literal string
"{timestamp}.{raw body}"- the Unix-seconds timestamp header, a dot, then the exact raw request bytes - and compare in constant time (hmac.compare_digest). - Reject timestamps older than ~5 minutes (replay protection).
- Failed deliveries are re-signed with a fresh timestamp and
re-sent, so dedupe on the batch
id(also sent as theX-WebInsights-Batch-Idheader).
The payload is the batch object plus event and, for batches of up to
200 items, the full inline results array:
{
"event": "batch.completed",
"id": "batch_9f2ce1a4d7b84c0eaf3122ee5a6d9c77",
"object": "batch",
"status": "completed",
"dataset": "all-insights",
"summary": { "submitted": 3, "unique": 3, "duplicates": 0, "failed": 1, "pending": 0, "insight_level": { "complete": 2 } },
"results": [ { "url": "...", "index": 0, "duplicate_indexes": [], "attempts": 1, "data": {}, "error": null } ]
}eventmirrors the terminal status:batch.completed,batch.partial,batch.failed, orbatch.cancelled.- Batches with more than 200 items omit the inline array and set
results_omitted: true- page/results(the payload's absoluteresults_urlpoints at them) or fetch/downloadinstead. - Retries: up to 5 attempts with exponential backoff (60 s → 180 s →
540 s → 1620 s, ~40 minutes total), persisted across restarts. A
3xxresponse counts as a failed attempt - redirects are never followed.
Errors
Platform-wide gateway rejections (401, 402, 429) and refunds are
documented in errors. The batch endpoints add their own:
HTTP-level errors
| HTTP | Code | Meaning | What to do |
|---|---|---|---|
400 | BATCH_TOO_LARGE | More than 1,000 items in urls. | Split the submission. |
400 | INVALID_REQUEST | Malformed body or an unknown dataset value (the message names the offending field). | Fix the field the message points at. |
400 | INVALID_CALLBACK_URL | The callback_url is not a plain HTTPS URL or targets a private/loopback address - see webhooks. | Send a public HTTPS URL. |
404 | BATCH_NOT_FOUND | Unknown batch id. | Check the id you stored from the submit response. |
409 | IDEMPOTENCY_CONFLICT | An Idempotency-Key was reused with a different request body. | Use a fresh key for the new body. |
409 | BATCH_NOT_FINISHED | /download called while the batch is still running. | Poll /status first, or read partial pages from /results. |
410 | BATCH_EXPIRED | The batch passed its expires_at (7 days after completion). | The results are gone - resubmit if you still need them. |
Batch error bodies are bare - no envelope, with a retryable flag:
{
"error": {
"code": "BATCH_NOT_FOUND",
"message": "No batch found with id batch_9f2c...",
"retryable": false
}
}retryable: true means retrying the same request later may succeed
(transient upstream failure); retryable: false means the request
itself is bad and will fail again unchanged. 400 responses are always
billed at 0 credits - a rejected submit never moves your balance.
Item-level errors (batch result rows)
Inside a batch, a failed item never fails the batch - it becomes a
result row with error set and data: null:
| Code | Retryable | Meaning |
|---|---|---|
INVALID_URL | no | The submitted item is not a parseable domain/URL. Produced immediately at submit time; costs nothing (attempts: 0). |
INVALID_DOMAIN | no | The item parsed as a domain but the data provider rejected it (e.g. the domain does not exist). Check spelling, or treat as "no data". |
TIMEOUT_ERROR | yes | The fetch timed out transiently. |
CONNECTION_ERROR | yes | Could not connect to the upstream service. |
RELAY_SERVICE_ERROR | yes | The egress-relay path failed transiently. |
INTERNAL_SERVER_ERROR | yes | Unexpected upstream failure. |
Rows written by batches submitted before 2026-11-19 may carry
INVALID_DOMAIN where an unparseable item would today say INVALID_URL
- treat the two identically when scanning historical batches.
How to handle failures per batch:
- The batch's own status tells you which case you are in:
completed(no failures),partial(some), orfailed(all). - For
retryable: truerows, collect theirurlvalues and resubmit them as a new batch later - old batches are immutable. retryable: falserows are final; fix or drop those items.
HTTP status summary
| Status | When |
|---|---|
200 | Success - a batch call where wait caught the finish; every poll, page, download, and cancel. |
202 | Batch accepted - not finished yet. |
400 | Validation failure (see table above). |
404 | Unknown batch id. |
409 | Idempotency conflict, or download before the batch finished. |
410 | The batch expired. |
401 / 402 / 429 | Gateway-level - see errors. |
Retention
| Results retrievable | 7 days from completion - expires_at on the batch object |
| Batch record afterwards | kept 30 more days, then purged |
Past expires_at, every endpoint for that batch returns
410 BATCH_EXPIRED. Download long-lived data after processing; the
batch id is not an archive.
Throughput expectations
Domains are processed concurrently, and each one performs the same
upstream fetch as the single-URL endpoint (cold domains are the slow
case). Expect minutes for a typical batch, longer for a full 1,000 -
use the status counters and partial results to monitor progress, or
let the webhook tell you when it is done. Legacy note: batch ids
created before the batch_ prefix was introduced resolve as bare hex
ids too, so old poll links keep working.
Authoritative paths
The paths above are the v2 batch surface served at
https://api.dataloom.dev. The API's
reference page always shows the live
endpoint list with exact paths, parameters, and per-call costs.
Dataloom Docs