> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cleariflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Async jobs

> The `jobs` endpoints enqueue scrape tasks for background processing and let you poll for status and results — ideal for high-volume or long-running scrapes.

## Getting started

### Base URL

```
https://scrape.cleariflow.com/v1/jobs
```

## Create a job

Enqueue an async scrape job with the same `ScrapeRequest` payload used by the synchronous endpoint.

### Example request

```bash theme={"system"}
curl -X POST 'https://scrape.cleariflow.com/v1/jobs' \
  -H 'Content-Type: application/json' \
  -d '{
    "request": {
      "api_key": "YOUR_UNIQUE_API_KEY",
      "url": "https://example.com"
    },
    "priority": 10
  }'
```

This successful request returns a job identifier:

<ResponseExample>
  ```json theme={"system"}
  {
    "job_id": "550e8400-e29b-41d4-a716-446655440000"
  }
  ```
</ResponseExample>

### Create job parameters

<ParamField body="request" type="Object" required>
  A `ScrapeRequest` object with the same fields as the synchronous scrape endpoint (`url`, `render`, `actions`, `cookies`, etc.).
</ParamField>

<ParamField body="priority" type="Integer">
  Job priority. Higher values are processed first. Defaults to 0.
</ParamField>

## Get job status

Poll a job by ID to check its status and retrieve results when complete.

### Base URL

```
https://scrape.cleariflow.com/v1/jobs/{job_id}
```

### Example request

```bash theme={"system"}
curl 'https://scrape.cleariflow.com/v1/jobs/550e8400-e29b-41d4-a716-446655440000'
```

While the job is running:

<ResponseExample>
  ```json theme={"system"}
  {
    "job_id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "running"
  }
  ```
</ResponseExample>

When the job completes successfully:

<ResponseExample>
  ```json theme={"system"}
  {
    "job_id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "done",
    "result": {
      "ok": true,
      "html": "<!DOCTYPE html><html>...</html>",
      "meta": {
        "elapsed_ms": 8123
      }
    }
  }
  ```
</ResponseExample>

### Job status values

| Status    | Description                                     |
| --------- | ----------------------------------------------- |
| `queued`  | Job is waiting in the queue.                    |
| `running` | Browser session is active.                      |
| `done`    | Scrape completed; `result` contains the output. |
| `failed`  | Scrape failed; `error` contains a description.  |

### Response parameters

<ResponseField name="job_id" type="String">
  Unique identifier for the async job.
</ResponseField>

<ResponseField name="status" type="String">
  Current job status: `queued`, `running`, `done`, or `failed`.
</ResponseField>

<ResponseField name="result" type="Object">
  The scrape result object (same shape as the synchronous endpoint response). Present when `status` is `done`.
</ResponseField>

<ResponseField name="error" type="String">
  Error message. Present when `status` is `failed`.
</ResponseField>

<ResponseField name="meta" type="Object">
  Additional metadata about the job execution.
</ResponseField>
