---
title: "Claim Issue For Build"
method: POST
path: "/api/rooster/issues/claim-for-build"
tags: ["rooster"]
---

# Claim Issue For Build

`POST /api/rooster/issues/claim-for-build`

## Request

- Base URL: `https://api.pigeonly.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.pigeonly.com/api/rooster/issues/claim-for-build`
- Auth: none declared

Hand the next queued issue to a builder, and mark it as being built.

`metered_lane_shut` (query param, optional; 2026-11-14, `issues.domain.METERED_LANE_SHUT_RULE`):
the drain sends true with `build_provider=claude_seat` when its metered lane cannot build (no
budget, no provider, breaker open). Then the seat is also offered a person's report on its
first attempts, and `build_provider` in the answer says `claude_seat` for it. A machine-filed
issue is never offered to the seat this way.

The claim and the status change are one statement, so two builders can
never take the same issue and the board shows "being built" from the moment
work starts rather than when it finishes. Returns `{"issue": null}` on an
empty queue -- not a 404, because nothing is wrong: an idle drain is the
correct state when there is nothing to drain.

`build_provider` (query param, optional; 2026-10-22, #6868) restricts the
offer to ONE build lane: `claude_seat` (a work order, or a person's report
that has failed twice on the code) or `cheap_model` (a machine-filed code
issue, or a person's report on its first two attempts: 2026-10-25, #7447).
Omitted, both are offered, people first. The drain sends one when only one of its two builders is
up, so it never claims what it cannot build.

`lane` (query param, defaults to 'code' -- every caller that predates
the two-seat split keeps its exact previous behaviour) is NEVER trusted
on its own. `issues.service.claim_next_for_build` checks, before
touching a single row, that `principal` holds the grant NAMED for this
exact lane (`domain.BUILD_CLAIM_FUNCTION_KEYS`) -- Seat A's own
principal holds `rooster:build:claim:code` only and Seat B's own holds
`rooster:build:claim:work_order` only, so a mismatched `lane` is
refused with 403 regardless of `DIRECTION_WRITE`'s own broader grant.
See `LaneNotPermittedForPrincipal`'s own docstring for the incident this
replaces (an independent bug-hunt review proved, with a repro, that
before this check existed either seat's own token could claim from the
other's lane).

## Query parameters

- `lane` string
- `build_provider` 'claude_seat' | 'cheap_model', nullable
- `metered_lane_shut` boolean

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

## Changes

- **2026-11-14** `a460ea846b90`: 1 info
  - added the new optional `query` request parameter `metered_lane_shut`
- **2026-10-23** `462453bc343f`: 1 info
  - added the new optional `query` request parameter `build_provider`

[Operation history](https://skmtc.dev/pigeonly/apis/roost-v2-pigeonly-company-os/changes/api/rooster/issues/claim-for-build/post.md)

---

[API](https://skmtc.dev/pigeonly/apis/roost-v2-pigeonly-company-os.md) - [All operations](https://skmtc.dev/pigeonly/apis/roost-v2-pigeonly-company-os/llms.txt) - [OpenAPI document](https://skmtc.dev/pigeonly/apis/roost-v2-pigeonly-company-os/revisions/14571c4b7007?raw)
