# Claim run

```http
POST /agent-workers/workers/{worker_id}/claim
```

Claim the next available run, or only the selected canonical run when canonical\_run\_id is provided.

## Parameters

| Name        | In   | Required | Description |
| ----------- | ---- | -------- | ----------- |
| `worker_id` | path | Yes      |             |

## Request body

| Field                    | Type    | Required | Description                                                          |
| ------------------------ | ------- | -------- | -------------------------------------------------------------------- |
| `lease_duration_seconds` | integer |          |                                                                      |
| `canonical_run_id`       | string  |          | Claim only this canonical run; omit to claim the next available run. |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 200    | Claim result, with lease metadata when a runnable agent run was available.                                  |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Forbidden                                                                                                   |
| 404    | Not found                                                                                                   |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
