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

# Issue installment boletos

> Creates a series of 2 to 36 independent boletos, one per installment. The response is immediate: the series and its installments are recorded `PENDING`, then registered at the provider one at a time.

<Info>**Providers:** Lerian (PCR) and BTG.</Info>

<Warning>**Lerian (PCR): under development.** The Lerian provider can change before it is released. BTG is available.</Warning>

**How it works**

- Send `totalAmount` to split it evenly, with the remainder on the last installment. Or send each amount in `installmentAmounts`.
- Installment k falls due on `firstDueDate` plus (k-1) times `intervalDays` days. `intervalDays` is 1 to 365, with no business-day adjustment.
- `fine.startDate`, `interest.startDate`, `paymentDeadline` and the `discounts` limit dates are set for the first installment. Each installment adds the same days to its own due date.
- Example: `firstDueDate` 2030-01-10, `intervalDays` 30 and `paymentDeadline` 2030-01-25 give due dates 2030-01-10, 2030-02-09 and 2030-03-11, payable until 2030-01-25, 2030-02-24 and 2030-03-26.
- `discount.limitDate` is the same date on every installment, before `firstDueDate`. For a discount that follows each installment, send `discounts`.
- `documentNumbers` gives each installment its own `documentNumber`, in order. A single `documentNumber` is the same on every installment.
- `ourNumbers` gives one nosso número per installment. A number already held by an active boleto on the same provider account refuses the series before the provider is called.
- Do not send `guarantor`: the final beneficiary is the account holder, read once per series.
- The account in `midazAccountId` must belong to the `X-Organization-Id` organization and to `ledgerId`.
- The term rules are the same as `POST /v1/boletos`, judged on each installment's own dates.
- `GET /v1/boletos/{id}` and the `BOLETO_CREATED` notification show each installment's own dates.
- A new series returns status `CREATED` and `closed` false. Follow it at `GET /v1/boletos/installments/{series_id}`, and each installment at `GET /v1/boletos/{id}`.
- Nothing is recorded when a request is refused. A refusal releases the `Idempotency-Key`, so a retry under the same key runs again.
- A retry under the same key returns the series in its current state with `201`. After `PBP-0013`, send under a new key.
- After the stored answer expires, the same key returns the series it names with `201`, whatever its dates are now. Start dates are compared by day and `documentNumbers` item by item; a resend that leaves out the original `ourNumbers` still returns `201`.
- Only a new series is refused for a first due date (`PBP-0102`) or a discount limit date (`PBP-0006`) before today.
- Refusals come in this order: auth; `Idempotency-Key` (`PBP-0012`, `PBP-0007`, `PBP-0013`); schema `PBP-0001`; `PBP-0025`, `PBP-0026`; body rules (`PBP-0006`, `PBP-0102`); `ourNumbers` (`PBP-0102`, `PBP-0701`, `PBP-0017`, `PBP-0001`); the stored series; the account (`PBP-0005`, `PBP-0106`, `PBP-0301`); the final beneficiary (`PBP-0118`, `PBP-0116`, `PBP-0117`, `PBP-0119`); the numbering account (`PBP-0017`, `PBP-0014`, `PBP-0015`); last `PBP-0108`.
- When the provider settles through this service (today BTG), incomplete accounting routes refuse the series. Check them with `GET /v1/admin/accounting-routes/preflight`.

**Provider differences**

| | Lerian (PCR) | BTG |
|---|---|---|
| Default payment deadline | Days of the collections agreement | Days set for the tenant, or the provider default |
| Maximum payment deadline | None | Provider maximum after the due date |
| Accounting routes | Not checked | Must be complete |

**Planned changes**

- `PBP-0108`: today it names the boleto that holds the nosso número whatever its organization, and reading one of another organization returns `404`. It will name the holder only when it belongs to the `X-Organization-Id` organization.



## OpenAPI

````yaml /es/openapi/v3-current/payments-pcr.yaml post /v1/boletos/installments
openapi: 3.1.0
info:
  title: Payments PCR preview
  version: 2026-11-23-preview
  description: >-
    Preview of Payments with boleto collections through Lerian (PCR), CNAB 240,
    electronic payers (DDA), bill payments, and shared administration. This
    reference includes current behavior and planned changes. Read each
    operation's provider information: some operations support BTG only today.
    The preview is under development and can change before release. Confirm
    availability with Lerian before integration.


    The webhooks section describes notices Payments sends to your callback URL.
    Verify the signature and timestamp before processing a notice. Use the
    eventId and X-Webhook-Id described by each notice to detect repeated
    delivery. Do not assume delivery order.
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
  - name: CNAB Agreements
    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 Remittances
    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 Returns
    description: >-
      CNAB 240 Lerian return files, one per agreement and cut, built from the
      journal of what happened to the titles that entered by remittance, and
      their download. Every operation of this section answers 422 PBP-0900 to a
      tenant without CNAB 240 enabled.
  - 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
  - name: Collections Credit Entries
    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.
  - 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
  - name: Collections Write-offs
    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.
  - description: >-
      Aggregated counts, amounts and breakdowns over a period, for boletos and
      for payments.
    name: Dashboards
  - name: Electronic payers
    description: >-
      Electronic payer (DDA): adhesion of the institution's customer to
      electronic presentment of boletos, its accounts and aggregates, and the
      outcome of each request. Under development: can change before it is
      released.
  - 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. The webhook is the channel of the first
      delivery: delivery will later move to Lerian's Streaming Hub, which will
      then be the only channel, with a change of subscription and a migration
      plan communicated to the client.
    name: Notices
  - description: >-
      Paying bankslips, utility bills and DARF tax slips, and querying those
      payments.
    name: Payments
  - name: Presented boletos
    description: >-
      Boletos of other institutions presented to the electronic payer: list,
      detail, acceptance and authorized third parties. Under development: can
      change before it is released.
paths:
  /v1/boletos/installments:
    post:
      tags:
        - Boletos
      summary: Issue installment boletos
      description: >-
        Creates a series of 2 to 36 independent boletos, one per installment.
        The response is immediate: the series and its installments are recorded
        `PENDING`, then registered at the provider one at a time.


        <Info>**Providers:** Lerian (PCR) and BTG.</Info>


        <Warning>**Lerian (PCR): under development.** The Lerian provider can
        change before it is released. BTG is available.</Warning>


        **How it works**


        - Send `totalAmount` to split it evenly, with the remainder on the last
        installment. Or send each amount in `installmentAmounts`.

        - Installment k falls due on `firstDueDate` plus (k-1) times
        `intervalDays` days. `intervalDays` is 1 to 365, with no business-day
        adjustment.

        - `fine.startDate`, `interest.startDate`, `paymentDeadline` and the
        `discounts` limit dates are set for the first installment. Each
        installment adds the same days to its own due date.

        - Example: `firstDueDate` 2030-01-10, `intervalDays` 30 and
        `paymentDeadline` 2030-01-25 give due dates 2030-01-10, 2030-02-09 and
        2030-03-11, payable until 2030-01-25, 2030-02-24 and 2030-03-26.

        - `discount.limitDate` is the same date on every installment, before
        `firstDueDate`. For a discount that follows each installment, send
        `discounts`.

        - `documentNumbers` gives each installment its own `documentNumber`, in
        order. A single `documentNumber` is the same on every installment.

        - `ourNumbers` gives one nosso número per installment. A number already
        held by an active boleto on the same provider account refuses the series
        before the provider is called.

        - Do not send `guarantor`: the final beneficiary is the account holder,
        read once per series.

        - The account in `midazAccountId` must belong to the `X-Organization-Id`
        organization and to `ledgerId`.

        - The term rules are the same as `POST /v1/boletos`, judged on each
        installment's own dates.

        - `GET /v1/boletos/{id}` and the `BOLETO_CREATED` notification show each
        installment's own dates.

        - A new series returns status `CREATED` and `closed` false. Follow it at
        `GET /v1/boletos/installments/{series_id}`, and each installment at `GET
        /v1/boletos/{id}`.

        - Nothing is recorded when a request is refused. A refusal releases the
        `Idempotency-Key`, so a retry under the same key runs again.

        - A retry under the same key returns the series in its current state
        with `201`. After `PBP-0013`, send under a new key.

        - After the stored answer expires, the same key returns the series it
        names with `201`, whatever its dates are now. Start dates are compared
        by day and `documentNumbers` item by item; a resend that leaves out the
        original `ourNumbers` still returns `201`.

        - Only a new series is refused for a first due date (`PBP-0102`) or a
        discount limit date (`PBP-0006`) before today.

        - Refusals come in this order: auth; `Idempotency-Key` (`PBP-0012`,
        `PBP-0007`, `PBP-0013`); schema `PBP-0001`; `PBP-0025`, `PBP-0026`; body
        rules (`PBP-0006`, `PBP-0102`); `ourNumbers` (`PBP-0102`, `PBP-0701`,
        `PBP-0017`, `PBP-0001`); the stored series; the account (`PBP-0005`,
        `PBP-0106`, `PBP-0301`); the final beneficiary (`PBP-0118`, `PBP-0116`,
        `PBP-0117`, `PBP-0119`); the numbering account (`PBP-0017`, `PBP-0014`,
        `PBP-0015`); last `PBP-0108`.

        - When the provider settles through this service (today BTG), incomplete
        accounting routes refuse the series. Check them with `GET
        /v1/admin/accounting-routes/preflight`.


        **Provider differences**


        | | Lerian (PCR) | BTG |

        |---|---|---|

        | Default payment deadline | Days of the collections agreement | Days
        set for the tenant, or the provider default |

        | Maximum payment deadline | None | Provider maximum after the due date
        |

        | Accounting routes | Not checked | Must be complete |


        **Planned changes**


        - `PBP-0108`: today it names the boleto that holds the nosso número
        whatever its organization, and reading one of another organization
        returns `404`. It will name the holder only when it belongs to the
        `X-Organization-Id` organization.
      operationId: createBoletoInstallments
      parameters:
        - description: >-
            Midaz organization the account and every installment live under.
            Required: a request without it, or with a value that is not a
            canonical UUID, is refused with 400 PBP-0025.
          in: header
          name: X-Organization-Id
          schema:
            description: >-
              Midaz organization the account and every installment live under.
              Required: a request without it, or with a value that is not a
              canonical UUID, is refused with 400 PBP-0025.
            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/CreateInstallmentsRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateInstallmentsResponse'
          description: >-
            Created. The series is recorded with its installments in `PENDING`.
            A retry under the same key returns the series in its current state.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0001:
                  summary: 'PBP-0001: Request does not match the schema'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0001
                    title: Bad Request
                    status: 400
                    detail: validation failed
                    code: PBP-0001
                    errors:
                      - message: unexpected property
                        location: body.guarantor
                PBP-0012:
                  summary: 'PBP-0012: Idempotency-Key missing'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0012
                    title: Bad Request
                    status: 400
                    detail: Idempotency-Key header is required and must be a UUID
                    code: PBP-0012
                PBP-0025:
                  summary: 'PBP-0025: Organization header missing'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0025
                    title: Bad Request
                    status: 400
                    detail: X-Organization-Id header is required and must be a UUID
                    code: PBP-0025
                PBP-0026:
                  summary: 'PBP-0026: Ledger missing or invalid'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0026
                    title: Bad Request
                    status: 400
                    detail: ledgerId is required and must be a UUID
                    code: PBP-0026
                PBP-0116:
                  summary: 'PBP-0116: Account without a registered holder'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0116
                    title: FINAL_BENEFICIARY_DATA_MISSING
                    status: 400
                    detail: >-
                      The account this boleto would be issued against has no
                      registered owner on file, so the boleto's final
                      beneficiary cannot be established. Register the account's
                      owner, or use an account that has one.
                    code: PBP-0116
          description: >-
            Bad Request.


            - `PBP-0001`: the body does not match the schema, `guarantor` is
            sent, `installments` or `intervalDays` is zero or less, an
            `ourNumbers` or `documentNumbers` item is invalid, or a date or
            amount cannot be read. The member is named, for example
            `ourNumbers[2]`.

            - `PBP-0012`: `Idempotency-Key` is missing or is not a UUID.

            - `PBP-0025`: `X-Organization-Id` is missing or is not a UUID.

            - `PBP-0026`: `ledgerId` is missing or is not a UUID.

            - `PBP-0116`: the account holder's registration is incomplete.
            Complete it.


            See the [error
            list](/es/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0003:
                  summary: 'PBP-0003: Invalid credential'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0003
                    title: Unauthorized
                    status: 401
                    detail: authentication required
                    code: PBP-0003
          description: >-
            Unauthorized.


            - `PBP-0003`: the credential is missing or invalid, or does not
            identify a tenant. Get a valid bearer token.
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0004:
                  summary: 'PBP-0004: No permission'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0004
                    title: Forbidden
                    status: 403
                    detail: permission denied
                    code: PBP-0004
          description: >-
            Forbidden.


            - `PBP-0004`: the credential does not have permission for this
            operation.
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0005:
                  summary: 'PBP-0005: Account not found'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0005
                    title: Not Found
                    status: 404
                    detail: account not found
                    code: PBP-0005
          description: >-
            Not Found.


            - `PBP-0005`: the account does not exist, or belongs to another
            organization or ledger.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0007:
                  summary: 'PBP-0007: Same key still running'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0007
                    title: Conflict
                    status: 409
                    detail: >-
                      a request with this Idempotency-Key is still being
                      processed
                    code: PBP-0007
          description: >-
            Conflict.


            - `PBP-0007`: an earlier request under the same `Idempotency-Key` is
            still running. Retry under the same key after a few seconds. Do not
            switch keys: the earlier request can still take effect. This code
            lasts at most five minutes after the earlier request arrived. After
            that, the same key returns the earlier answer, `500 PBP-0002` when
            it cannot be replayed, or runs the request when no answer was kept.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0010:
                  summary: 'PBP-0010: Body too large'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0010
                    title: Request Entity Too Large
                    status: 413
                    detail: request body too large
                    code: PBP-0010
          description: |-
            Payload Too Large.

            - `PBP-0010`: the body is larger than the size limit.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0102:
                  summary: 'PBP-0102: Invalid series'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0102
                    title: INSTALLMENT_VALIDATION_ERROR
                    status: 422
                    detail: installments must be between 2 and 36
                    code: PBP-0102
                PBP-0006:
                  summary: 'PBP-0006: Term breaks a rule'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0006
                    title: Unprocessable Entity
                    status: 422
                    detail: discount and discounts cannot be sent together
                    code: PBP-0006
                PBP-0013:
                  summary: 'PBP-0013: Key used for another request'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0013
                    title: Idempotency Key Conflict
                    status: 422
                    detail: this Idempotency-Key was used for a different request
                    code: PBP-0013
                PBP-0014:
                  summary: 'PBP-0014: Provider refused'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0014
                    title: PROVIDER_REJECTED
                    status: 422
                    detail: banking provider rejected the boleto emission request
                    code: PBP-0014
                PBP-0017:
                  summary: 'PBP-0017: Provider not set up'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0017
                    title: PROVIDER_SETUP_INCOMPLETE
                    status: 422
                    detail: >-
                      the provider account for this tenant is not fully
                      configured
                    code: PBP-0017
                PBP-0106:
                  summary: 'PBP-0106: Account validation not configured'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0106
                    title: BOLETO_VALIDATOR_NOT_CONFIGURED
                    status: 422
                    detail: >-
                      Account validation is not configured for this environment.
                      Configure the Midaz ledger connection before issuing
                      boletos.
                    code: PBP-0106
                PBP-0108:
                  summary: 'PBP-0108: ourNumber in use'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0108
                    title: DUPLICATE_OUR_NUMBER
                    status: 422
                    detail: >-
                      ourNumber is held by boleto
                      0196a3c2-8f4e-7b1a-9c2d-3e4f5a6b7c8d; read it before you
                      inform another number
                    code: PBP-0108
                    ourNumberHolderBoletoId: 0196a3c2-8f4e-7b1a-9c2d-3e4f5a6b7c8d
                    installmentNumber: 2
                PBP-0117:
                  summary: 'PBP-0117: Holder cannot be final beneficiary'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0117
                    title: FINAL_BENEFICIARY_DATA_INVALID
                    status: 422
                    detail: >-
                      The registered owner of the account this boleto would be
                      issued against is recorded in a way that cannot be used as
                      the boleto's final beneficiary. Correct the account
                      owner's registration; resubmitting this request unchanged
                      will not resolve it.
                    code: PBP-0117
                PBP-0119:
                  summary: 'PBP-0119: Payer is the account holder'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0119
                    title: FINAL_BENEFICIARY_SAME_AS_PAYER
                    status: 422
                    detail: the payer is the holder of the issuing account
                    code: PBP-0119
                PBP-0128:
                  summary: 'PBP-0128: Accounting routes incomplete (BTG)'
                  value:
                    title: ACCOUNTING_ROUTES_NOT_READY
                    status: 422
                    code: PBP-0128
                    detail: >-
                      boleto issuance refused: this organization's Payments
                      accounting routes cannot carry the boleto's settlement
                      credit (accounting_routes_incomplete); read GET
                      /v1/admin/accounting-routes/preflight for this
                      organization and ledger
                    type: https://errors.lerian.studio/v1/PBP-0128
                PBP-0700:
                  summary: 'PBP-0700: No provider route'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0700
                    title: PROVIDER_ROUTE_NOT_CONFIGURED
                    status: 422
                    detail: no provider is configured for BOLETO_ISSUANCE
                    code: PBP-0700
                PBP-0701:
                  summary: 'PBP-0701: Capability not supported'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0701
                    title: PROVIDER_CAPABILITY_NOT_SUPPORTED
                    status: 422
                    detail: the provider does not support this capability
                    code: PBP-0701
                    capability: CLIENT_SUPPLIED_OUR_NUMBER
          description: >-
            Unprocessable Entity.


            - `PBP-0102`: the series is invalid. Examples: a payer document with
            a bad check digit, `intervalDays` above 365, or `installments`
            outside 2 to 36. Also a list of the wrong length, an amount below
            0.01 or with more than two decimal places, or amounts that do not
            add up to `totalAmount`. Also a repeated nosso número (see
            `duplicateInstallmentNumbers`) or a first due date in the past.

            - `PBP-0006`: a term breaks a rule: type `QR_CODE` or `HYBRID`, a
            refused fine, interest or discount, or an installment due after
            9999-12-31. The `detail` names the member.

            - `PBP-0013`: the `Idempotency-Key` was used with a different body
            or another organization, or every installment of its series failed.
            Send under a new key.

            - `PBP-0014`: the provider refused the lookup of the account the
            numbers are reserved in.

            - `PBP-0017`: `ourNumbers` is sent and there is no provider to judge
            them, or the provider has no numbering account for `midazAccountId`
            (no account discovery, or the account is not yet enabled at the
            provider).

            - `PBP-0106`: account validation is not configured on this instance.

            - `PBP-0108`: a nosso número is already held by an active boleto on
            the same provider account. See `installmentNumber` and
            `ourNumberHolderBoletoId`, given only when the holder can be read
            and is not a hybrid boleto. Planned: the holder is named only when
            it belongs to the same organization.

            - `PBP-0117`: the account holder cannot be a final beneficiary.
            Correct the holder's registration.

            - `PBP-0119`: the payer is the holder of the issuing account.

            - `PBP-0128`: (BTG) the organization's accounting routes are
            incomplete, ambiguous or malformed. Run `GET
            /v1/admin/accounting-routes/preflight`.

            - `PBP-0700`: the tenant has no provider for `BOLETO_ISSUANCE`.

            - `PBP-0701`: the provider does not declare a capability the series
            needs. Nothing is written and the provider is not called.
            `capability` is one of `OPERATION_BOLETO_ISSUANCE`,
            `BOLETO_INSTALLMENTS`, `CLIENT_SUPPLIED_OUR_NUMBER`,
            `BOLETO_DOCUMENT_NUMBER`, `BOLETO_CHARGE_START_DATE`,
            `BOLETO_DISCOUNT_BANDS` or `BOLETO_PAYMENT_DEADLINE`.


            See the [error
            list](/es/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0002:
                  summary: 'PBP-0002: Unexpected failure'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0002
                    title: Internal Server Error
                    status: 500
                    detail: internal error
                    code: PBP-0002
          description: >-
            Internal Server Error. The `detail` is a fixed text.


            - `PBP-0002`: an unexpected failure, or the stored answer of this
            key cannot be replayed. Contact support. Do not resend under a new
            key. A `500` while the series is recorded releases the key, so a
            retry under the same key runs again; a failed commit keeps the key
            until the stored answer expires.
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0008:
                  summary: 'PBP-0008: Dependency unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0008
                    title: Service Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0008
                PBP-0015:
                  summary: 'PBP-0015: Provider did not answer'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0015
                    title: PROVIDER_UNAVAILABLE
                    status: 503
                    detail: internal error
                    code: PBP-0015
                PBP-0118:
                  summary: 'PBP-0118: Holder registration unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0118
                    title: FINAL_BENEFICIARY_UNAVAILABLE
                    status: 503
                    detail: internal error
                    code: PBP-0118
                PBP-0301:
                  summary: 'PBP-0301: Ledger unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0301
                    title: Ledger Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0301
                PBP-0704:
                  summary: 'PBP-0704: Provider not installed'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0704
                    title: PROVIDER_NOT_INSTALLED
                    status: 503
                    detail: internal error
                    code: PBP-0704
          description: >-
            Service Unavailable. Nothing was recorded. Retry under the same
            `Idempotency-Key`. The `detail` is a fixed text.


            - `PBP-0008`: a dependency (authentication or storage) is
            unavailable.

            - `PBP-0015`: the provider did not answer the lookup of the account
            the numbers are reserved in.

            - `PBP-0118`: the account holder's registration could not be read,
            or reading it is not configured.

            - `PBP-0301`: the ledger credential, the accounting routes or the
            ledger settings could not be read.

            - `PBP-0704`: the provider is not installed or not connected for the
            tenant.
      security:
        - BearerAuth: []
components:
  schemas:
    CreateInstallmentsRequest:
      additionalProperties: false
      properties:
        discount:
          $ref: '#/components/schemas/DiscountRequest'
          description: >-
            Discount of every installment. Its limitDate is absolute: the same
            date on every installment, before firstDueDate. For a discount whose
            date follows each installment's due date, send discounts. Send
            either discount or discounts, never both: the two together are
            refused with 422 PBP-0006 naming discounts.
        discounts:
          description: >-
            Discount bands, one to three, in the order they apply, written for
            the first installment: each installment gets the same number of
            days, between its limitDate and firstDueDate, before its own due
            date. Every band has the first band's type, and each limitDate is
            after the previous band's and before firstDueDate; otherwise 422
            PBP-0006 naming the band, as in discounts[1].limitDate. More than
            one band, on a provider that does not register them, is refused with
            422 PBP-0701 naming BOLETO_DISCOUNT_BANDS in the capability member.
          items:
            $ref: '#/components/schemas/DiscountRequest'
          maxItems: 3
          minItems: 1
          type:
            - array
            - 'null'
        documentNumbers:
          description: >-
            Payee's own reference for each installment (seu numero), such as an
            invoice number: one per installment, in installment order, at most
            36. Optional: when absent or null, no installment carries one; an
            empty list is refused with 422 PBP-0102, as is a list of another
            length. Each item follows the rule of documentNumber on POST
            /v1/boletos: 1 to 15 printable ASCII characters (space through
            tilde), stored as given; an item that is empty, longer than 15
            characters, made only of spaces, that carries any other character or
            that carries markup is refused with 400 PBP-0001 naming it as
            documentNumbers[<i>], counted from 0. When the provider that serves
            the issuance does not register it, the series is refused with 422
            PBP-0701, naming BOLETO_DOCUMENT_NUMBER in the capability member;
            nothing is recorded and the provider is not called.
          examples:
            - - NF-2030/0001
              - NF-2030/0002
          items:
            maxLength: 15
            minLength: 1
            pattern: ^[ -~]{1,15}$
            type: string
          maxItems: 36
          type:
            - array
            - 'null'
        fine:
          $ref: '#/components/schemas/FineRequest'
        firstDueDate:
          description: >-
            Due date of the first installment, YYYY-MM-DD. On LERIAN each
            installment's due date must be at most 3650 days after the day of
            issuance; otherwise 422 PBP-0006 naming the member, before anything
            is recorded.
          examples:
            - '2030-01-15'
          format: date
          type: string
        installmentAmounts:
          description: >-
            Per-installment amounts, at most 36. When supplied, its length must
            match installments. On LERIAN each installment's amount must be
            below 100000000.00; otherwise 422 PBP-0006 naming the member, before
            anything is recorded.
          items:
            maxLength: 32
            type: string
          maxItems: 36
          type:
            - array
            - 'null'
        installments:
          description: Number of installments.
          examples:
            - 2
          format: int64
          type: integer
        interest:
          $ref: '#/components/schemas/InterestRequest'
        intervalDays:
          description: Days between consecutive installments.
          examples:
            - 30
          format: int64
          type: integer
        ledgerId:
          description: >-
            Midaz ledger the account lives in and every installment is written
            with. Required: absent, blank or not a canonical UUID is refused
            with 400 PBP-0026.
          type: string
        midazAccountId:
          description: Midaz account the series settles into.
          type: string
        ourNumbers:
          description: >-
            Bank-side identification (nosso numero) chosen by the payee for each
            installment: one number per installment, in installment order, at
            most 36. All or none: when absent or null, the provider assigns
            every number, and an empty list is refused with 422 PBP-0102, as is
            a list of another length. Each item follows the rule of ourNumber on
            POST /v1/boletos: surrounding spaces are removed, a hyphen is
            accepted only when followed by exactly one digit, which is
            discarded, and any other character that is not a digit is refused;
            the accepted width, in significant digits, is set by the provider
            that serves the issuance and can differ between providers: read it
            as numbering.maxWidth of that provider in GET
            /v1/admin/providers/capabilities. A format or width refusal answers
            400 PBP-0001 naming the item as ourNumbers[<i>], counted from 0. Two
            installments with the same number, leading zeros ignored, are
            refused with 422 PBP-0102, and the problem carries the installments,
            counted from 1, as duplicateInstallmentNumbers. A number already
            held by an active boleto of this tenant on the same provider account
            refuses the whole series with 422 PBP-0108 before the provider is
            called, and the problem carries the installment as installmentNumber
            and, when the holder can be read and is not a hybrid boleto, its id
            as ourNumberHolderBoletoId. Only a series with numbers depends on
            the provider account lookup: 422 PBP-0017 when the provider has no
            numbering account for the series' midazAccountId (the installation
            has no account discovery, or the account is not yet enabled at the
            provider), 422 PBP-0014 when the provider refuses the lookup and 503
            PBP-0015 when the provider does not answer.
          items:
            type: string
          maxItems: 36
          type:
            - array
            - 'null'
        payer:
          $ref: '#/components/schemas/PayerRequest'
        paymentDeadline:
          description: >-
            Last day the first installment can be paid, YYYY-MM-DD; each
            installment gets the same number of days added to its own due date.
            On or after firstDueDate and at most the maximum the provider
            declares after it, LERIAN declaring none; otherwise 422 PBP-0006
            naming paymentDeadline. Absent, each installment's deadline is its
            due date plus the days the tenant set for the provider or, with none
            set, plus the provider's default; on LERIAN, plus the
            paymentDeadlineDays of the agreement the installment is issued
            under. A provider that does not register it refuses it with 422
            PBP-0701 naming BOLETO_PAYMENT_DEADLINE in the capability member.
          examples:
            - '2030-01-25'
          format: date
          type: string
        totalAmount:
          description: >-
            Series total as a decimal string. Optional: either this or
            installmentAmounts must be supplied.
          examples:
            - '100.00'
          maxLength: 32
          type: string
        type:
          description: Boleto type applied to every installment.
          examples:
            - TRADITIONAL
          type: string
      required:
        - type
        - payer
        - installments
        - firstDueDate
        - intervalDays
        - midazAccountId
      type: object
    CreateInstallmentsResponse:
      additionalProperties: false
      properties:
        boletos:
          items:
            $ref: '#/components/schemas/InstallmentBoletoResponse'
          type:
            - array
            - 'null'
        closed:
          description: >-
            Whether no installment of the series can still be paid: true when
            every installment is SETTLED, CANCELED, INACTIVATED, REVERSED or
            FAILED. Always present. It can return to false when the provider
            reverts the cancellation of an installment.
          type: boolean
        installmentsCount:
          format: int64
          type: integer
        ledgerId:
          description: Midaz ledger the installments were written with. Always present.
          type: string
        organizationId:
          description: >-
            Midaz organization the installments were written with. Always
            present, and always the organization of the X-Organization-Id
            header.
          type: string
        seriesId:
          type: string
        status:
          description: >-
            Emission outcome of the series, derived from its installments on
            every read. CREATED: some installment has no emission outcome yet.
            COMPLETED: every installment has an outcome and none is FAILED.
            PARTIAL_FAILURE: every installment has an outcome and some, not all,
            are FAILED; those carry errorMessage. FAILED: every installment is
            FAILED. It does not depend on payment, cancellation or write-off,
            and it can move from COMPLETED to PARTIAL_FAILURE or FAILED when the
            provider later refuses an accepted installment: a client waiting for
            the final outcome reads closed.
          enum:
            - CREATED
            - COMPLETED
            - PARTIAL_FAILURE
            - FAILED
          type: string
        totalAmount:
          type: string
      required:
        - seriesId
        - organizationId
        - ledgerId
        - status
        - closed
        - totalAmount
        - installmentsCount
        - boletos
      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
    DiscountRequest:
      additionalProperties: false
      properties:
        amount:
          description: >-
            Decimal string greater than zero.


            - `FIXED`: BRL, up to 2 decimal places, below the boleto amount
            (each installment's own amount on installments).

            - `PERCENTAGE`: percent (`2.5` means 2.5%), below 100, up to 6
            decimal places. Lerian (PCR): up to 5.

            - More places, or at or above the ceiling: 422 `PBP-0006` naming it.
          maxLength: 32
          type: string
        limitDate:
          description: >-
            Last day the discount applies, `YYYY-MM-DD`. On or after the
            issuance day (Brazilian calendar) and before the due date: before
            `dueDate` on a single boleto, before `firstDueDate` on installments.
            Outside that window: 422 `PBP-0006`.
          examples:
            - '2029-12-31'
          format: date
          type: string
        type:
          description: >-
            `FIXED` (BRL, up to 2 decimal places) or `PERCENTAGE` (percent of
            the face value, up to 6 decimal places, 5 on Lerian (PCR)). Granted
            when the boleto is paid on or before `limitDate`. Required when a
            discount is sent, together with `amount` and `limitDate`: absent,
            empty or unlisted is refused with 422 `PBP-0006`.
          type: string
      required:
        - amount
        - limitDate
      type: object
    FineRequest:
      additionalProperties: false
      properties:
        amount:
          description: >-
            Decimal string greater than zero.


            - `FIXED`: BRL, up to 2 decimal places.

            - `PERCENTAGE`: percent (`2.5` means 2.5%), up to 6 decimal places.

            - More places: 422 `PBP-0006` naming `fine.amount`.

            - Lerian (PCR): `PERCENTAGE` up to 5 decimal places and at most 100;
            `FIXED` below the boleto amount. Otherwise 422 `PBP-0006` naming the
            member, before anything is recorded.
          maxLength: 32
          type: string
        startDate:
          description: >-
            First day the fine is charged, `YYYY-MM-DD`. Optional. Without it,
            the day after the due date.


            - After the due date and on or before the payment deadline.
            Otherwise 422 `PBP-0006` naming `fine.startDate` (in a batch, an
            item problem `PBP-0006`).

            - Not a calendar date, or `0001-01-01` or earlier: 400 `PBP-0001`
            (in `POST /v1/boletos/batches`, an item problem `PBP-0001` reported
            in 422 `PBP-0123`).

            - Lerian (PCR), without `paymentDeadline`: the deadline is the due
            date plus the agreement's `paymentDeadlineDays`, and a later day is
            refused with 422 `PBP-0006`.

            - `POST /v1/boletos/installments`: the day for the first
            installment. Installment k (from 1) takes that day plus (k - 1)
            times `intervalDays`.

            - A provider that does not register it refuses it with 422
            `PBP-0701` and `capability` `BOLETO_CHARGE_START_DATE`. Nothing is
            recorded.
          examples:
            - '2030-01-16'
          format: date
          type: string
        type:
          description: >-
            `FIXED` (BRL, up to 2 decimal places) or `PERCENTAGE` (percent of
            the face value, up to 6 decimal places, 5 on Lerian (PCR)). Charged
            once, when the boleto is paid after the due date. Required when a
            fine is sent: absent, empty or unlisted is refused with 422
            `PBP-0006`.
          type: string
      required:
        - amount
      type: object
    InterestRequest:
      additionalProperties: false
      properties:
        amount:
          description: >-
            Decimal string greater than zero.


            - `DAILY_FIXED`: BRL per calendar day, up to 2 decimal places.

            - `DAILY_PERCENTAGE` and `MONTHLY_PERCENTAGE`: percent (`1` means
            1%), up to 6 decimal places.

            - Refused amounts: 422 `PBP-0006` naming `interest.amount`.

            - Lerian (PCR): percentages up to 5 decimal places. A
            `DAILY_PERCENTAGE` is registered as 30 times its value per month,
            which must have up to 2 decimal places: `0.001` is 0.03 a month;
            `0.0333` (0.999 a month) is refused. `DAILY_FIXED` below
            `1000000000000`; `MONTHLY_PERCENTAGE`, or 30 times a
            `DAILY_PERCENTAGE`, below `1000000000`.
          maxLength: 32
          type: string
        startDate:
          description: >-
            First day interest accrues, `YYYY-MM-DD`. Optional. Without it, the
            day after the due date.


            - After the due date and on or before the payment deadline.
            Otherwise 422 `PBP-0006` naming `interest.startDate` (in a batch, an
            item problem `PBP-0006`).

            - Not a calendar date, or `0001-01-01` or earlier: 400 `PBP-0001`
            (in `POST /v1/boletos/batches`, an item problem `PBP-0001` reported
            in 422 `PBP-0123`).

            - Lerian (PCR), without `paymentDeadline`: the deadline is the due
            date plus the agreement's `paymentDeadlineDays`, and a later day is
            refused with 422 `PBP-0006`.

            - `POST /v1/boletos/installments`: the day for the first
            installment. Installment k (from 1) takes that day plus (k - 1)
            times `intervalDays`.

            - A provider that does not register it refuses it with 422
            `PBP-0701` and `capability` `BOLETO_CHARGE_START_DATE`. Nothing is
            recorded.
          examples:
            - '2030-01-16'
          format: date
          type: string
        type:
          description: >-
            Accrued for each calendar day the boleto is paid late. Required when
            interest is sent: absent, empty or unlisted is refused with 422
            `PBP-0006`.


            - `DAILY_FIXED`: BRL per day late, up to 2 decimal places.

            - `DAILY_PERCENTAGE`: percent of the face value per day late, up to
            6 decimal places (5 on Lerian (PCR), where 30 times it must have up
            to 2).

            - `MONTHLY_PERCENTAGE`: percent of the face value per month, accrued
            per calendar day over a 30-day month, up to 6 decimal places (5 on
            Lerian (PCR)).
          type: string
      required:
        - amount
      type: object
    PayerRequest:
      additionalProperties: false
      properties:
        address:
          $ref: '#/components/schemas/AddressRequest'
        document:
          description: Payer CPF or CNPJ, digits only.
          type: string
        name:
          description: Payer full name.
          type: string
      required:
        - document
        - name
      type: object
    InstallmentBoletoResponse:
      additionalProperties: false
      properties:
        amount:
          type: string
        dueDate:
          type: string
        errorMessage:
          type: string
        id:
          type: string
        installmentLabel:
          type: string
        installmentNumber:
          format: int64
          type: integer
        ourNumber:
          description: >-
            Bank-side identification of the boleto (nosso numero), as assigned
            by the provider, with leading zeros, at the width of the provider
            the boleto was issued at. How it becomes known depends on that
            provider: either it is read from the barcode, in the instrument's
            form, and is absent while the provider has not produced a valid
            barcode; or the provider returns it in its answer to the issuance,
            and it is present while the boleto has no barcode or digitable line
            yet. When the payee supplied ourNumber on issuance, this field still
            reports the provider's value and not the value supplied: if the two
            differ, the value here is the one the provider issued, and the
            divergence is recorded by the service. Optional: absent for boletos
            issued before this field existed, and absent while the provider has
            not made it known. Absence means not yet known; the periodic
            reconciliation fills it in once the provider makes it known, with no
            action needed from the client; it is never sent as an empty string.
          examples:
            - 29
          type: string
        ourNumberDigit:
          description: >-
            Check digit of ourNumber, computed by the bank and never accepted in
            a request. Optional: absent whenever the provider the boleto was
            issued at did not return it, in which case ourNumber is presented
            alone, with no trailing hyphen. It is absent in particular when the
            payee supplied ourNumber: a provider returns the digit only for
            numbers it assigned itself, and some providers never return it. When
            present, the canonical presentation is {ourNumber}-{ourNumberDigit}.
          examples:
            - '3'
          type: string
        providerReason:
          description: >-
            Only on a FAILED installment of a series that its provider refused
            from its own refusal catalog: the stable reason of the rule the
            request broke, which tells apart the rules one code covers (for
            example PAYMENT_DEADLINE_BEFORE_DUE with PBP-0832). That
            installment's BOLETO_FAILED carries the code as errorCode and this
            reason as providerReason. Absent on every other boleto, a single
            boleto included: the emission request is answered with its refusal.
          examples:
            - PAYMENT_DEADLINE_BEFORE_DUE
          pattern: ^[A-Z][A-Z0-9_]{0,63}$
          type: string
        status:
          description: >-
            Status of the installment's boleto, the same GET /v1/boletos/{id}
            answers. REVERSED: the payment was returned to the payer; the boleto
            will not be paid.
          enum:
            - PENDING
            - CREATED
            - SETTLED
            - CANCELED
            - INACTIVATED
            - FAILED
            - REVERSED
          type: string
      required:
        - id
        - installmentNumber
        - installmentLabel
        - amount
        - dueDate
        - status
      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: 'Never returned: the service drops the rejected value.'
      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
    AddressRequest:
      additionalProperties: false
      properties:
        city:
          type: string
        complement:
          type: string
        neighborhood:
          type: string
        number:
          type: string
        state:
          type: string
        street:
          type: string
        zipCode:
          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.