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

# Requeue a title fact the outbox gave up delivering

> Gives a title fact the outbox gave up delivering to the host (INVALID) a new event, with the same type, the same title and the same body, delivered the usual way. The action is recorded in the collections audit trail with its `reason` and the identity that made it, in the same transaction as the new event; a refusal records nothing.

The reissued fact has an id of its own, derived from the INVALID fact's, and the host receives it under that id. INVALID does not prove that the host never received the fact: an earlier attempt can have delivered it and lost its outcome, and the host, which tells facts apart by their id, then receives the fact twice, under two ids, and so can the client, when the fact carries a customer notice. The INVALID event stays as it is. A fact is reissued once: a repeat is refused with 422 PBP-0802, and a reissued fact that also goes INVALID is requeued by its own id.

The requeue does not change what the fact carries. A body the delivery cannot read goes INVALID again at its delivery, and so does a fact the host refuses for good, such as the customer notice of OVERDUE, BLOCKED or UNBLOCKED it does not accept, because the refusal repeats.

The answer names the audit entry, with `outcome` ENQUEUED and `targetState` PENDING, the status of the reissued event.



## OpenAPI

````yaml /en/openapi/v3-current/payments-pcr.yaml post /v1/collections/title-facts/{fact_id}/requeue
openapi: 3.1.0
info:
  description: >-
    API for the Lerian Payments interface. It covers boleto issuance,
    cancellation, and queries; boleto collections; CNAB 240 files; aggregated
    boleto and payment dashboards; and provider connection and outbound webhook
    configuration.


    ERROR BODIES. A failed request arrives as an RFC 9457 problem document on
    application/problem+json. Branch on the code member. A license refusal
    carries an LCS code, listed in the License Manager error list.


    NOTICES. The webhooks section describes each notice Payments posts to the
    tenant's callback URL. Delivery does not guarantee order: order a boleto's
    notices by the occurredAt member of the body. Notices of one boleto recorded
    together never tie and follow the order of the facts; notices recorded at
    different moments can tie, and in a tie the boleto query tells the current
    state. The same notice can arrive more than once: after verifying its
    signature and its X-Webhook-Timestamp, discard repetitions by the eventId
    member of the body, equal to the X-Webhook-Id header and the same on every
    attempt.
  title: Payments PCR API
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: >-
      Replace the example host with the URL provided during environment
      onboarding.
security: []
tags:
  - description: >-
      Tenant-level setup: connecting the banking provider and configuring where
      status notifications are delivered.
    name: Admin
  - description: Issuing, querying and cancelling boletos, and retrieving the rendered PDF.
    name: Boletos
  - description: >-
      CNAB agreements: the link between a Lerian-provider collections agreement
      and the CNAB 240 Lerian files of one account, with its remittance and
      return sequence numbers (NSA) and its return cut times. Every operation of
      this section answers 422 PBP-0900 to a tenant without CNAB 240 enabled.
    name: CNAB Agreements
  - description: >-
      CNAB remittances: the CNAB 240 Lerian remittance files of an organization,
      each received whole, validated and stored encrypted, its title lines
      executed afterwards. A file already received is answered with its stored
      receipt; a new one answers 422 PBP-0900 to a tenant without CNAB 240
      enabled.
    name: CNAB Remittances
  - description: >-
      CNAB returns: the CNAB 240 Lerian return files of an organization, each
      cut from the movement journal of one agreement, at its cut times or on
      demand, with its own consecutive NSA, and the download of the file itself,
      rebuilt from the journal after the stored file is purged. Only the file
      carries personal data. Every operation of this section answers 422
      PBP-0900 to a tenant without CNAB 240 enabled.
    name: CNAB Returns
  - description: >-
      Boleto collections agreements and their reconciliation with the
      beneficiary base of the PCR: the consumption of each beneficiary inventory
      the PCR publishes and the divergences it raises, which carry only
      agreement and situation attributes, never a document or a name. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Agreements
  - description: >-
      Boleto collections audit trail: every operation and configuration action,
      append-only, with its author, instant, reason, evidence and the module's
      fields before and after it. Every operation of this section answers 422
      PBP-0830 to a tenant without collections enabled.
    name: Collections Audit
  - description: >-
      Boleto collections beneficiaries: the enablement of the tenant's accounts
      for collections, in batches of up to 5,000 accounts, and the progress and
      per-item outcome of the enablement and bulk adoption batches. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Beneficiaries
  - description: >-
      Boleto collections credit entries: what the credit of each write-off moves
      in the ledger, one entry per write-off and phase, the RELEASE to the
      available balance of the title's account and the CHARGEBACK of a write-off
      cancelled after its release, with where each entry stands with the ledger
      and, when it is not posted, why, as a closed code and never the ledger's
      own text. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
    name: Collections Credit Entries
  - description: >-
      Boleto collections operation queues: each case that waits for an operator
      and already has its state in collections, with its reason, since when it
      waits and the operations that act on it, read over the states collections
      keeps rather than from a list of its own. Each queue counts the items
      whose age reached its age limit, a per-tenant operational parameter. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Operation Queues
  - description: >-
      Boleto collections commands to the PCR: each registration, change and
      write-off sent to the PCR of the institution, with the idempotency key it
      keeps across attempts, its attempts, its next attempt and the last answer
      that did not accept it, never the body sent. Every operation of this
      section answers 422 PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Commands
  - description: >-
      Boleto collections notice subscription of the tenant's connection to the
      PCR: its synchronization with the PCR, the rotation of the secret the PCR
      signs the notices with, the deliveries of notices the PCR recorded for it,
      and the redelivery of a notice whose delivery failed. Every operation of
      this section answers 422 PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Connection
  - description: >-
      Boleto collections notices received from the PCR: each event the PCR of
      the institution delivered to collections, stored once per connection and
      event, with where its processing stands and what it was matched with,
      never the body received. Every operation of this section answers 422
      PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Notices
  - description: >-
      Boleto collections pooled accounts: the links of accounts that issue under
      the agreement of a pooled account, whose holder stays the beneficiary
      while the account's holder is the final one. A link registers nothing at
      Núclea. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
    name: Collections Pooled Accounts
  - description: >-
      Boleto collections setup: the tenant's business settings, with the default
      agreement template, the automatic enablement and the retention periods,
      and the tenant's connection to the PCR of its institution. Every operation
      of this section answers 422 PBP-0830 to a tenant without collections
      enabled.
    name: Collections Settings
  - description: >-
      Boleto collections titles: each boleto collections issues at the PCR of
      the institution, with its four state axes (registration, situation at the
      base, credit and block), never the data of a payer or of a beneficiary.
      The barcode and the digitable line are answered only while the title is
      REGISTERED. Every operation of this section answers 422 PBP-0830 to a
      tenant without collections enabled.
    name: Collections Titles
  - description: >-
      Boleto collections write-offs: each write-off of a collections title the
      PCR of the institution notified, with its route, its settlement, the state
      of its credit, its hold and its cancellation deadline, never the data of a
      payer. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
    name: Collections Write-offs
  - description: >-
      Aggregated counts, amounts and breakdowns over a period, for boletos and
      for payments.
    name: Dashboards
  - description: >-
      The notices Payments posts to the tenant's callback URL, one per type
      enabled in enabledEvents, each signed with the configuration's secret.
      Each item describes the body, the delivery headers, when the notice is
      sent and which providers send it.
    name: Notices
  - description: >-
      Paying bankslips, utility bills and DARF tax slips, and querying those
      payments.
    name: Payments
paths:
  /v1/collections/title-facts/{fact_id}/requeue:
    post:
      tags:
        - Collections Titles
      summary: Requeue a title fact the outbox gave up delivering
      description: >-
        Gives a title fact the outbox gave up delivering to the host (INVALID) a
        new event, with the same type, the same title and the same body,
        delivered the usual way. The action is recorded in the collections audit
        trail with its `reason` and the identity that made it, in the same
        transaction as the new event; a refusal records nothing.


        The reissued fact has an id of its own, derived from the INVALID fact's,
        and the host receives it under that id. INVALID does not prove that the
        host never received the fact: an earlier attempt can have delivered it
        and lost its outcome, and the host, which tells facts apart by their id,
        then receives the fact twice, under two ids, and so can the client, when
        the fact carries a customer notice. The INVALID event stays as it is. A
        fact is reissued once: a repeat is refused with 422 PBP-0802, and a
        reissued fact that also goes INVALID is requeued by its own id.


        The requeue does not change what the fact carries. A body the delivery
        cannot read goes INVALID again at its delivery, and so does a fact the
        host refuses for good, such as the customer notice of OVERDUE, BLOCKED
        or UNBLOCKED it does not accept, because the refusal repeats.


        The answer names the audit entry, with `outcome` ENQUEUED and
        `targetState` PENDING, the status of the reissued event.
      operationId: requeueTitleFact
      parameters:
        - description: Identifier of the title fact, as the host received it.
          in: path
          name: fact_id
          required: true
          schema:
            description: Identifier of the title fact, as the host received it.
            examples:
              - 0192a3b4-5c6d-7e8f-9a0b-1c2d3e4f5a30
            format: uuid
            type: string
        - description: >-
            Client-supplied idempotency key, a UUID. Required: a request without
            it, with a value that is not a UUID, or with the nil UUID
            (00000000-0000-0000-0000-000000000000) is refused with 400 PBP-0012.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            description: >-
              Client-supplied idempotency key, a UUID. Required: a request
              without it, with a value that is not a UUID, or with the nil UUID
              (00000000-0000-0000-0000-000000000000) is refused with 400
              PBP-0012.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionResult'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The body is missing or is not valid JSON (PBP-0001), or the
            `Idempotency-Key` header is missing or is not a UUID (PBP-0012).
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Authentication failed: the request carries no valid credential, or
            the credential does not identify a tenant. The error body is an RFC
            9457 problem document (`application/problem+json`) with error code
            `PBP-0003`. Obtain a valid bearer token and send the request again.
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The authenticated principal is not allowed to perform this request.
            The error body is an RFC 9457 problem document
            (`application/problem+json`) with error code `PBP-0004`: the
            principal lacks permission for this operation, and the permission
            has to be granted before the request can succeed.
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The tenant has no title fact with this id, or the fact's title does
            not exist (PBP-0005).
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Conflict. While an earlier request under the same `Idempotency-Key`
            is still being processed, a request under that key is answered
            PBP-0007 and is not run. Send it again under the SAME key after a
            short wait: the key answers this code for at most five minutes after
            the earlier request arrived. Afterwards the same key answers with
            the earlier request's stored answer, with 500 PBP-0002 when that
            answer cannot be replayed, or, when no answer was kept, by running
            the request. Do not send it under a new key to get past this answer:
            the earlier request may still take effect.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Request Entity Too Large
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The body or `fact_id` does not match the schema, or the `reason` is
            shorter than 10 characters once trimmed (PBP-0006). Refused, and
            nothing was written (PBP-0802, with the status in
            `details.currentState`): the fact is not INVALID, or it was already
            reissued, as when the request is repeated after its effect under
            another `Idempotency-Key`, since a fact is reissued once.
            `details.currentState` is then the reissued fact's status, or
            INVALID, the fact's own status, once the reissued fact was published
            and then purged past the tenant's `technicalRetentionDays`.
            Collections not enabled for the tenant (PBP-0830); or the same
            `Idempotency-Key` sent with another body (PBP-0013).
        '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. PBP-0008 means a dependency the request needs,
            authentication or the tenant's storage, is temporarily unavailable.
            The request was not processed; wait and send the same request again
            with the same Idempotency-Key.
      security:
        - BearerAuth: []
components:
  schemas:
    ActionRequest:
      additionalProperties: false
      properties:
        reason:
          description: >-
            Reason for the action, recorded in the audit trail, at least 10
            characters counted without the spaces at its ends, and at most 500
            counted as sent. Must not carry personal data.
          examples:
            - Notice intake restored after the window.
          maxLength: 500
          minLength: 10
          type: string
      required:
        - reason
      type: object
    ActionResult:
      additionalProperties: false
      properties:
        action:
          description: What the action did.
          enum:
            - RELEASE_WRITE_OFF
            - CANCEL_SCHEDULED_RELEASE
            - UNHOLD_WRITE_OFF
            - REVERSE_WRITE_OFF
            - REPROCESS_CREDIT_ENTRY
            - REPROCESS_PCR_COMMAND
            - CLOSE_PCR_COMMAND
            - SETTLE_SUBMISSION_FAILURE
            - ASSOCIATE_PCR_NOTICE
            - DISCARD_PCR_NOTICE
            - APPLY_PCR_NOTICE
            - WRITE_OFF_LATE_REGISTRATION
            - ENABLE_ACCOUNT
            - CREATE_ENABLEMENT_BATCH
            - APPROVE_ENABLEMENT
            - REJECT_ENABLEMENT
            - DISABLE_BENEFICIARY
            - CORRECT_AGREEMENT_DIVERGENCE
            - ADOPT_AGREEMENT_DIVERGENCE
            - BULK_ADOPT_AGREEMENT_DIVERGENCES
            - CREATE_AGREEMENT
            - UPDATE_AGREEMENT
            - CLOSE_AGREEMENT
            - REPROCESS_AGREEMENT_CLOSURE
            - FORCE_CLOSE_AGREEMENT
            - LINK_POOLED_ACCOUNT
            - REMOVE_POOLED_ACCOUNT_LINK
            - PUT_PCR_CONNECTION
            - PUT_COLLECTIONS_SETTINGS
            - SYNC_PCR_SUBSCRIPTION
            - ROTATE_PCR_NOTICE_SECRET
            - REDELIVER_PCR_NOTICE
            - REQUEUE_TITLE_FACT
          examples:
            - REDELIVER_PCR_NOTICE
          type: string
        auditActionId:
          description: Entry created in the audit trail.
          examples:
            - 3fa85f64-5717-4562-b3fc-2c963f66afa6
          format: uuid
          type: string
        outcome:
          description: >-
            APPLIED: the local effect is written and, when there is an external
            effect, it is confirmed. ENQUEUED: the action is recorded under a
            stable key and its effect follows, at the PCR or the ledger; when
            the action carries that effect out within the request, targetState
            shows where it got.
          enum:
            - APPLIED
            - ENQUEUED
          examples:
            - ENQUEUED
          type: string
        targetId:
          description: Identifier of the resource the action acted on.
          examples:
            - 7c9e6679-7425-40de-944b-e07fc1f90ae7
          format: uuid
          type: string
        targetState:
          description: >-
            State of the target after the action, as far as collections knows it
            when it answers. When the action presents a credit entry to the
            ledger again within the request, the entry's state after that
            presentation: for example POSTED when it posted.
          examples:
            - FAILED
          maxLength: 64
          type: string
        targetType:
          description: Kind of resource the action acted on.
          enum:
            - TITLE
            - WRITE_OFF
            - CREDIT_ENTRY
            - PCR_COMMAND
            - PCR_NOTICE
            - BENEFICIARY
            - ENABLEMENT_BATCH
            - AGREEMENT
            - AGREEMENT_DIVERGENCE
            - POOLED_ACCOUNT_LINK
            - PCR_CONNECTION
            - PCR_SUBSCRIPTION
            - PCR_WEBHOOK_DELIVERY
            - COLLECTIONS_SETTINGS
            - ACCOUNT
            - TITLE_FACT
            - RECEIVER_PAYMENT
            - RECEIVER_OUTCOME
          examples:
            - PCR_WEBHOOK_DELIVERY
          type: string
      required:
        - auditActionId
        - action
        - targetType
        - targetId
        - outcome
        - targetState
      type: object
    Detail:
      additionalProperties: true
      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
    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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.