> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atollhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Atomically claim an issue for the current local runner

> Agent-only claim. The authenticated agent's current runner, assignment, project access, issue state, and dependency satisfaction are validated atomically. Attention-resume first claims validate an unread notification and routing; exact terminal replays remain acknowledgement-only after the notification is read or acknowledged. Non-orphaned attention leases are unique. Untouched pre-intent replays reissue tokens and invalidate the original token; the four newest prior recovery tokens remain valid for one minute or until one is used, which promotes it. Other replays return token null. Only a proven pre-intent orphan can be replaced; uncertain_outcome blocks replacement.



## OpenAPI

````yaml /openapi.json post /api/orgs/{id}/runner-leases/claim
openapi: 3.1.0
info:
  title: Atoll API
  version: 1.0.0
  description: >-
    REST API for Atoll project management, agent collaboration, strategy
    tracking, and integrations.
servers:
  - url: https://atollhq.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
  - name: Organizations
  - name: Projects
  - name: Project access
  - name: Issues
  - name: Issue details
  - name: Milestones
  - name: Artifacts
  - name: Strategy
  - name: Members and agents
  - name: Planning
  - name: Setup
  - name: Integrations and billing
  - name: Notifications and public
  - name: Private inbox
  - name: Agent executions
  - name: Human attention
paths:
  /api/orgs/{id}/runner-leases/claim:
    post:
      tags:
        - Members and agents
      summary: Atomically claim an issue for the current local runner
      description: >-
        Agent-only claim. The authenticated agent's current runner, assignment,
        project access, issue state, and dependency satisfaction are validated
        atomically. Attention-resume first claims validate an unread
        notification and routing; exact terminal replays remain
        acknowledgement-only after the notification is read or acknowledged.
        Non-orphaned attention leases are unique. Untouched pre-intent replays
        reissue tokens and invalidate the original token; the four newest prior
        recovery tokens remain valid for one minute or until one is used, which
        promotes it. Other replays return token null. Only a proven pre-intent
        orphan can be replaced; uncertain_outcome blocks replacement.
      operationId: post_api_orgs_id_runner_leases_claim
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Organization identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunnerLeaseClaimInput'
      responses:
        '200':
          description: >-
            Runner lease claimed or idempotently replayed. First attention
            claims require an unread routed notification. Terminal attention
            replays acknowledge only, including after read or acknowledgement.
            Untouched pre-intent replays may reissue a token and invalidate the
            original token; the four newest prior recovery tokens remain valid
            for one minute or until one is used, which promotes it. Other
            replays return `token: null`. Only proven pre-intent orphans can be
            replaced; uncertain_outcome blocks replacement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunnerLeaseClaimResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The issue is not claimable or the lease identity conflicts
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    RunnerLeaseClaimInput:
      type: object
      oneOf:
        - required:
            - issueId
            - idempotencyKey
          properties:
            issueId:
              type: string
              format: uuid
            claimKind:
              type: string
              enum:
                - issue
              default: issue
            idempotencyKey:
              type: string
              minLength: 1
              maxLength: 200
          additionalProperties: false
        - required:
            - issueId
            - claimKind
            - idempotencyKey
            - attentionItemId
            - runnerHostId
            - preservedThreadId
            - actionKind
          properties:
            issueId:
              type: string
              format: uuid
            claimKind:
              const: attention_resume
            idempotencyKey:
              type: string
              minLength: 1
              maxLength: 200
            attentionItemId:
              type: string
              format: uuid
            runnerHostId:
              type: string
              minLength: 1
              maxLength: 255
            preservedThreadId:
              type: string
              minLength: 1
              maxLength: 256
            actionKind:
              type: string
              minLength: 1
              maxLength: 100
          additionalProperties: false
    RunnerLeaseClaimResponse:
      type: object
      required:
        - lease
        - token
        - replayed
        - token_reissued
        - acknowledgement_only
      properties:
        lease:
          $ref: '#/components/schemas/RunnerLease'
        token:
          type:
            - string
            - 'null'
          description: >-
            Ephemeral token for a new claim or eligible pre-intent replay; null
            for other replays.
        replayed:
          type: boolean
          description: True when the idempotency key returned an existing lease.
        token_reissued:
          type: boolean
          description: >-
            True only when an untouched pre-intent active lease received a newly
            generated token; the original token is invalidated.
        acknowledgement_only:
          type: boolean
          description: >-
            True only for terminal attention replays that acknowledge without
            starting a turn, including after notification read or
            acknowledgement.
      additionalProperties: false
    RunnerLease:
      type: object
      description: >-
        Fenced local execution lease. The lease token is never returned in this
        object.
      required:
        - id
        - org_id
        - issue_id
        - runner_installation_id
        - agent_member_id
        - claim_generation
        - claim_kind
        - attention_item_id
        - runner_attention_idempotency_key
        - idempotency_key
        - state
        - mutation_sequence
        - last_mutation_id
        - last_transition
        - last_progress
        - last_error_code
        - expires_at
        - turn_intent_persisted_at
        - sdk_accepted_at
        - model_completed_at
        - started_at
        - terminal_at
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        org_id:
          type: string
          format: uuid
        issue_id:
          type: string
          format: uuid
        runner_installation_id:
          type: string
          format: uuid
        agent_member_id:
          type: string
          format: uuid
        claim_generation:
          type: integer
          minimum: 1
        claim_kind:
          type: string
          enum:
            - issue
            - attention_resume
        attention_item_id:
          type:
            - string
            - 'null'
          format: uuid
        runner_attention_idempotency_key:
          type:
            - string
            - 'null'
        idempotency_key:
          type: string
        state:
          type: string
          enum:
            - active
            - progress
            - turn_intent_persisted
            - started
            - model_completed
            - completed
            - failed
            - aborted
            - orphaned
            - uncertain_outcome
        mutation_sequence:
          type: integer
          minimum: 0
        last_mutation_id:
          type:
            - string
            - 'null'
          format: uuid
        last_transition:
          type:
            - string
            - 'null'
        last_progress:
          type:
            - string
            - 'null'
          enum:
            - preparing
            - turn_intent_persisted
            - sdk_accepted
            - running
            - model_completed
            - finalizing
            - null
        last_error_code:
          type:
            - string
            - 'null'
          enum:
            - runner_error
            - sdk_error
            - model_error
            - timeout
            - cancelled
            - unknown
            - null
        expires_at:
          type: string
          format: date-time
        turn_intent_persisted_at:
          type:
            - string
            - 'null'
          format: date-time
        sdk_accepted_at:
          type:
            - string
            - 'null'
          format: date-time
        model_completed_at:
          type:
            - string
            - 'null'
          format: date-time
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        terminal_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      additionalProperties: false
    Error:
      type: object
      description: >-
        Common error responses contain error. Shared missing-auth and
        unknown-API responses also contain a stable code.
      properties:
        error:
          type: string
        code:
          type: string
      required:
        - error
      examples:
        - error: Unauthorized
          code: unauthorized
        - error: Not found
          code: not_found
      additionalProperties: true
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Authenticated but not allowed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found or not visible
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk_atoll_<key>

````