Developers

Web Scraping API

Reference

Push-Pull

Submit asynchronous jobs, track completion and retrieve each result.

Set the asynchronous submission URL

Set CRAWLHUB_ASYNC_URL to the asynchronous job URL assigned to your account. It uses the /v1/queries path. Keep this setting separate from your Realtime URL because the two delivery methods have different responses.

Submit a job
: "${CRAWLHUB_ASYNC_URL:?Set your asynchronous job URL}"
curl "$CRAWLHUB_ASYNC_URL" \
  --user "$CRAWLHUB_USERNAME:$CRAWLHUB_PASSWORD" \
  --header "Content-Type: application/json" \
  --data '{"source":"universal","url":"https://example.com/"}'

Save the job metadata

The submission response contains an id, a status and _links. Keep the identifier as a string. Follow the rel: self link for metadata and rel: results for content. Use HTTPS and the same API credentials on those requests.

Check status

StatusMeaningNext step
pendingThe job is still running.Wait before polling again.
doneCollection finished.Retrieve results and inspect result status.
faultedCollection could not finish.Inspect failure details before retrying.

Scroll horizontally to read all columns.

Resource paths
GET /v1/queries/{job_id}
GET /v1/queries/{job_id}/results
GET /v1/queries/{job_id}/results/1/content

Retrieve content

A results request before completion can return 204 with no body. Download completed results within the retention period of at least 24 hours. The type query parameter selects formats such as raw, parsed, markdown, png or xhr.

Avoid repeated polling

Search documentation

Search guides, products and reference pages.