# Jobs

> Start long work as a job, then poll it or read its events. History keeps every operation so you can reopen a result without another call.

Canonical page: https://clawifi.dev/docs/jobs

## POST /jobs

Create Job. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/post-jobs).

**cURL**

```sh
curl -X POST https://api.clawifi.dev/jobs \
  -H "Authorization: Bearer $CLAWIFI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operation":"fetch"}'
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.create_job("fetch", {"url": "https://example.com"})
```

**MCP**

```text
create_job(operation="fetch")
```

## GET /jobs/{job_id}

Get Job. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/get-jobs-job-id).

**cURL**

```sh
curl https://api.clawifi.dev/jobs/<job_id> \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.get_job("<job_id>")
```

**MCP**

```text
get_job()
```

## GET /jobs/{job_id}/events

Job Events. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/get-jobs-job-id-events).

**cURL**

```sh
curl https://api.clawifi.dev/jobs/<job_id>/events \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.get("/jobs/<job_id>/events")
```

## GET /jobs/{job_id}/errors

Job Errors. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/get-jobs-job-id-errors).

**cURL**

```sh
curl https://api.clawifi.dev/jobs/<job_id>/errors \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.get("/jobs/<job_id>/errors")
```

## DELETE /jobs/{job_id}

Cancel Job. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/delete-jobs-job-id).

**cURL**

```sh
curl -X DELETE https://api.clawifi.dev/jobs/<job_id> \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.request("DELETE", "/jobs/<job_id>")
```

## GET /history

List History. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/get-history).

**cURL**

```sh
curl https://api.clawifi.dev/history \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.list_history()
```

**MCP**

```text
list_history()
```

## GET /history/{operation_id}

Get History Operation. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/get-history-operation-id).

**cURL**

```sh
curl https://api.clawifi.dev/history/<operation_id> \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.get("/history/<operation_id>")
```

## GET /history/{operation_id}/result

Get History Result. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/get-history-operation-id-result).

**cURL**

```sh
curl https://api.clawifi.dev/history/<operation_id>/result \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.get("/history/<operation_id>/result")
```

## POST /history/{operation_id}/rerun

Rerun History Operation. Full parameters on the [endpoint page](https://clawifi.dev/docs/api/post-history-operation-id-rerun).

**cURL**

```sh
curl -X POST https://api.clawifi.dev/history/<operation_id>/rerun \
  -H "Authorization: Bearer $CLAWIFI_API_KEY"
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()  # reads CLAWIFI_API_KEY
result = client.post("/history/<operation_id>/rerun")
```
