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

# Retry accrual run items

> Re-sends to the ledger the recognitions of a run that it has not acknowledged. Of the items selected, only those still unposted are re-sent; an acknowledged recognition is never sent twice, and each re-send carries the same deterministic key as the original attempt, so a recognition already in the ledger is deduplicated there rather than booked again. The response lists the items actually re-sent, which may be fewer than those asked for; whatever it could not send is listed in unpostableItems with a reason. Status is "queued" when at least one recognition went out, "nothing_to_retry" only when the ledger had already acknowledged everything selected, and "blocked" when unacknowledged recognitions exist and none of them could be re-sent. Safe to repeat: pressing retry twice enqueues one posting per recognition.



## OpenAPI

````yaml /en/openapi/v3-current/lender.yaml post /api/v1/accrual-runs/{id}/retry
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    Code-first OpenAPI 3.1 surface for the Lender service. Routes that move
    money are at-most-once per X-Idempotency: when one answers 5xx, the
    X-Idempotency-Fenced response header says whether that key is now refusing
    resends (true) or free to retry (false or absent). See
    docs/contracts/money-route-idempotency.md.
  license:
    name: Lerian Studio General License
  title: Lender API
  version: 1.0.0
servers:
  - url: https://lender.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: >-
      Caller session projection: validated subject and effective permissions for
      the presented token.
    name: Session
  - description: >-
      Ledger accounting operations: journal entries and accrual postings for
      loan accounts.
    name: Accounting
  - description: >-
      Loan application intake and lifecycle: submission, decisioning, and
      status.
    name: LoanApplications
  - description: >-
      Loan product catalog: definition, versioning, and activation of lending
      products.
    name: LoanProducts
  - description: >-
      Loan account servicing operations: balances, schedules, and account-level
      actions.
    name: Loan Accounts
  - description: >-
      Portfolio dashboard read operations: aggregated portfolio and performance
      views.
    name: Dashboard
  - description: >-
      Jurisdiction registry: supported jurisdiction profiles and their
      capabilities.
    name: Jurisdictions
  - description: >-
      Jurisdiction-specific loan application operations (Brazil origination
      surface).
    name: Loan Applications
  - description: >-
      Tax computation operations for jurisdiction-specific lending (e.g. Brazil
      IOF).
    name: Tax
  - description: >-
      Brazil consignado privado operations: contract lifecycle, exclusion
      repair, and compensating adjustments.
    name: Consignado
  - description: >-
      Credit-instrument document template registry: versioned drafting and
      publication of CCB clausulado.
    name: DocumentTemplates
paths:
  /api/v1/accrual-runs/{id}/retry:
    post:
      tags:
        - Accounting
      summary: Retry accrual run items
      description: >-
        Re-sends to the ledger the recognitions of a run that it has not
        acknowledged. Of the items selected, only those still unposted are
        re-sent; an acknowledged recognition is never sent twice, and each
        re-send carries the same deterministic key as the original attempt, so a
        recognition already in the ledger is deduplicated there rather than
        booked again. The response lists the items actually re-sent, which may
        be fewer than those asked for; whatever it could not send is listed in
        unpostableItems with a reason. Status is "queued" when at least one
        recognition went out, "nothing_to_retry" only when the ledger had
        already acknowledged everything selected, and "blocked" when
        unacknowledged recognitions exist and none of them could be re-sent.
        Safe to repeat: pressing retry twice enqueues one posting per
        recognition.
      operationId: retryAccrualRun
      parameters:
        - description: Accrual run identifier.
          in: path
          name: id
          required: true
          schema:
            description: Accrual run identifier.
            format: uuid
            type: string
        - description: >-
            Canonical idempotency request ID. Required: this request moves
            money, and without a key a retry cannot be told apart from a second
            instruction.
          in: header
          name: X-Idempotency
          required: true
          schema:
            description: >-
              Canonical idempotency request ID. Required: this request moves
              money, and without a key a retry cannot be told apart from a
              second instruction.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetryAccrualRunHumaInputBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccrualRunRetryHumaBody'
          description: OK
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Service Unavailable
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
components:
  schemas:
    RetryAccrualRunHumaInputBody:
      additionalProperties: false
      properties:
        itemIds:
          description: >-
            Accrual run item identifiers to retry. Selecting an item the ledger
            has already acknowledged is not an error — it is skipped, and the
            response says which items were actually re-sent.
          items:
            format: uuid
            type: string
          maxItems: 500
          minItems: 1
          type:
            - array
            - 'null'
      required:
        - itemIds
      type: object
    AccrualRunRetryHumaBody:
      additionalProperties: false
      properties:
        id:
          description: >-
            UUID of the accrual run this retry acted on. A retry is a new
            attempt on that run, not a new run, so it equals retriedRunId.
          examples:
            - 550e8400-e29b-41d4-a716-446655440005
          type: string
        itemIds:
          description: >-
            UUIDs of the accrual run items actually re-sent. This is never an
            echo of the request: items already acknowledged by the ledger are
            excluded, and so is any item this retry could not send — those
            appear in unpostableItems.
          items:
            type: string
          type:
            - array
            - 'null'
        retriedRunId:
          description: UUID of the accrual run whose recognitions were retried.
          examples:
            - 550e8400-e29b-41d4-a716-446655440005
          type: string
        status:
          description: >-
            "queued" when at least one recognition was re-sent and is waiting
            for the ledger; "nothing_to_retry" when the ledger had already
            acknowledged every selected recognition, which is a success and not
            an error; "blocked" when recognitions the ledger has NOT
            acknowledged exist and none of them could be re-sent — money is
            still outside the ledger and unpostableItems says why.
          examples:
            - queued
          type: string
        unpostableItems:
          description: >-
            Accrual run items the ledger has not acknowledged and this retry
            could NOT send, with the reason for each. A non-empty list means
            money is still outside the ledger and pressing retry again will not
            change it on its own.
          items:
            $ref: '#/components/schemas/AccrualRetryUnpostableHumaBody'
          type:
            - array
            - 'null'
      required:
        - id
        - retriedRunId
        - status
        - itemIds
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    AccrualRetryUnpostableHumaBody:
      additionalProperties: false
      properties:
        itemId:
          description: UUID of the accrual run item that was not re-sent.
          examples:
            - 550e8400-e29b-41d4-a716-446655440006
          type: string
        reason:
          description: >-
            Why it was not re-sent. "already_delivered": the posting reached the
            broker and the ledger's acknowledgement is what is missing, so chase
            the acknowledgement rather than the posting. "quarantined": the
            posting intent is terminal on the outbox and no retry re-drives it.
            "contract_not_found": the contract carries no loan application, so
            the currency and product version the posting needs cannot be read.
            "product_misconfigured": the product version has no accounting
            profile, no rule for this event, or an amount its leg template
            refuses.
          enum:
            - already_delivered
            - quarantined
            - contract_not_found
            - product_misconfigured
          examples:
            - quarantined
          type: string
      required:
        - itemId
        - reason
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````