> ## 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.

# Apply a fenced local runner lease transition

> Agent-only lease mutation. Organization, agent, current runner installation, generation, token, sequence, and mutation ID are verified. Exact mutation retries are idempotent. Optional progress and errorCode values use closed operational code sets; free-form runtime details are rejected.



## OpenAPI

````yaml /openapi.json patch /api/orgs/{id}/runner-leases/{leaseId}
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/{leaseId}:
    patch:
      tags:
        - Members and agents
      summary: Apply a fenced local runner lease transition
      description: >-
        Agent-only lease mutation. Organization, agent, current runner
        installation, generation, token, sequence, and mutation ID are verified.
        Exact mutation retries are idempotent. Optional progress and errorCode
        values use closed operational code sets; free-form runtime details are
        rejected.
      operationId: patch_api_orgs_id_runner_leases_leaseId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Organization identifier
        - name: leaseId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Runner lease identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunnerLeaseMutationInput'
      responses:
        '200':
          description: Lease transition applied or idempotently replayed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunnerLeaseResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The lease binding, sequence, runner, or terminal state is stale
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    RunnerLeaseMutationInput:
      type: object
      required:
        - token
        - claimGeneration
        - sequence
        - mutationId
        - transition
      properties:
        token:
          type: string
          minLength: 1
          maxLength: 512
        claimGeneration:
          type: integer
          minimum: 1
        sequence:
          type: integer
          minimum: 1
        mutationId:
          type: string
          format: uuid
        transition:
          type: string
          enum:
            - renew
            - progress
            - turn_intent_persisted
            - started
            - model_completed
            - completed
            - failed
            - aborted
            - orphaned
            - uncertain_outcome
            - acknowledge
        progress:
          type:
            - string
            - 'null'
          enum:
            - preparing
            - turn_intent_persisted
            - sdk_accepted
            - running
            - model_completed
            - finalizing
            - null
        errorCode:
          type:
            - string
            - 'null'
          enum:
            - runner_error
            - sdk_error
            - model_error
            - timeout
            - cancelled
            - unknown
            - null
      additionalProperties: false
    RunnerLeaseResponse:
      type: object
      required:
        - lease
      properties:
        lease:
          $ref: '#/components/schemas/RunnerLease'
      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>

````