Crawl a batch

Queue up to 100 URLs in one request; poll the job or get it at your webhook.
POST/v1/crawls/batch
Open as Markdown
On this page

Price

Pricepage
Live
$0.00011
Standard fetch
$0.00011
Rendered fetch
$0.0011
Protected fetch
$0.003

Per page, at the level that delivered it.

Description

Returns 202 with a job_id straight away. Read the results with GET /v1/crawls/{id}, or set webhook_url and we POST the finished job to it. Options apply to every target. If any target isn't a valid public URL, nothing is queued and the response lists each bad target.

The wallet check reserves the worst case for every target (or max_cost each). Billing. One page at the price of the fetch level that delivered it (Standard $0.00011, Rendered $0.0011, Protected $0.003). Blocked, failed and non-substantive pages cost $0.

Request

Endpoint
POST https://api.dataforgaio.com/v1/crawls/batch
Authentication
HTTP Basic auth: any login, with your dg_ API key as the password. A Bearer header with the key also works. Create a key.
Body
JSON object

Fields

  • targetsarray<object>required
    The pages to fetch, 1 to 100.
    Min1Max100Example[{"url":"https://summitrunning.example/trail-shoes"},{"url":"https://summitrunning.example/stores"}]
    Show 1 child fields
    • urlstringrequired
      An absolute http(s) URL on a public host.
      Max2000Examplehttps://summitrunning.example/trail-shoes
  • webhook_urlstringoptional
    We POST the finished job (the GET /v1/crawls/{id} body) here. Must be https on a public host.
    Max2000Examplehttps://hooks.summitrunning.example/crawls
  • auto_upgradebooleanoptional
    Lets a blocked page move to a higher fetch level, billed at the level that delivered it. false stops at the requested level and returns the failure at $0.
    DefaulttrueExampletrue
  • max_levelstringoptional
    The highest fetch level Auto-upgrade may use.
    DefaultprotectedOne ofstandardrenderedprotectedExamplerendered
  • max_costnumber|nulloptional
    The most one page may cost, in USD, up to 6 decimal places. The wallet check reserves this instead of the worst-case price, and a fetch never upgrades past it.
    Min0Example0.002
  • output_formatstringoptional
    What content holds: Markdown text, the page HTML, or a JSON object of the page's title, text and metadata.
    DefaultmarkdownOne ofmarkdownhtmljsonExamplemarkdown
  • enginestringoptional
    The level to start at. rendered runs JavaScript from the first fetch and needs max_level rendered or protected. browser is accepted as an older name for rendered.
    DefaultstandardOne ofstandardrenderedExamplestandard
  • render_jsbooleanoptional
    true is the same as engine: rendered.
    Defaultfalse
  • include_receiptbooleanoptional
    Include the receipt on each task.
    DefaulttrueExampletrue
  • project_idstring|nulloptional
    A project in your organization to file this under. Leave it out for the default project.
    Example5b2f8c1e-3d4a-4e6f-9a0b-1c2d3e4f5a6b

Response

Shape: Native. Expand a field to see its children; every field has a link anchor.

  • job_idstring
    Job id, job_….
    Examplejob_8cbb5b5c8e155c82995945f93cdad009
  • Number of targets queued.
    Example2
  • statusstring
    Always queued.
    Examplequeued

Errors

CodeWhen
invalid_requestHTTP 400. Invalid options, an empty list, or more than 100 targets.
unauthorizedHTTP 401. Missing, malformed or revoked API key.
balance_requiredHTTP 402. Your wallet balance is below the most this request could cost. Nothing ran.
invalid_targetHTTP 422. A URL is not an absolute public http(s) URL. Nothing was fetched.
rate_limitedHTTP 429. Too many requests, or too many inline requests in flight for your organization. Honor Retry-After.
Tasks that end in an error are not billed. All status codes