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

# List payments

> <Warning>**Under development.** This Payments PCR preview is subject to change. Endpoint descriptions distinguish current behavior from planned changes. Confirm availability with Lerian before integration.</Warning>

Lists the payments of an organization, with pagination and optional filters.

<Info>**Providers:** BTG.</Info>

**How it works**

- `X-Organization-Id` is required. Only payments of that organization are listed and counted.
- Filter by `status`, `type`, creation date (`from`, `to`) and due date (`dueDateFrom`, `dueDateTo`). All bounds are inclusive.
- `status=UNCONFIRMED` selects payments whose outcome at the provider is not known yet, such as one answered `202`.
- `from` and `to` take a date (`YYYY-MM-DD`, a UTC day) or an RFC 3339 date-time with offset. Percent-encode a positive offset (`%2B`).
- Due-date bounds match only `DARF` and `BANKSLIP` payments. `UTILITIES` payments have no due date.
- `idempotencyKey` lists the payment that key created in this organization, if any. Use it to recover what a creation answered when you have no payment id, for example after a `5xx`. It is not for polling.
- A key whose creation was refused before anything was created lists nothing. An empty value is ignored.

**Planned changes**

- Lerian (PCR): boleto payment through Lerian (PCR) is planned. The `status` filter accepts `RETURNED` (the amount went back to the funding account after the issuing institution returned it). Items carry the new payment members `antifraud`, `requestedAmount` and `return`.
- Payment scheduling: a future `scheduledDate` is sent to the provider on its effective date (first business day on or after it), once. Adds `scheduledDate` (DARF too), `effectiveScheduledDate`, `effectiveAfterDueDate`, `amountIsEstimated`, `executedAt`, `failureReason`, the `PROCESSING` status and new error codes. This change will be specified again before it applies. The list gains the filters `effectiveScheduledDateFrom` and `effectiveScheduledDateTo` (the date the payment occurs, not the requested or creation date).
- `payee.taxId` (the CPF or CNPJ of the slip's beneficiary) will be masked, as the consult already masks it. Today it is returned in full, even on `FAILED` or `REJECTED` payments.



## OpenAPI

````yaml /es/openapi/v3-current/payments-pcr.yaml get /v1/payments
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/payments:
    get:
      tags:
        - Payments
      summary: List payments
      description: >-
        <Warning>**Under development.** This Payments PCR preview is subject to
        change. Endpoint descriptions distinguish current behavior from planned
        changes. Confirm availability with Lerian before integration.</Warning>


        Lists the payments of an organization, with pagination and optional
        filters.


        <Info>**Providers:** BTG.</Info>


        **How it works**


        - `X-Organization-Id` is required. Only payments of that organization
        are listed and counted.

        - Filter by `status`, `type`, creation date (`from`, `to`) and due date
        (`dueDateFrom`, `dueDateTo`). All bounds are inclusive.

        - `status=UNCONFIRMED` selects payments whose outcome at the provider is
        not known yet, such as one answered `202`.

        - `from` and `to` take a date (`YYYY-MM-DD`, a UTC day) or an RFC 3339
        date-time with offset. Percent-encode a positive offset (`%2B`).

        - Due-date bounds match only `DARF` and `BANKSLIP` payments. `UTILITIES`
        payments have no due date.

        - `idempotencyKey` lists the payment that key created in this
        organization, if any. Use it to recover what a creation answered when
        you have no payment id, for example after a `5xx`. It is not for
        polling.

        - A key whose creation was refused before anything was created lists
        nothing. An empty value is ignored.


        **Planned changes**


        - Lerian (PCR): boleto payment through Lerian (PCR) is planned. The
        `status` filter accepts `RETURNED` (the amount went back to the funding
        account after the issuing institution returned it). Items carry the new
        payment members `antifraud`, `requestedAmount` and `return`.

        - Payment scheduling: a future `scheduledDate` is sent to the provider
        on its effective date (first business day on or after it), once. Adds
        `scheduledDate` (DARF too), `effectiveScheduledDate`,
        `effectiveAfterDueDate`, `amountIsEstimated`, `executedAt`,
        `failureReason`, the `PROCESSING` status and new error codes. This
        change will be specified again before it applies. The list gains the
        filters `effectiveScheduledDateFrom` and `effectiveScheduledDateTo` (the
        date the payment occurs, not the requested or creation date).

        - `payee.taxId` (the CPF or CNPJ of the slip's beneficiary) will be
        masked, as the consult already masks it. Today it is returned in full,
        even on `FAILED` or `REJECTED` payments.
      operationId: listPayments
      parameters:
        - description: >-
            Midaz organization whose payments are listed. Required: a request
            without it, or with a value that is not a canonical UUID, is refused
            with 400 PBP-0025. Only payments of this organization are listed and
            counted.
          in: header
          name: X-Organization-Id
          schema:
            description: >-
              Midaz organization whose payments are listed. Required: a request
              without it, or with a value that is not a canonical UUID, is
              refused with 400 PBP-0025. Only payments of this organization are
              listed and counted.
            type: string
        - description: >-
            Status filter. UNCONFIRMED selects the payments whose outcome at the
            payment provider is not known yet: an initiation answered 202 leaves
            its payment there until it resolves.


            Planned: accepts RETURNED, the payments whose amount went back to
            the funding account after the issuing institution returned it.
          explode: false
          in: query
          name: status
          schema:
            description: >-
              Status filter. UNCONFIRMED selects the payments whose outcome at
              the payment provider is not known yet: an initiation answered 202
              leaves its payment there until it resolves.
            enum:
              - UNCONFIRMED
              - CREATED
              - SCHEDULED
              - PENDING_APPROVAL
              - APPROVED
              - EXECUTED
              - SETTLED
              - REJECTED
              - FAILED
              - CANCELED
            examples:
              - CREATED
            type: string
          x-mint:
            post:
              - Under development
        - description: Payment type filter.
          explode: false
          in: query
          name: type
          schema:
            description: Payment type filter.
            enum:
              - BANKSLIP
              - UTILITIES
              - DARF
            examples:
              - BANKSLIP
            type: string
        - description: >-
            Created-from bound, inclusive. A calendar date (YYYY-MM-DD) is a UTC
            day and starts at its first instant; an RFC 3339 date-time with
            offset (e.g. 2026-09-30T00:00:00-03:00) is used as the exact
            instant. A positive offset must be percent-encoded (%2B).
          explode: false
          in: query
          name: from
          schema:
            description: >-
              Created-from bound, inclusive. A calendar date (YYYY-MM-DD) is a
              UTC day and starts at its first instant; an RFC 3339 date-time
              with offset (e.g. 2026-09-30T00:00:00-03:00) is used as the exact
              instant. A positive offset must be percent-encoded (%2B).
            examples:
              - '2026-01-01'
            pattern: >-
              ^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?(Z|[+-][0-9]{2}:[0-9]{2}))?$
            type: string
            x-pattern-description: a YYYY-MM-DD date or an RFC 3339 date-time with offset
        - description: >-
            Created-to bound, inclusive. A calendar date (YYYY-MM-DD) is a UTC
            day and covers it to its last instant; an RFC 3339 date-time with
            offset (e.g. 2026-09-30T23:59:59.999999-03:00) is used as the exact
            instant. A positive offset must be percent-encoded (%2B).
          explode: false
          in: query
          name: to
          schema:
            description: >-
              Created-to bound, inclusive. A calendar date (YYYY-MM-DD) is a UTC
              day and covers it to its last instant; an RFC 3339 date-time with
              offset (e.g. 2026-09-30T23:59:59.999999-03:00) is used as the
              exact instant. A positive offset must be percent-encoded (%2B).
            examples:
              - '2026-12-31'
            pattern: >-
              ^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?(Z|[+-][0-9]{2}:[0-9]{2}))?$
            type: string
            x-pattern-description: a YYYY-MM-DD date or an RFC 3339 date-time with offset
        - description: >-
            Due-date lower bound, inclusive. It matches the DARF and BANKSLIP
            payments that carry a due date (see dueDate on the payment).
            UTILITIES payments carry none, so this bound matches none of them.
          explode: false
          in: query
          name: dueDateFrom
          schema:
            description: >-
              Due-date lower bound, inclusive. It matches the DARF and BANKSLIP
              payments that carry a due date (see dueDate on the payment).
              UTILITIES payments carry none, so this bound matches none of them.
            examples:
              - '2026-02-01'
            format: date
            type: string
        - description: >-
            Due-date upper bound, inclusive. It matches the DARF and BANKSLIP
            payments that carry a due date (see dueDate on the payment).
            UTILITIES payments carry none, so this bound matches none of them.
          explode: false
          in: query
          name: dueDateTo
          schema:
            description: >-
              Due-date upper bound, inclusive. It matches the DARF and BANKSLIP
              payments that carry a due date (see dueDate on the payment).
              UTILITIES payments carry none, so this bound matches none of them.
            examples:
              - '2026-11-30'
            format: date
            type: string
        - description: Page number, one-based.
          explode: false
          in: query
          name: page
          schema:
            default: 1
            description: Page number, one-based.
            examples:
              - 1
            format: int64
            minimum: 1
            type: integer
        - description: Items per page.
          explode: false
          in: query
          name: limit
          schema:
            default: 20
            description: Items per page.
            examples:
              - 20
            format: int64
            maximum: 100
            minimum: 1
            type: integer
        - description: >-
            The Idempotency-Key a payment was created under, on POST
            /v1/payments or POST /v1/payments/darf. Lists the payment that key
            created in this organization, if any: the way to find what a
            creation answered without a payment id left behind, a 5xx above all.
            A key whose creation was refused before anything was created lists
            nothing. A payment retried under the same key after a refusal for
            funds is listed with the refused attempt. Combines with the other
            filters. A value that is not a UUID is refused with 400 PBP-0001; an
            empty value is ignored, as on the other filters. Meant for
            recovering one request, not for polling.
          explode: false
          in: query
          name: idempotencyKey
          schema:
            description: >-
              The Idempotency-Key a payment was created under, on POST
              /v1/payments or POST /v1/payments/darf. Lists the payment that key
              created in this organization, if any: the way to find what a
              creation answered without a payment id left behind, a 5xx above
              all. A key whose creation was refused before anything was created
              lists nothing. A payment retried under the same key after a
              refusal for funds is listed with the refused attempt. Combines
              with the other filters. A value that is not a UUID is refused with
              400 PBP-0001; an empty value is ignored, as on the other filters.
              Meant for recovering one request, not for polling.
            examples:
              - 6f9619ff-8b86-d011-b42d-00c04fc964ff
            type: string
        - name: effectiveScheduledDateFrom
          in: query
          explode: false
          description: >-
            Planned. Effective date of the scheduled payment, lower bound,
            inclusive. Filters by the date the payment runs or ran, not by the
            requested date (`scheduledDate`), the creation date (`from`) or the
            title due date (`dueDateFrom`). Immediate payments are not returned
            by this filter.
          schema:
            type: string
            format: date
            description: Effective scheduled-date lower bound, inclusive.
            examples:
              - '2026-09-14'
          x-mint:
            post:
              - Under development
        - name: effectiveScheduledDateTo
          in: query
          explode: false
          description: >-
            Planned. Effective date of the scheduled payment, upper bound,
            inclusive. Independent of `effectiveScheduledDateFrom`: sending only
            one side leaves the other side open.
          schema:
            type: string
            format: date
            description: Effective scheduled-date upper bound, inclusive.
            examples:
              - '2026-09-18'
          x-mint:
            post:
              - Under development
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPaymentsResponse'
          description: OK.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                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
                      canonical UUID
                    code: PBP-0025
                PBP-0001:
                  summary: 'PBP-0001: Request malformed'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0001
                    title: Bad Request
                    status: 400
                    detail: validation failed
                    code: PBP-0001
          description: >-
            Bad Request.


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

            - `PBP-0001`: a filter is malformed, for example `idempotencyKey` is
            not a UUID, or a date bound is not a date or an RFC 3339 date-time
            with offset.


            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.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity.
        '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.

            - `PBP-0002`: an unexpected failure. Contact support.
        '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
          description: >-
            Service Unavailable.


            - `PBP-0008`: a dependency (authentication or storage) is
            unavailable. Nothing was processed. Retry.
      security:
        - BearerAuth: []
components:
  schemas:
    ListPaymentsResponse:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/GetPaymentResponse'
          type:
            - array
            - 'null'
        limit:
          format: int64
          type: integer
        page:
          format: int64
          type: integer
        total:
          format: int64
          type: integer
      required:
        - items
        - page
        - limit
        - total
      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
    GetPaymentResponse:
      additionalProperties: false
      properties:
        amount:
          type: string
        canceledAt:
          type: string
        cancellationReason:
          type: string
        createdAt:
          type: string
        darf:
          $ref: '#/components/schemas/DARFResponse'
        description:
          type: string
        digitableLine:
          type: string
        dueDate:
          description: >-
            Due date, YYYY-MM-DD. A DARF payment carries the one its creation
            request named, if any. A BANKSLIP payment carries the slip's due
            date as the payment provider's pre-payment consult reported it:
            absent when the consult reported none, and on bank-slip payments
            created before the due date was recorded. UTILITIES payments do not
            carry it.
          type: string
        errorMessage:
          type: string
        failedAt:
          type: string
        failureCode:
          description: >-
            The product error code a FAILED payment was recorded with, when its
            failure has one. PBP-0211: the payment provider provably never
            received the payment, nothing was paid, and its reservation is
            cancelled. PBP-0212: the payment provider refused the payment
            because it arrived outside the hours it accepts payments, nothing
            was paid, and its reservation is cancelled. PBP-0014: the payment
            provider refused what it was sent. Absent on every other status, and
            on a failure recorded without a code. Treat the list as open.
          examples:
            - PBP-0211
          type: string
        id:
          type: string
        ledgerId:
          description: Midaz ledger the payment was written with. Always present.
          type: string
        midazAccountId:
          description: >-
            Midaz account the payment is debited from: the midazAccountId the
            payment was created with. Always present.
          type: string
        midazOperationId:
          type: string
        organizationId:
          description: >-
            Midaz organization the payment was written with. Always present, and
            always the organization of the X-Organization-Id header.
          type: string
        payee:
          $ref: '#/components/schemas/PayeeResponse'
        providerId:
          description: >-
            Identifier the payment provider assigned to this payment. Quote it,
            together with providerRequestId, when you contact the provider about
            this payment. Absent while the payment is UNCONFIRMED, and on a
            payment that failed before the provider acknowledged it.
          type: string
        providerRequestId:
          description: >-
            Reference this API sends to the payment provider when it instructs
            this payment, exactly as sent. Which of providerId and
            providerRequestId the provider accepts for a lookup depends on the
            provider and on the payment type, so quote both when you contact the
            provider. It is recorded when the payment is created, before the
            instruction, so it is present on a payment the provider never
            received too: one FAILED with failureCode PBP-0211, or FAILED
            without a code after the ledger refused its funds. The provider
            holds no payment under it then, and a payment retried under the same
            Idempotency-Key after a refusal for funds carries the same reference
            as the refused attempt. Absent when the payment carries no such
            reference.
          type: string
        rejectedAt:
          type: string
        rejectionReason:
          type: string
        settledAmount:
          type: string
        settledAt:
          type: string
        status:
          description: >-
            The payment's current status: UNCONFIRMED, CREATED, SCHEDULED,
            PENDING_APPROVAL, APPROVED, EXECUTED, SETTLED, REJECTED, FAILED or
            CANCELED. UNCONFIRMED means the outcome at the payment provider is
            not known yet: every payment starts there, and one whose initiation
            was answered 202 stays there until it resolves. Treat the list as
            open: a value added later must not break a client.


            Planned: status gains RETURNED, reached only by the Lerian-provider
            payment flow; PENDING_APPROVAL also means the payment waits for the
            antifraud partner's final decision.
          type: string
        type:
          type: string
        updatedAt:
          type: string
        requestedAmount:
          description: >-
            The `amount` the creation request named, when it named one. `amount`
            is the amount reserved and paid, which for such a payment equals it.
            Absent when the request named none.
          examples:
            - '100.00'
          type: string
          x-mint:
            post:
              - Under development
        antifraud:
          $ref: '#/components/schemas/PaymentAntifraudAnalysis'
          x-mint:
            post:
              - Under development
        return:
          $ref: '#/components/schemas/PaymentReturn'
          x-mint:
            post:
              - Under development
        scheduledDate:
          $ref: '#/components/schemas/RequestedScheduledDate'
          x-mint:
            post:
              - Under development
        effectiveScheduledDate:
          $ref: '#/components/schemas/EffectiveScheduledDate'
          x-mint:
            post:
              - Under development
        effectiveAfterDueDate:
          $ref: '#/components/schemas/EffectiveAfterDueDate'
          x-mint:
            post:
              - Under development
        executedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Planned. Instant the scheduled payment was executed on its day, when
            the provider accepted the payment call. Null until the execution
            happens, and stays null for a scheduled payment canceled or failed
            before it reached the provider.


            - There is no separate scheduling instant: a scheduled payment is
            created in `SCHEDULED`, so `createdAt` is that instant.

            - Do not confuse with `effectiveScheduledDate`: `executedAt` is when
            it ran, `effectiveScheduledDate` is when it was due to run.
          examples:
            - '2026-09-14T06:00:47Z'
          x-mint:
            post:
              - Under development
        failureReason:
          $ref: '#/components/schemas/ScheduleFailureReason'
          x-mint:
            post:
              - Under development
      required:
        - id
        - organizationId
        - ledgerId
        - midazAccountId
        - type
        - status
        - amount
        - createdAt
        - updatedAt
      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
    DARFResponse:
      additionalProperties: false
      properties:
        fineAmount:
          type: string
        interestAmount:
          type: string
        mainAmount:
          type: string
        name:
          type: string
        personType:
          type: string
        referenceDate:
          type: string
        taxId:
          type: string
        treasuryRevenueCode:
          type: string
        type:
          type: string
      required:
        - personType
        - taxId
        - name
        - referenceDate
        - treasuryRevenueCode
        - type
        - mainAmount
        - interestAmount
        - fineAmount
      type: object
    PayeeResponse:
      additionalProperties: false
      properties:
        name:
          type: string
        taxId:
          type: string
      type: object
    PaymentAntifraudAnalysis:
      type: object
      additionalProperties: false
      description: >-
        Antifraud analysis of the payment. Present on every payment the client's
        antifraud partner evaluated (ALLOW or REVIEW), also after the final
        decision, as its audit record. Absent when the tenant has the check off
        and on payments created before the antifraud check existed. The
        partner's reasons and score are recorded but not exposed.
      required:
        - decision
        - origin
        - evaluatedAt
      properties:
        analysisId:
          type: string
          maxLength: 64
          description: >-
            Partner's identifier of the analysis, to quote to whoever operates
            it. Always present on REVIEW.
          examples:
            - an-7f3c2a91
        decision:
          type: string
          enum:
            - ALLOW
            - REVIEW
          description: Decision at initiation. DENY creates no payment.
        origin:
          type: string
          enum:
            - PROVIDER
            - FALLBACK
          description: >-
            PROVIDER: the partner answered. FALLBACK: the route's open posture
            released it.
        evaluatedAt:
          type: string
          format: date-time
          examples:
            - '2026-11-16T14:03:12Z'
        reviewExpiresAt:
          type: string
          format: date-time
          description: >-
            REVIEW only: end of the tenant's review window, after which the
            payment ends REJECTED with ANTIFRAUD_REVIEW_EXPIRED.
          examples:
            - '2026-11-16T14:33:12Z'
        finalDecision:
          type: string
          enum:
            - ALLOW
            - DENY
            - EXPIRED
          description: >-
            REVIEW only: final decision of the partner, or EXPIRED. Absent while
            open.
        decidedAt:
          type: string
          format: date-time
          description: >-
            When the final decision or the expiry was recorded. Absent while
            open.
    PaymentReturn:
      additionalProperties: false
      description: >-
        Return of a settled payment after the issuing institution cancelled the
        write-off. While `state` is PENDING the payment is still SETTLED and the
        amount goes back at `scheduledFor`: 08:20 (America/Sao_Paulo), the first
        SILOC settlement of the business day after the notice. At that moment
        the amount is credited back to the funding account, the payment becomes
        RETURNED, `state` becomes POSTED and PAYMENT_RETURNED is sent. Only
        Lerian-provider payments carry it.
      properties:
        state:
          description: >-
            PENDING: return notified, amount not yet back. POSTED: amount sent
            back to the funding account; the payment is RETURNED.
          enum:
            - PENDING
            - POSTED
          type: string
        reason:
          description: Reason the issuing institution gave for cancelling the write-off.
          examples:
            - Cancelamento pela instituicao destinataria
          maxLength: 500
          type: string
        amount:
          type: string
          pattern: ^(0|[1-9][0-9]{0,15})\.[0-9]{2}$
          maxLength: 19
          description: 'Amount returned to the funding account: the settled amount.'
          examples:
            - '100.00'
        noticedAt:
          description: When the cancellation by the issuing institution was notified.
          examples:
            - '2026-11-16T18:40:00Z'
          format: date-time
          type: string
        scheduledFor:
          description: When the amount goes back to the funding account.
          examples:
            - '2026-11-17T11:20:00Z'
          format: date-time
          type: string
        returnedAt:
          description: When the return was posted. Absent while PENDING.
          examples:
            - '2026-11-17T11:20:04Z'
          format: date-time
          type: string
      required:
        - state
        - reason
        - amount
        - noticedAt
        - scheduledFor
      type: object
    RequestedScheduledDate:
      type: string
      format: date
      description: >-
        Planned. Date on which you want the payment to run, `YYYY-MM-DD`, with
        no time or time zone. Without it, the payment runs immediately.


        - It is not the date the payment runs. On a non-business day the payment
        runs on `effectiveScheduledDate`: always read that field.

        - Valid window: `tomorrow ≤ scheduledDate ≤ min(dueDate, today + 30
        calendar days)`. Outside it, creation is refused with one of the window
        codes.

        - In the first phase, a date on a non-business day is refused with
        `PBP-0006`.
      examples:
        - '2026-09-16'
    EffectiveScheduledDate:
      type: string
      format: date
      description: >-
        Planned. Business day on which the payment runs, `YYYY-MM-DD`. Read this
        date to know when the money goes out.


        - Computed at acceptance as the first business day on or after
        `scheduledDate`. Equal to it when the requested date is a business day.

        - Fixed at acceptance: a later calendar change does not move it.

        - Only one thing moves it: when the provider refuses the execution for
        cutoff or time window, the payment is rescheduled to the next business
        day, up to the attempt limit. A rescheduled payment leaves the
        `effectiveScheduledDateFrom`/`effectiveScheduledDateTo` interval it was
        in and enters the next one.

        - Present only in scheduled payments. Absent in an immediate payment.
      examples:
        - '2026-09-14'
    EffectiveAfterDueDate:
      type: boolean
      description: >-
        Planned. `true` when the effective date rolled past the title's due
        date; `false` otherwise, including in an immediate payment.


        - The window is checked on the requested date (`tomorrow ≤ scheduledDate
        ≤ min(dueDate, today + 30 days)`). The roll to the next business day
        happens after that check, so it can pass the due date: a boleto due on a
        Saturday, scheduled for that day, runs on Monday.

        - This case is accepted, not refused, and has no error code. Use the
        field to warn whoever scheduled the payment.

        - If the title does not accept payment on the next business day without
        a change in value, the amount can rise. See `amountIsEstimated`.

        - In the first phase there is no roll: a requested date on a
        non-business day is refused with `PBP-0006`, so the field is always
        `false`.
      examples:
        - false
    ScheduleFailureReason:
      type: string
      description: >-
        Planned. Why the execution of a scheduled payment failed terminally.
        Present only when `status` is `FAILED` and the payment was scheduled. An
        immediate payment that fails is described only by `errorMessage`.


        | Value | What happened |

        |---|---|

        | `INSUFFICIENT_FUNDS` | Insufficient balance on the effective date.
        Unlikely, because funds are reserved at creation; it happens if the
        reservation was undone outside Payments |

        | `BILL_NO_LONGER_PAYABLE` | The title stopped being payable between
        acceptance and the effective date |

        | `PROVIDER_REJECTED` | The provider refused the instruction by its own
        rule |

        | `PROVIDER_UNAVAILABLE` | The provider was unavailable up to the
        attempt limit |

        | `RETRY_LIMIT_EXCEEDED` | Refused for cutoff or time window and
        rescheduled up to the limit of business days, without success. Each
        attempt is one business day |

        | `MALFORMED_RECORD` | The record could not be processed because of a
        data defect |

        | `LEDGER_CONTEXT_MISSING` | The payment's organization or ledger is
        missing at execution, so it does not run |

        | `CUTOFF_WINDOW_MISSED` | The only non-terminal value: refused for
        cutoff or time window and rescheduled to the next business day. You only
        see it if the payment later fails, and then the value is usually
        `RETRY_LIMIT_EXCEEDED` |


        - In every terminal case the reservation in the ledger is released.

        - `status` decides whether the payment ended, never this field. The
        field is not returned outside `FAILED`.
      enum:
        - INSUFFICIENT_FUNDS
        - BILL_NO_LONGER_PAYABLE
        - PROVIDER_REJECTED
        - PROVIDER_UNAVAILABLE
        - RETRY_LIMIT_EXCEEDED
        - MALFORMED_RECORD
        - LEDGER_CONTEXT_MISSING
        - CUTOFF_WINDOW_MISSED
      examples:
        - RETRY_LIMIT_EXCEEDED
  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.