Job Handling

Submitting a Job

Using the Async API is easy. Submit a scraping job and receive a status URL, where you can monitor the job and collect the results once it's finished.

1

Base URL

https://async.scraperapi.com/jobs
2

Required query parameters

  • api_key - your API Key

  • url - target URL

3

Sample Request

curl --request POST \
  --url "https://async.scraperapi.com/jobs" \
  --header "Content-Type: application/json" \
  --data '{
    "apiKey": "API_KEY",
    "url": "https://example.com"
  }'

Response:

}
"id":"0962a8e0-5f1a-4e14-bf8c-5efcc18f0953",
"status":"running",
"statusUrl":"https://async.scraperapi.com/jobs/0962a8e0-5f1a-4e14-bf8c-5efcc18f0953",
"url":"https://example.com"
}

Sending a POST request to the Async API is done by using "method": "POST" inside the payload. Here is an example:

curl --request POST \
  --url "https://async.scraperapi.com/jobs" \
  --header "Content-Type: application/json" \
  --data '{
    "apiKey": "API_KEY",
    "url": "https://postman-echo.com/post",
    "method": "POST",
    "headers": {
      "content-type": "application/x-www-form-urlencoded"
    },
    "body": "foo=bar"
  }'
circle-exclamation

Job Status

The statusUrl is a unique job URL, used to retrieve the status and results of the scraping job. Invoking that endpoint provides you with the job status (while it is still running)

Once your job is finished, the response from the statusURL will this time contain the results of your scraping job:

circle-exclamation

Cancelling a Job

Should you wish to cancel a running job, you can do so by sending a DELETE request to the job endpoint using the job ID:

Last updated