Playground Sign in Start free

Jobs and results

Follow a crawl, read its pages, cancel it, get told when it ends

Job status

GET /crawl/{id} returns the job as it runs:

Field What it says
status pending, processing, completed, failed or cancelled.
finished true once the pages in flight have ended and the archive is built. The webhook (if any) is sent right after. It can come a few minutes after the last page when building the archive has to be retried; the job completes on its own. A cancelled job reads cancelled at once and finished: true a little later.
stop_reason Why the job stopped (below).
counts discovered, pending, in_progress, done, failed, skipped, and listed in sitemap mode.
credits_used The credits billed so far.
request The job as the service runs it, with every default applied (not the body as sent).
errors Failed pages by error_class, as an object ({} when there are none).
robots Per host: host, status, http_status, crawl_delay_ms and error of its robots.txt.
archive Once finished: url (signed, valid 48 hours from this call), size_bytes, checksum_sha256, file_count, expires_at; expired: true after the retention.
webhook Once a delivery was tried: delivered, attempts, last_status.
created_at, started_at, completed_at When the job was created, started and ended. error says why a job failed.

stop_reason:

Value Meaning
completed No page left to read.
max_pages The max_pages limit was reached.
max_credits The next page would have gone past max_credits.
max_duration The job ran for 6 hours.
cancelled You cancelled it.
failed The job could not go on, for example because the key was refused.

Reading the pages

GET /crawl/{id}/pages returns the page records in a stable order:

Query parameter Description
after The cursor: 0 for the first call, then the next_after value of the previous answer.
limit Records per call, 1 to 50.
content true to include each page's Markdown or HTML. Leave it out to list the pages only.

The answer carries job_id, status, finished, pages, next_after and has_more. Keep calling with after set to next_after while has_more is true.

The list stops before the first page that has not ended, so next_after never passes a page that can still change:

  • has_more: true: call again now from next_after.
  • has_more: false with finished: false: everything final so far has been read; poll again later from the same next_after.
  • A finished job has only final pages.

A reader that stops can come back later with the same after and pick up where it left off.

With content=true, a finished page carries its markdown or html. A page over 2 MB comes as a signed content_url instead, and once the retention has passed the record says content_expired: true. One answer carries at most 8 MB of content: the list stops before a page that would pass it, with has_more: true. The fields of each record are on Page records.

Cancelling and listing jobs

curl -X DELETE https://api.ujeebu.com/crawl/JOB_ID -H "ApiKey: YOUR_API_KEY"

# The account's recent jobs
curl https://api.ujeebu.com/crawl -H "ApiKey: YOUR_API_KEY"

After a cancel nothing new starts; the pages already in flight finish. Pages that were never read are recorded as stopped and cost nothing. Cancelling a job that has already finished answers 409. GET /crawl lists your 20 most recent jobs (up to 100 with limit); a job leaves the list 7 days after it was created.

Webhook

Set webhook.url when you start the job and Ujeebu sends one POST to it when the job ends. The address must be public and its host must resolve when you start the job; otherwise the start answers 400. Its JSON body carries:

  • event: crawl.job.completed, crawl.job.failed or crawl.job.cancelled;
  • job_id, status and stop_reason;
  • counts, errors and credits_used;
  • archive: url, size_bytes, checksum_sha256, file_count and expires_at.

Add your own headers with webhook.headers: they are stored with the job for the delivery, never shown back in the status, and deleted once the delivery has ended. GET /crawl/{id} shows whether the delivery worked (webhook.delivered, attempts, last_status).

Verify the signature

Each call is signed with your own API key:

  • X-Ujeebu-Signature: sha256=<hex>: an HMAC-SHA256, keyed with your API key, of <timestamp>.<raw body>;
  • X-Ujeebu-Timestamp: the time of the call, in unix seconds;
  • X-Ujeebu-Webhook-Id: the delivery's id.

Recompute the signature over the raw bytes of the body (before any JSON parsing), compare in constant time, and refuse an old timestamp:

import hashlib, hmac, time

def verify(raw_body: bytes, headers, api_key: str, max_age: int = 300) -> bool:
    ts = headers["X-Ujeebu-Timestamp"]
    if abs(time.time() - int(ts)) > max_age:
        return False
    expected = hmac.new(api_key.encode(), ts.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest("sha256=" + expected, headers["X-Ujeebu-Signature"])
import crypto from "node:crypto";

function verify(rawBody, headers, apiKey, maxAge = 300) {
  const ts = headers["x-ujeebu-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > maxAge) return false;
  const expected = "sha256=" + crypto.createHmac("sha256", apiKey).update(`${ts}.`).update(rawBody).digest("hex");
  const got = headers["x-ujeebu-signature"] || "";
  return got.length === expected.length && crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected));
}

Archive

Every finished job has a tar.gz archive: a manifest.json (the job and every page record, each with its file) plus one file per page read (page-000001.md or page-000001.html). The link comes in the job status and in the webhook; there is no separate archive endpoint. Each archive link is valid for 48 hours from the time it is handed out, and page contents and archives are kept for 72 hours.

Billing during a job

Each page is billed when it is read, like a direct call, and it is read once: if storing a page fails on our side, the store is retried with the page already read (up to 4 tries over about 17 seconds), never by reading the page again. If the crawl service restarts during a job, the pages that were in flight at that moment are read again, so those few pages (at most the job's concurrency) can be billed twice. Credits come in the answers: credits_used on the job and credits on each page.

Ready to build?

Spin up an API key in 60 seconds

Free trial: 5,000 credits for 21 days, no card, every endpoint on this page (proxy country needs a paid plan or a top-up pack).