POST /v1/jobs/{job_id}/cancel

Crawl job cancel API: stop a queued or running crawl job

Send a job_id to stop a queued, running or payment-required crawl job and mark it failed with error cancelled. A cancelled job is never charged and its partial results are not delivered. Repeating the call returns the same answer, and a job that already finished answers 409 job_finished.

Price
Free
Batch
No
Failed calls
Not charged

Example request

curl
curl -X POST 'https://api.virev.ai/v1/jobs/job_7641d5f0-717d-4b70-a2f1-f58d846d7242/cancel' \
  -H "Authorization: Bearer $VIREV_API_KEY"
python
import os
import requests

response = requests.request(
    "POST",
    "https://api.virev.ai/v1/jobs/job_7641d5f0-717d-4b70-a2f1-f58d846d7242/cancel",
    headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())

Parameters

NameInTypeDescription
job_id requiredpathstring Example job_7641d5f0-717d-4b70-a2f1-f58d846d7242.

Example response

The example response of the API reference.

json
{
  "data": {
    "batch_id": "job_7641d5f0-717d-4b70-a2f1-f58d846d7242",
    "status": "failed",
    "status_url": "/v1/jobs/job_7641d5f0-717d-4b70-a2f1-f58d846d7242",
    "results_url": "/v1/jobs/job_7641d5f0-717d-4b70-a2f1-f58d846d7242/results",
    "cost": "$0.0000",
    "item_count": null,
    "error": "cancelled"
  },
  "meta": {
    "cost": "$0.0000",
    "request_id": "req_job_example"
  }
}

How it works

Stops a queued, running or payment-required job and marks it failed with error cancelled. A cancelled job is never charged, and its partial results are not delivered. Repeating the call returns the same answer. A job that already finished answers 409 job_finished.

Errors

StatusWhen
401Invalid or revoked API key.
404Job does not exist or belongs to another account.
409job_finished: the job was already ready or failed.
503Job service unavailable. Retry the cancel; it is safe to repeat.