---
title: "Claim Next Job"
method: GET
path: "/api/v1/daemon/jobs"
tags: ["daemon"]
---

# Claim Next Job

`GET /api/v1/daemon/jobs`

## Request

- Base URL: `https://api.badgeia.com`
- URL: `https://api.badgeia.com/api/v1/daemon/jobs`
- Auth: none declared

Long-poll for the next job assigned to this daemon's agent.

`wait` (0..DAEMON_POLL_MAX_WAIT_SECONDS) is the maximum time the
handler holds the connection waiting for work. Returns:

  * 200 + `DaemonJobOut` once a job has been claimed.
  * 204 No Content if no job arrives within `wait` seconds.

Concurrency rule (AC-CONNECT-Q5): if an in-flight unresolved claim
already exists for this agent, returns 409 Conflict.

Visibility timeout (AC-CONNECT-Q2): if `claimed_at` is older than
`DAEMON_VISIBILITY_TIMEOUT_SECONDS`, the job is re-eligible. We
issue a NEW `claim_token` on re-claim — a result POST with the
stale token from the previous claim will 401, which is correct
behaviour (the previous owner is presumed dead).

## Query parameters

- `wait` integer

## Response `200`

Successful Response

- DaemonJobOut
  - `job_id` string, uuid, required
  - `agent_id` string, uuid, required
  - `run_id` string, uuid, required
  - `payload` object, required
  - `claim_token` string, required: Opaque token the daemon must echo back on the result POST. Equivalent to a 'do you still own this claim?' check.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/badgeia/apis/badge.md) · [All operations](https://skmtc.dev/badgeia/apis/badge/llms.txt) · [OpenAPI document](https://skmtc.dev/badgeia/apis/badge/revisions/7e7f7fee8b77?raw)
