logo

Create a new scraping job

View as Markdown

Create a new asynchronous scraping job with the specified targets and options

POST
/api/v1/jobs

Authorization

ApiKeyAuth
X-Token<token>

In: header

Request Body

application/json

Job creation parameters

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://q.scrape.do/api/v1/jobs" \  -H "Content-Type: application/json" \  -d '{}'
{
  "JobID": "string",
  "Message": "string",
  "TaskIDs": [
    "string"
  ]
}
{
  "Error": "string",
  "Code": 0
}
{
  "Error": "string",
  "Code": 0
}
{
  "Error": "string",
  "Code": 0
}
{
  "Error": "string",
  "Code": 0
}

Webhook delivery

When you set WebhookURL, each task's result is sent to it as a JSON POST as soon as the task finishes. The body has the same shape as the Get Task response (TaskID, JobID, Status, StatusCode, ResponseHeaders, Content, Base64EncodedContent, ErrorMessage, …). Your WebhookHeaders are added to every request, along with an X-Trace-ID header that matches the task's TraceID.

  • Any 2xx response counts as delivered. Each attempt times out after 16 seconds.
  • Timeouts, connection errors and other non-2xx responses are retried with exponential backoff starting at 30 seconds, for up to 4 attempts in total.
  • A 404 or 410 response is not retried right away. The webhook gets one more attempt about an hour later, which gives an endpoint that is down for a redeploy time to come back. If that attempt also returns 404 or 410, the webhook is marked failed.
  • If almost every recent delivery to the same domain fails, deliveries to that domain are paused for at least 15 minutes and resume automatically once the endpoint responds again.

You can check a task's delivery state with the WebhookStatus and WebhookRequestTime fields of Get Task. Task results stay retrievable through the API for the same period whether or not the webhook succeeds, so you can always fall back to polling.