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

# Polling

> Poll for job results instead of using webhooks.

After starting a job, poll its status until it reaches a terminal state (`Completed` or `Failed`).

## Starting a Job

```bash theme={null}
curl -X POST https://api.bedrock.cv/compare \
  -H "Authorization: Bearer sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"old_id": "blk_01JABCD100", "new_id": "blk_01JABCD200", "type": "Block", "analyze": ["changes"]}'
```

Response (`202 Accepted`):

```json theme={null}
{
  "job_id": "job_01JABCD123",
  "status": "Queued"
}
```

## Polling for Results

```bash theme={null}
curl https://api.bedrock.cv/jobs/job_01JABCD123 \
  -H "Authorization: Bearer sk_xxx"
```

Response (in progress):

```json theme={null}
{
  "job_id": "job_01JABCD123",
  "type": "compare",
  "status": "Started",
  "target": {
    "type": "block",
    "id": "blk_01JABCD100"
  },
  "created_at": "2024-01-15T10:00:00Z"
}
```

Response (completed):

```json theme={null}
{
  "job_id": "job_01JABCD123",
  "type": "compare",
  "status": "Completed",
  "target": {
    "type": "block",
    "id": "blk_01JABCD100"
  },
  "results": {
    "overlay": {
      "overlay_id": "ovl_01JABCD456",
      "uri": "https://storage.bedrock.cv/overlays/ovl_01JABCD456/combined.png",
      "score": 0.82
    },
    "changes": [
      {
        "category": "addition",
        "description": "New wall partition added in conference room B",
        "bounds": { "x_min": 120, "y_min": 340, "x_max": 320, "y_max": 390 },
        "severity": "significant"
      }
    ]
  },
  "created_at": "2024-01-15T10:00:00Z",
  "completed_at": "2024-01-15T10:01:30Z"
}
```
