Async web scraping API: realtime or queued jobs
Select a delivery model before integrating a managed collection service.

An async web scraping API separates submitting work from receiving its result. That can suit a workload that outlives one foreground request. Before choosing it, compare the complete job lifecycle with the realtime interface you would otherwise operate.
Name the delivery boundary
Realtime delivery returns the collection output through the request you are waiting on. A queued interface can return a job identity first, with retrieval or notification handled later. The exact states, URLs and billing rules belong to the service contract.
List what your application must persist: job identity, target specification, submission time, current state and result location where applicable. A job identifier is not the collected page. A successful submission is not evidence that extraction finished.
Choose from the workload
A foreground interaction can favor a bounded realtime path. A larger offline collection may benefit from durable queued work and resumable retrieval. Consider how the caller handles disconnections, delayed results and incomplete batches.
Compare operating effort as well as response time. Queued work introduces state storage, polling or callbacks, result retention and failure handling. A short HTTP response at submission does not remove that work.
Map the documented states
Translate the service's actual response states into a small internal model. Keep unknown values as errors until you understand them. Treating every unfamiliar state as “still running” can create an endless poller.
This Python helper uses illustrative internal states. They are not literal Crawlhub API status values or a complete network client. Its policy gives the job deadline priority over starting more work.
def job_action(state, elapsed_seconds, deadline_seconds):
if elapsed_seconds < 0 or deadline_seconds <= 0:
raise ValueError("invalid clock values")
if state not in {"pending", "running", "succeeded", "failed"}:
raise ValueError("unknown internal job state")
if elapsed_seconds >= deadline_seconds:
return "stop_deadline"
if state == "succeeded":
return "read_result"
if state == "failed":
return "stop_failed"
return "poll_later"
The caller owns the polling interval and any separate retrieval allowance. It also needs to validate clock inputs and the actual response schema. A job that completed before cancellation may still have a result; record that possibility rather than assuming cancellation undid completed work.
Bound polling and retries
Set a job deadline, maximum poll attempts and controlled delays. Define which errors can be retried under the contract. Authentication or validation failures need correction, not a larger retry count.
Keep submission retries distinct from status checks. If a submission response is lost, determine whether the service created work before creating another job. Use a documented idempotency mechanism where one exists; otherwise design and disclose the remaining duplicate-work risk.
Measure billing units through the full lifecycle. Submission, collection, repeated attempts and retrieval may have different treatment. Do not infer the charge from the number of HTTP requests alone.
Validate the result after completion
A completed job still needs the target, market and record checks your dataset requires. Keep parser failure, a valid empty result and an incomplete result separate. Save collection and ingestion timestamps under defined conventions.
If you use callbacks, verify their current authentication and delivery behavior before accepting them. Keep result processing idempotent and avoid treating the arrival order of notifications as the true order of collection.
Test the lifecycle before buying capacity
Exercise pending, success, failure, unknown-state and deadline cases on controlled fixtures. Include a duplicate notification or repeated retrieval where your application supports it. Verify what survives a worker restart.
Review the current Web Scraping API delivery documentation and use account-assigned URLs and credentials. The API-versus-proxy decision guide covers the wider ownership choice. Test one small job lifecycle before committing a larger workload.
