# Jobs

Progress of the long-running actions the API started.

## List jobs

`GET /jobs` · scope `account:read`

Jobs the API started for this account, newest first.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `status` | query | string (one of: running, succeeded, failed) | no | Only jobs in this state. |
| `site_id` | query | integer | no | Only jobs of this site. |
| `limit` | query | integer | no | Items per page (1-200). Default: `50`. |
| `cursor` | query | string | no | The next_cursor value of the previous page. Omit for the first page. |

### Example

```bash
curl -s "https://app.pbn.ltd/api/v1/jobs?status=running" \
  -H "Authorization: Bearer $PBN_API_KEY"
```

```python
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["PBN_API_KEY"]}
r = requests.get("https://app.pbn.ltd/api/v1/jobs?status=running", headers=headers, timeout=120)
print(r.status_code, r.json())
```

```javascript
const res = await fetch("https://app.pbn.ltd/api/v1/jobs?status=running", {
  method: "GET",
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
console.log(res.status, await res.json());
```

### Response

`200`

```json
{
  "data": [
    {
      "id": "job_4f1c0a9e2b7d6c5a3e10",
      "kind": "backup.create",
      "status": "running",
      "message": "In progress (state: Creating).",
      "site_id": 123,
      "object_type": "backup",
      "object_id": 88001,
      "created_at": "2026-09-20T09:00:00Z",
      "finished_at": null,
      "url": "https://app.pbn.ltd/api/v1/jobs/job_4f1c0a9e2b7d6c5a3e10"
    }
  ],
  "next_cursor": null,
  "has_more": false
}
```

Errors: `rate_limited`, `scope_missing`, `unauthorized`

## Job status

`GET /jobs/{job_id}` · scope `account:read`

The live status of a job: running, succeeded or failed, with a message. Poll every few seconds (it counts against the rate limit like any call).

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `job_id` | path | string | yes | The id returned as job.id. |

### Example

```bash
curl -s "https://app.pbn.ltd/api/v1/jobs/job_4f1c0a9e2b7d6c5a3e10" \
  -H "Authorization: Bearer $PBN_API_KEY"
```

```python
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["PBN_API_KEY"]}
r = requests.get("https://app.pbn.ltd/api/v1/jobs/job_4f1c0a9e2b7d6c5a3e10", headers=headers, timeout=120)
print(r.status_code, r.json())
```

```javascript
const res = await fetch("https://app.pbn.ltd/api/v1/jobs/job_4f1c0a9e2b7d6c5a3e10", {
  method: "GET",
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
console.log(res.status, await res.json());
```

### Response

`200`

```json
{
  "data": {
    "id": "job_4f1c0a9e2b7d6c5a3e10",
    "kind": "backup.create",
    "status": "running",
    "message": "In progress (state: Creating).",
    "site_id": 123,
    "object_type": "backup",
    "object_id": 88001,
    "created_at": "2026-09-20T09:00:00Z",
    "finished_at": null,
    "url": "https://app.pbn.ltd/api/v1/jobs/job_4f1c0a9e2b7d6c5a3e10"
  }
}
```

Errors: `not_found`, `rate_limited`, `scope_missing`, `unauthorized`
