openapi: 3.1.0
info:
  contact:
    name: Lerian Studio
    url: https://lerian.studio
  description: Public API for outbound Pix transfers, refunds, and scheduled payments.
  license:
    name: Lerian Studio General License
  title: Pix Lerian — Payments
  version: 1.6.0
servers:
  - url: https://api.example.com/spi/v1
    description: Replace the example host with the URL provided during environment onboarding.
security:
  - BearerAuth: []
tags:
  - description: Create, list, and retrieve Pix refunds.
    name: Refunds
  - name: Scheduled Payments
    description: Register, list, retrieve, and cancel scheduled Pix payments.
  - description: Initiate, process, list, and retrieve outbound Pix transfers, and cancel or decide a sent Pix held in fraud analysis.
    name: Transfers
  - description: Register, list, retrieve, and cancel recurring series of scheduled Pix payments.
    name: Scheduled Payment Recurrences
  - description: Hold the funds of a received Pix in a MED balance lock (MED 2.0), list MED balance locks and cautelar blocks, return the funds to the payer, or give them back to the account holder.
    name: Balance Locks
  - description: "Read the APIX001 report of a closed month."
    name: APIX001 Reports
  - description: "Close a reference month into an immutable report, and reopen it."
    name: APIX001 Periods
  - description: "Record and correct the facts that only the participant knows, for the APIX001 report."
    name: APIX Client Facts
  - description: "Declare the indirect participants that the tenant settles for, and end the declarations."
    name: APIX Settled Participants
paths:
  /refunds:
    get:
      description: Returns a cursor-paginated page of refunds for the calling account.
      operationId: listRefunds
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/list-refunds
      parameters:
        - description: Account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Filter by original transfer UUID
          explode: false
          in: query
          name: transferId
          schema:
            description: Filter by original transfer UUID
            type: string
        - description: Filter by refund status (lowercase)
          explode: false
          in: query
          name: status
          schema:
            description: Filter by refund status (lowercase)
            examples:
              - completed
            type: string
        - description: Filter by direction (lowercase)
          explode: false
          in: query
          name: direction
          schema:
            description: Filter by direction (lowercase)
            examples:
              - out
            type: string
        - description: Opaque cursor returned by the previous page
          explode: false
          in: query
          name: after
          schema:
            description: Opaque cursor returned by the previous page
            type: string
        - description: Page size (1-100, default 20)
          explode: false
          in: query
          name: limit
          schema:
            description: Page size (1-100, default 20)
            examples:
              - '20'
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundsListOutput'
          description: OK
        '400':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0403
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for refund.
                code: PIX-0403
              schema:
                $ref: '#/components/schemas/Detail'
            application/json:
              example:
                code: PIX-0001
                title: Missing Headers in Request
                message: Your request is missing one or more required header params.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: Missing, duplicated, or malformed X-Account-Id, or invalid transferId, status, direction, cursor, or limit filter input (PIX-0001, PIX-0017, PIX-0020, PIX-0403). Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: List Pix refunds for an account
      tags:
        - Refunds
  /refunds/{id}:
    get:
      description: Returns a single refund scoped to the calling account.
      operationId: getRefund
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-refund
      parameters:
        - description: Account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Refund UUID
          in: path
          name: id
          required: true
          schema:
            description: Refund UUID
            examples:
              - 0196080a-1234-7890-abcd-ef0123456789
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundCashoutOutput'
          description: OK
        '400':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0403
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for refund.
                code: PIX-0403
              schema:
                $ref: '#/components/schemas/Detail'
            application/json:
              example:
                code: PIX-0001
                title: Missing Headers in Request
                message: Your request is missing one or more required header params.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: Missing, duplicated, or malformed X-Account-Id or refund UUID (PIX-0001, PIX-0015, PIX-0017, PIX-0403). Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '404':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0420
                title: Not Found
                status: 404
                detail: Refund ID does not exist for this organization.
                code: PIX-0420
              schema:
                $ref: '#/components/schemas/Detail'
          description: No refund exists for the supplied UUID in the calling account scope (PIX-0420).
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Get a Pix refund by ID
      tags:
        - Refunds
  /refunds/{id}/unblock:
    post:
      description: |-
        Resolves ONE outbound refund that is stuck in `PROCESSING`. Pix Lerian asks the SPI for the outcome of the refund and applies it. The request has no field to state what happened.

        The refund must have been in `PROCESSING` for at least 90 minutes. If the SPI reports the refund as completed, the refund becomes `COMPLETED`. If the SPI reports it as rejected or failed, the refund becomes `FAILED` and Pix Lerian reverses the debit. If the SPI has no final outcome yet, the call is refused with `PIX-0556`: retry later. If Pix Lerian cannot get the status from the SPI, the call answers `502` (`PIX-0557`) and Pix Lerian changes nothing.

        A refund that is already in a final status is refused with `PIX-0554`. A refund in any other status is refused with `PIX-0551`.

        The caller needs the `refund-recovery` permission with the post action. It is tenant level, and only the editor role holds it. In BYOC, only the SPI permission declaration grants it: create the SPI M2M credential in Access Manager, then set `IDP_DECLARATION_ENABLED` to `true`.

        The response is the refund as [Get refund](/es/reference/interfaces/pix-lerian/spi/get-refund) returns it.
      operationId: unblockRefund
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/unblock-refund
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a different URL, X-Account-Id, X-Actor-Id, X-Override-Reason or X-Override-Ticket is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Refund UUID
          in: path
          name: id
          required: true
          schema:
            description: Refund UUID
            examples:
              - 0196080a-1234-7890-abcd-ef0123456789
            type: string
        - description: Source account UUID. A refund that exists under a different account is answered 404.
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Source account UUID. A refund that exists under a different account is answered 404.
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Optional. Identifies the person in your back office who asked for the check. Pix Lerian does not use it to decide the outcome.
          in: header
          name: X-Actor-Id
          schema:
            maxLength: 255
            description: Optional. Identifies the person in your back office who asked for the check. Pix Lerian does not use it to decide the outcome.
            examples:
              - ops-maria
            type: string
        - description: Optional. Reason for the check. Pix Lerian does not use it to decide the outcome.
          in: header
          name: X-Override-Reason
          schema:
            maxLength: 512
            description: Optional. Reason for the check. Pix Lerian does not use it to decide the outcome.
            examples:
              - outcome never arrived
            type: string
        - description: Optional. Ticket reference in your own back office. Pix Lerian does not use it to decide the outcome.
          in: header
          name: X-Override-Ticket
          schema:
            maxLength: 255
            description: Optional. Ticket reference in your own back office. Pix Lerian does not use it to decide the outcome.
            examples:
              - OPS-4711
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundCashoutOutput'
          description: OK
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "Two shapes share this status, one per media type. application/problem+json: X-Account-Id or the refund UUID is missing or malformed (PIX-0001, PIX-0015, PIX-0017), or an attribution header exceeds its maximum length (PIX-0403). application/json is the legacy {code,title,message} envelope, from the idempotency gate: X-Idempotency absent or longer than 64 bytes (PIX-0030)."
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: No outbound refund exists for the supplied UUID in the calling account scope (PIX-0420).
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "The refund cannot be unblocked now. PIX-0554: it is already in a final status. PIX-0555: it has been in PROCESSING for less than 90 minutes, so retry later. PIX-0551: it is not in PROCESSING. PIX-0556: the SPI has no final outcome yet, so retry later. PIX-0406: the refund changed during the request, so read it again and retry."
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'The first request under this X-Idempotency is still running (with Retry-After: 1), or the key was replayed with a divergent request -- a different URL (including the path parameter), X-Account-Id, X-Actor-Id, X-Override-Reason or X-Override-Ticket (PIX-0031). Legacy {code,title,message} envelope, NOT problem+json.'
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        '502':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "The call could not conclude. PIX-0557: Pix Lerian could not get the status from the SPI, and it changed nothing. PIX-0553: the debit reversal did not complete."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Unblock a Pix refund stuck in PROCESSING
      tags:
        - Refunds
  /scheduled-payment-limit-impact:
    get:
      description: 'The totals route seen from the other side: given a proposed limit, returns the future schedules that would exceed it, so the institution can see the consequence BEFORE concluding a reduction. This route reads -- it does not apply the reduction and does not judge it. Each item carries its date''s total, so a caller can see why a small schedule is affected rather than only that it is. Nothing affected is an empty page, never null.'
      operationId: getScheduledPaymentLimitImpact
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-scheduled-payment-limit-impact
      parameters:
        - description: Payer account.
          explode: false
          in: query
          name: account_id
          schema:
            description: Payer account.
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: The limit being considered. This route reports what it would break; it does NOT apply the reduction.
          explode: false
          in: query
          name: proposed_limit
          schema:
            description: The limit being considered. This route reports what it would break; it does NOT apply the reduction.
            examples:
              - '1000.00'
            type: string
        - description: Earliest settlement date to consider, inclusive.
          explode: false
          in: query
          name: start_date
          schema:
            description: Earliest settlement date to consider, inclusive.
            format: date
            type: string
        - description: Latest settlement date to consider, inclusive.
          explode: false
          in: query
          name: end_date
          schema:
            description: Latest settlement date to consider, inclusive.
            format: date
            type: string
        - description: Page size, 1..100. Absent or 0 means 20. A negative value or one above 100 is REFUSED, never clamped -- the same rule the sibling list route follows.
          explode: false
          in: query
          name: limit
          schema:
            description: Page size, 1..100. Absent or 0 means 20. A negative value or one above 100 is REFUSED, never clamped -- the same rule the sibling list route follows.
            format: int64
            type: integer
            maximum: 100
            minimum: 0
        - description: Opaque cursor from a previous page.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from a previous page.
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LimitImpactPageView'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "A query parameter cannot be used. PIX-0020: account_id absent or not a UUID, proposed_limit absent or not a non-negative decimal amount with exactly two places, start_date or end_date not a civil date in AAAA-MM-DD, or limit negative or above 100 (0, like an absent limit, means the default page size of 20) -- the response names each offending parameter. PIX-0003: end_date is earlier than start_date, and the response names end_date. An inverted range is refused rather than answered with an empty page, which a caller could not tell from 'nothing is affected'. PIX-0003 also answers a start_date or end_date in AAAA-MM-DD that is not a usable civil date (year 0000), and names that parameter. PIX-0789: the cursor is not one this service issued, or it was truncated. Zero IS a valid proposed limit and a meaningful question -- it asks what a total freeze would break."
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                limitNotInteger:
                  summary: Framework binding refusal of a non-integer limit -- no PIX code
                  value:
                    title: Unprocessable Entity
                    status: 422
                    detail: validation failed
                    errors:
                      - message: invalid integer
                        location: query.limit
                        value: abc
          description: "`limit` is not an integer. The body carries no PIX-NNNN code and names the parameter in `errors`."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Schedules a proposed limit would make unviable
      tags:
        - Scheduled Payments
  /scheduled-payment-totals:
    get:
      description: 'THIS ROUTE AND ITS SIBLING ARE THE WHOLE OF WHAT THE SWITCH DOES ABOUT DAILY PIX LIMITS. The policy belongs to the client institution, which holds the ISPB and answers to BACEN for it; the Switch does not accumulate, project or decide. It returns the figure the decision needs. The total sums every NON-TERMINAL schedule for that account on that date -- cancelled and failed ones are excluded, because neither will move money. Supplying night_period_start adds the IN 512 art. 7 §7 slice, which is a DIFFERENT rule from the general night period of art. 3: created inside the window, settling the next day, to a natural person distinct from the payer. Omit the parameter and the slice is omitted rather than defaulted.'
      operationId: getScheduledPaymentTotals
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-scheduled-payment-totals
      parameters:
        - description: 'Payer account. Required: the total is per account, and an unscoped one would be meaningless.'
          explode: false
          in: query
          name: account_id
          schema:
            description: 'Payer account. Required: the total is per account, and an unscoped one would be meaningless.'
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Civil date the total is computed for, in America/Sao_Paulo.
          explode: false
          in: query
          name: scheduled_date
          schema:
            description: Civil date the total is computed for, in America/Sao_Paulo.
            examples:
              - '2026-09-10'
            format: date
            type: string
        - description: 'Local time the night period opens, HH:MM in America/Sao_Paulo. Absent means the night slice is OMITTED rather than defaulted: where that window opens is the institution''s setting (IN 512 art. 3), and inventing one would publish our number under their name.'
          explode: false
          in: query
          name: night_period_start
          schema:
            description: 'Local time the night period opens, HH:MM in America/Sao_Paulo. Absent means the night slice is OMITTED rather than defaulted: where that window opens is the institution''s setting (IN 512 art. 3), and inventing one would publish our number under their name.'
            examples:
              - '20:00'
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledTotalsView'
          description: OK
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'night_period_start is not HH:MM on a 24-hour clock (PIX-0787). The night start is validated here rather than passed to storage, where an unparseable value would surface as an internal error for what is a typo.'
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A query parameter is missing or malformed (PIX-0020): account_id absent or not a UUID, or scheduled_date absent or not a civil date in AAAA-MM-DD. The response names each offending parameter. PIX-0003: scheduled_date is in AAAA-MM-DD but is not a usable civil date (year 0000); the response names scheduled_date."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Total scheduled for an account on a date
      tags:
        - Scheduled Payments
  /scheduled-payments:
    get:
      description: "Returns a page of the organization's scheduled payments, newest settlement date first. Paging is by opaque cursor rather than offset: a schedule registered between two pages would shift every later row under an offset and silently skip one. Echo the cursor verbatim. The page carries no attempt history -- that is per-schedule data a list view does not show, and it is on the single-schedule route instead. Filtering by recurrence_id is how the occurrences of a recurring series are enumerated: an occurrence IS a scheduled payment, so it is listed here rather than under a route of its own, which would give the same row two identities."
      operationId: listScheduledPayments
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/list-scheduled-payments
      parameters:
        - description: Page size, 1..100. Absent or 0 means 20. A negative value or one above 100 is REFUSED, never clamped -- a clamped page size makes a caller believe it read everything.
          explode: false
          in: query
          name: limit
          schema:
            description: Page size, 1..100. Absent or 0 means 20. A negative value or one above 100 is REFUSED, never clamped -- a clamped page size makes a caller believe it read everything.
            examples:
              - 20
            format: int64
            type: integer
            maximum: 100
            minimum: 0
        - description: Opaque cursor from a previous page's pagination block. Echo it verbatim -- it is not a document to build.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from a previous page's pagination block. Echo it verbatim -- it is not a document to build.
            type: string
        - description: Narrow to one payer account.
          explode: false
          in: query
          name: account_id
          schema:
            description: Narrow to one payer account.
            type: string
        - description: Narrow to one lifecycle status.
          explode: false
          in: query
          name: status
          schema:
            description: Narrow to one lifecycle status.
            enum:
              - PENDING
              - EXECUTING
              - DISPATCHED_OUTCOME_UNKNOWN
              - AWAITING_RETRY
              - SETTLED
              - CANCELLED
              - FAILED
            type: string
        - description: Earliest settlement date to include, inclusive.
          explode: false
          in: query
          name: start_date
          schema:
            description: Earliest settlement date to include, inclusive.
            examples:
              - '2026-09-01'
            format: date
            type: string
        - description: Latest settlement date to include, inclusive.
          explode: false
          in: query
          name: end_date
          schema:
            description: Latest settlement date to include, inclusive.
            examples:
              - '2026-09-30'
            format: date
            type: string
        - description: "Narrow to the occurrences of ONE recurring series. This is how a series' occurrences are enumerated: an occurrence IS a scheduled payment, so it is listed here rather than under a route of its own, which would give the same row two identities."
          explode: false
          in: query
          name: recurrence_id
          schema:
            description: "Narrow to the occurrences of ONE recurring series. This is how a series' occurrences are enumerated: an occurrence IS a scheduled payment, so it is listed here rather than under a route of its own, which would give the same row two identities."
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPaymentsPage'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "A filter cannot be used. PIX-0020: account_id or recurrence_id is not a UUID, status is not a scheduled-payment status, start_date or end_date is not a civil date in AAAA-MM-DD, or limit is negative or above 100 (0, like an absent limit, means the default page size of 20) -- the response names each offending parameter. PIX-0003: end_date is earlier than start_date; an inverted range is refused rather than answered with an empty page, because the two are indistinguishable to the caller and only one of them is their mistake. PIX-0789: the cursor is not one this service issued, or it was truncated -- restart the listing without a cursor."
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              example:
                title: Unprocessable Entity
                status: 422
                detail: validation failed
                errors:
                  - message: invalid integer
                    location: query.limit
                    value: abc
          description: "`limit` is not an integer. This is the FRAMEWORK's request-binding refusal, not one of this service's: it carries no PIX-NNNN code, names the offending parameter in `errors`, and happens before any filter is looked at. Every other bad value on this operation is the 400 above instead."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: List scheduled Pix payments
      tags:
        - Scheduled Payments
    post:
      description: "Registers a Pix payment for a future civil date, evaluated in America/Sao_Paulo. The available balance is NOT touched here (REG-Art.9 caput): nothing moves until the scheduled date, when the order is sent inside the settlement window IN 513 art. 12 fixes. Non-business days are accepted, because Pix settles every day. Pix Saque (OTHR) and Pix Troco (GSCB) are refused at creation rather than on the scheduled date: REG-Art.11-P prohibits scheduling them, and the rule is knowable now. The payee is photographed at creation. On a DICT schedule the key is resolved again on the scheduled date and compared against that photograph, which is what REG-Art.9§5 requires -- a key can be reassigned in between. A MANUAL or QR_CODE schedule is not looked up again: it is sent to the payee photographed at creation. A schedule can also be born from a BR Code: send initiationType QR_CODE with the emvPayload, including a due-date collection code, and the payee is resolved from the key the code carries. The txId it names and the payload itself are recorded with the schedule and shown on its receipt. The scheduled date you send is the one that is used -- it is NOT checked against the collection's own due date. Send only the block your initiationType reads -- payeeKey for DICT, destination for MANUAL, emvPayload for QR_CODE. The blocks are mutually exclusive: a body carrying another type's block is refused rather than resolved from one of them: a well-formed block with 422 PIX-0751; one with a missing field by request validation first (400 PIX-0002), and one with an invalid field likewise (400 PIX-0003)."
      operationId: createScheduledPayment
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/create-scheduled-payment
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduledPaymentBody'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPaymentView'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
              examples:
                idempotencyGate:
                  summary: Idempotency gate refusal
                  value:
                    code: PIX-0030
                    title: Idempotency Key Required
                    message: The X-Idempotency header is required for this operation and must be within the accepted length.
                undecodableBody:
                  summary: PIX-0010 -- the body is not decodable as this operation's JSON
                  value:
                    code: PIX-0010
                    title: Client Error
                    message: The request could not be processed due to a client-side error.
            application/problem+json:
              examples:
                invalidFieldValues:
                  summary: PIX-0003 -- a field fails its validation rule
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: scheduledDate does not match the 2006-01-02 format
                        location: scheduledDate
                    code: PIX-0003
                missingFields:
                  summary: PIX-0002 -- a required field is missing
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: payeeKey.keyType is a required field
                        location: payeeKey.keyType
                      - message: payeeKey.keyValue is a required field
                        location: payeeKey.keyValue
                    code: PIX-0002
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Two shapes share this status, one per media type. application/problem+json is request validation, which refused the body before any rule of this operation was read, with errors[] naming each field: PIX-0002 a required field is missing -- what an incomplete payee block of either type answers; PIX-0003 a field fails its rule (enum, format, check digits, length) -- what a complete payee block with an invalid field answers. application/json is the legacy {code,title,message} envelope, for refusals that answer before validation runs: PIX-0010 the body is not decodable as this operation's JSON -- malformed, or a field of the wrong JSON type, such as a string where the payeeKey object belongs; and, from the idempotency gate: X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too."
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: The payer account does not resolve to an account visible to the caller (PIX-0750).
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "This organization already created a scheduled payment under the same X-Idempotency key (PIX-0756). Nothing was created and nothing was charged by THIS request; the earlier schedule stands -- find it with GET /scheduled-payments filtered by account and settlement date. Which status you get depends on how long ago the first request was. While the replay record lives, an identical retry replays the original 201 response and a divergent one is refused with PIX-0031 @ 412. Once that record is gone -- it expires, and it is absent entirely during a cache outage -- any retry of an already-used key answers this 409 instead. IMPORTANT: the key is consumed PERMANENTLY for this organization. Unlike the replay record, the durable constraint behind this status never expires. Send a fresh key for each distinct creation -- a UUID per intent is the safe pattern -- and reuse a key only to retry the creation it already identified. Do not recycle keys from a counter or a per-invoice reference that repeats across cycles. PIX-0124 is the other 409, and it is not about the key header: the payee key (for a QR_CODE schedule, the key the BR Code carries) is registered to the PAYER's own account, and a payer cannot schedule a payment to their own key. Nothing was created; do not retry."
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                foreignBlock:
                  summary: PIX-0751 -- a block another initiation type reads is present; remove it
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0751
                    title: Unprocessable Entity
                    status: 422
                    detail: "The payload does not fit the declared initiation type: a field that type requires is missing or invalid, or a field that only another initiation type reads is present."
                    errors:
                      - message: "destination is not allowed when initiationType is DICT: the payee is resolved from payeeKey"
                        location: destination
                    code: PIX-0751
                missingBlock:
                  summary: PIX-0751 with no errors -- most often the block the initiation type requires is absent; supply it. The same bare body also answers a zero amount.
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0751
                    title: Unprocessable Entity
                    status: 422
                    detail: "The payload does not fit the declared initiation type: a field that type requires is missing or invalid, or a field that only another initiation type reads is present."
                    code: PIX-0751
          description: "The request is well formed and cannot be accepted. Read the code, not the status: PIX-0751 the payload lacks the block its initiationType requires -- supply it; this refusal carries no field detail -- or carries a block another initiationType reads -- a destination on DICT, a payeeKey on MANUAL, a payeeKey or destination on QR_CODE, an emvPayload on anything but QR_CODE -- in which case errors names each such field; remove each; PIX-0752 the date is already past in America/Sao_Paulo; PIX-0758 the date is today and it is already 08:00 or later in America/Sao_Paulo -- no window would attempt the order; schedule a later date or send an immediate Pix; PIX-0754 the date is beyond the horizon this participant configured; PIX-0755 the directory has no entry for the payee key -- for a QR_CODE schedule that is the key the BR Code carries; PIX-0304 the emvPayload was read and refused as a BR Code; PIX-0328 the payer's ledger account is blocked -- unblock it in the ledger and send again; PIX-0332 the payer's ledger account is closed and can send nothing."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        "502":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "An upstream service could not answer, so the schedule was NOT created and nothing was charged; retrying is safe. PIX-0701: COB Hub could not be reached to decode the emvPayload or refused this platform's credential, or the receiver behind it gave no answer on the charge -- only a QR_CODE creation can answer this. PIX-0700: DICT Hub could not resolve the payee key (unreachable, a server error, or any answer that says nothing about the key) -- a DICT or QR_CODE creation can answer this. PIX-0705: the ledger could not read the payer account (unreachable, or an answer that does not say the account is absent). PIX-0702: the CRM gave no verdict on the payer's holder (unreachable, refused this platform's credential, or a failure that does not say the holder is absent or malformed)."
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
      summary: Register a scheduled Pix payment
      tags:
        - Scheduled Payments
  /scheduled-payments/{schedule_id}:
    get:
      description: 'Returns the schedule together with every attempt of its scheduled day, oldest first. The list is empty and never null before that date. A schedule belonging to another organization answers 404 rather than 403: the read is scoped by organization, so the row is never seen, and answering ''forbidden'' would confirm the identifier exists.'
      operationId: getScheduledPayment
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-scheduled-payment
      parameters:
        - description: Schedule identifier.
          in: path
          name: schedule_id
          required: true
          schema:
            description: Schedule identifier.
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPaymentView'
          description: OK
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: No schedule with that identifier exists for this organization, or it was soft-deleted (PIX-0770).
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: schedule_id is not a UUID (PIX-0015). The response names the parameter; the schedule is never looked up.
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Read one scheduled Pix payment
      tags:
        - Scheduled Payments
  /scheduled-payments/{schedule_id}/cancel:
    post:
      description: 'Cancels a schedule at the payer''s request, accepted right up to the cancellation cut-off recorded on it and refused AT that instant. The deadline compared against is the one photographed when the schedule was created, not whatever the configuration derives today: the deadline the payer was told is the deadline they get. Because the cut-off is strictly before the first settlement window, cancelling and executing can never both be in time. Nothing is released -- nothing was held.'
      operationId: cancelScheduledPayment
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/cancel-scheduled-payment
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Schedule identifier.
          in: path
          name: schedule_id
          required: true
          schema:
            description: Schedule identifier.
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPaymentView'
          description: OK
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Two shapes share this status, one per media type. application/problem+json: schedule_id is not a UUID (PIX-0015). The response names the parameter; the schedule is never looked up. application/json is the legacy {code,title,message} envelope, from the idempotency gate: X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json."
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: No schedule with that identifier exists for this organization (PIX-0770).
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The schedule cannot be cancelled from the state it is in. PIX-0771: it has already settled, been cancelled or failed -- re-read it, a terminal status does not transition. PIX-0773: it is executing, which under the cut-off precedence should be unreachable, so its occurrence is worth investigating rather than retrying.'
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The cancellation cut-off recorded on this schedule has passed (PIX-0772). Not resolvable by retry: the deadline is the snapshot taken at creation, and at the exact instant it is already refused.'
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
      summary: Cancel a scheduled Pix payment
      tags:
        - Scheduled Payments
  /scheduled-payments/{schedule_id}/receipt:
    get:
      description: 'Returns the proof of what was agreed: the amount, the settlement date, both parties as photographed at creation, and the cancellation deadline the payer was told. It carries no status and no attempt history on purpose -- a receipt answers what was committed to, and putting the lifecycle in it would make a document people save go stale the moment the schedule moves.'
      operationId: getScheduledPaymentReceipt
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-scheduled-payment-receipt
      parameters:
        - description: Schedule identifier.
          in: path
          name: schedule_id
          required: true
          schema:
            description: Schedule identifier.
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledPaymentReceiptView'
          description: OK
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: No schedule with that identifier exists for this organization, or it was soft-deleted (PIX-0770).
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: schedule_id is not a UUID (PIX-0015). The response names the parameter; the schedule is never looked up.
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Read a scheduled payment's receipt
      tags:
        - Scheduled Payments
  /transfers:
    get:
      description: "Returns a cursor-paginated page of transfers that involve the calling account (`X-Account-Id`). Use `direction=out` for payments the account sent and `direction=in` for payments it received. Omitting `direction` returns both legs: a payment settled between two accounts of the same organization is stored as two rows (one `OUTBOUND`, one `INBOUND`) sharing an `endToEndId`, so a direction-less query -- including one narrowed by `end_to_end_id` -- can return two items for a single payment. Pass `direction` when you need exactly one leg."
      operationId: listTransfers
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/list-transfers
      parameters:
        - description: Account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Filter by transfer status (lowercase). fraud_analysis lists the sent Pix held for antifraud review.
          explode: false
          in: query
          name: status
          schema:
            description: Filter by transfer status (lowercase). fraud_analysis lists the sent Pix held for antifraud review.
            examples:
              - processing
            type: string
        - description: "Filter by direction (lowercase): 'in' for received (cash-in), 'out' for sent (cash-out). Omit to list both legs."
          explode: false
          in: query
          name: direction
          schema:
            description: "Filter by direction (lowercase): 'in' for received (cash-in), 'out' for sent (cash-out). Omit to list both legs."
            examples:
              - out
            type: string
        - description: Filter by BACEN end-to-end ID (32 chars)
          explode: false
          in: query
          name: end_to_end_id
          schema:
            description: Filter by BACEN end-to-end ID (32 chars)
            examples:
              - E12345678202605061030abcdef12345
            type: string
        - description: Opaque cursor returned by the previous page
          explode: false
          in: query
          name: after
          schema:
            description: Opaque cursor returned by the previous page
            type: string
        - description: Page size (1-100, default 20)
          explode: false
          in: query
          name: limit
          schema:
            description: Page size (1-100, default 20)
            examples:
              - '20'
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransfersListOutput'
          description: OK
        '400':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0300
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for transfer initiation.
                code: PIX-0300
              schema:
                $ref: '#/components/schemas/Detail'
            application/json:
              example:
                code: PIX-0001
                title: Missing Headers in Request
                message: Your request is missing one or more required header params.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: Missing, duplicated, or malformed X-Account-Id, or invalid status, direction, end-to-end ID, cursor, or limit filter input (PIX-0001, PIX-0017, PIX-0020, PIX-0300). Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: List Pix transfers for an account
      tags:
        - Transfers
  /transfers/cashout/initiate:
    post:
      description: Creates a transfer initiation in PENDING state and validates the source account. The amount is supplied at process time.
      operationId: initiateTransfer
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/initiate-transfer
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Source account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Source account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateTransferBody'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateTransferOutput'
          description: Created
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0300
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for transfer initiation.
                code: PIX-0300
              schema:
                $ref: '#/components/schemas/Detail'
          description: Missing, duplicated, or malformed request headers/body fields, an initiation-type mismatch, or an invalid source account (PIX-0001-0003, PIX-0010, PIX-0017, PIX-0300-0302). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001, PIX-0010) answer in the legacy {code,title,message} envelope too.
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0303
                title: Unprocessable Entity
                status: 422
                detail: DICT key lookup returned no results.
                code: PIX-0303
              schema:
                $ref: '#/components/schemas/Detail'
          description: The DICT key cannot be resolved, the QR Code cannot be decoded, or the source ledger account is blocked (PIX-0303, PIX-0304, PIX-0328).
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        '502':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0700
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0700
              schema:
                $ref: '#/components/schemas/Detail'
          description: A required upstream service is unavailable (PIX-0700-0702, PIX-0705); PIX-0701 also answers a dynamic QR whose receiver gave no answer on the charge, and the call can be tried again.
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Initiate a Pix transfer (step 1)
      tags:
        - Transfers
  /transfers/cashout/process:
    post:
      description: 'Confirms a previously initiated transfer, debits the source account, and submits the Pix payment for processing. When the submission fails without proof that the order never left (a timeout or a 5xx), the debit is kept and the call answers 201 with status PROCESSING: read the transfer for the outcome. A 502 PIX-0325 answers only an order that provably was not sent, once the reversal of the debit is recorded. When the reversal is not recorded, the call answers 500. When an antifraud check is on for the Pix, the call debits the account, asks the institution''s antifraud partner, and then sends the payment. An ALLOW sends it. A DENY reverses the debit and answers 422 PIX-0336. No valid decision under a closed posture, or a broken antifraud configuration, reverses the debit and answers 422 PIX-0337. A REVIEW that Pix Lerian cannot hold reverses the debit and answers 422 PIX-0338. A REVIEW that Pix Lerian can hold answers 201 with status FRAUD_ANALYSIS: the debit and the usage limit stay, and nothing is sent. The caller''s metadata goes to the partner unread. A retry is a new initiation.'
      operationId: processTransfer
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/process-transfer
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Source account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Source account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: "Optional caller-supplied 32-char BACEN endToEndId, accepted for MANUAL initiations only (omit it to let SPI generate one). It is not the idempotency key -- that is X-Idempotency. A DICT or QR_CODE initiation already fixed its endToEndId at initiate (returned as endToEndId) and process reuses it automatically: for those, omit this header; sending it, even with the same value, is refused (PIX-0300) while the initiation is pending -- a retry of a process that already concluded (initiation CONFIRMED) returns the existing transfer, without the header or with a well-formed one."
          in: header
          name: X-End-To-End-Id
          schema:
            description: "Optional caller-supplied 32-char BACEN endToEndId, accepted for MANUAL initiations only (omit it to let SPI generate one). It is not the idempotency key -- that is X-Idempotency. A DICT or QR_CODE initiation already fixed its endToEndId at initiate (returned as endToEndId) and process reuses it automatically: for those, omit this header; sending it, even with the same value, is refused (PIX-0300) while the initiation is pending -- a retry of a process that already concluded (initiation CONFIRMED) returns the existing transfer, without the header or with a well-formed one."
            examples:
              - E12345678202605061030abcdef12345
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProcessTransferBody'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransferResponse'
          description: Created. The status is PROCESSING, or FRAUD_ANALYSIS when the antifraud partner put the Pix under review and Pix Lerian holds it.
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0300
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for transfer initiation.
                code: PIX-0300
              schema:
                $ref: '#/components/schemas/Detail'
          description: Missing, duplicated, or malformed request headers/body fields, an invalid end-to-end ID, an X-End-To-End-Id sent for a still-pending DICT or QR_CODE initiation (whose id was fixed at initiate), or a missing/invalid deferred amount (PIX-0001-0003, PIX-0010, PIX-0017, PIX-0300). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001, PIX-0010) answer in the legacy {code,title,message} envelope too.
        '404':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0320
                title: Not Found
                status: 404
                detail: Initiation ID does not exist.
                code: PIX-0320
              schema:
                $ref: '#/components/schemas/Detail'
          description: No initiation exists for the supplied initiationId in the calling account scope (PIX-0320).
        '409':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0322
                title: Conflict
                status: 409
                detail: Initiation was already confirmed.
                code: PIX-0322
              schema:
                $ref: '#/components/schemas/Detail'
          description: The initiation was already confirmed or cancelled, or a concurrent transfer write won the race (PIX-0322, PIX-0326, PIX-0327, PIX-0704).
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0321
                title: Unprocessable Entity
                status: 422
                detail: Initiation has expired.
                code: PIX-0321
              schema:
                $ref: '#/components/schemas/Detail'
          description: "The initiation expired (PIX-0321), the debit has insufficient funds (PIX-0323), the ledger refused the debit for another reason (PIX-0332) or because another write moved the balance, which a new attempt can clear (PIX-0333), the ledger account/balance cannot be used (PIX-0328, PIX-0329), more than one ledger fee package matches the transaction (PIX-0331), or the ledger refused the accounting route of the transaction (PIX-0335); none of these debited anything. The ledger answer does not show the transfer amount moved to the rail (a different, unreadable or missing rail leg), so the order was not sent and the debit revert was attempted -- the transfer ends REJECTED with ledger.revert when it completes; when it does not, it ends FAILED, if the state write fails it stays PENDING with no ledger.revert. Do not start a new initiation until the transfer shows ledger.revert (PIX-0330). PIX-0334: the provider or the rail rejected the payment after the debit, and the debit was reversed; the order will not settle, and a new attempt needs a new end-to-end id. PIX-0336, PIX-0337 and PIX-0338: the institution's antifraud partner denied the payment, gave no valid decision (or the antifraud configuration of the flow is broken), or asked for an analysis that a sent Pix cannot wait for. They arrive only after the debit reversal is recorded: the transfer is REJECTED, and a new Pix is a new initiation."
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Unexpected server error (PIX-0000). A debit reversal that is not proven also answers PIX-0000: the transfer is FAILED. Read the transfer before you act.'
        '502':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0324
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0324
              schema:
                $ref: '#/components/schemas/Detail'
          description: A required upstream service failed (PIX-0324, PIX-0325, PIX-0705).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Process and confirm a Pix transfer (step 2)
      tags:
        - Transfers
  /transfers/{id}:
    get:
      description: "Returns a single transfer that involves the calling account (`X-Account-Id`) on either side of the payment: one the account sent (`type: OUTBOUND`) or one it received (`type: INBOUND`). A transfer the account is neither side of returns 404 `PIX-0340`, the same answer as a transfer that does not exist."
      operationId: getTransfer
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-transfer
      parameters:
        - description: Account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Transfer UUID
          in: path
          name: id
          required: true
          schema:
            description: Transfer UUID
            examples:
              - 0196070b-1234-7890-abcd-ef0123456789
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransferResponse'
          description: OK
        '400':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0300
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for transfer initiation.
                code: PIX-0300
              schema:
                $ref: '#/components/schemas/Detail'
            application/json:
              example:
                code: PIX-0001
                title: Missing Headers in Request
                message: Your request is missing one or more required header params.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: Missing, duplicated, or malformed X-Account-Id or transfer UUID (PIX-0001, PIX-0015, PIX-0017, PIX-0300). Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '404':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0340
                title: Not Found
                status: 404
                detail: Transfer ID does not exist for this organization.
                code: PIX-0340
              schema:
                $ref: '#/components/schemas/Detail'
          description: No transfer exists for the supplied UUID in the calling account scope (PIX-0340).
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Get a Pix transfer by ID
      tags:
        - Transfers
  /transfers/{id}/unblock:
    post:
      description: |-
        Resolves ONE outbound transfer that is stuck in `PROCESSING`. Pix Lerian asks the SPI for the outcome of the payment and applies it. The request has no field to state what happened.

        The transfer must have been in `PROCESSING` for at least 90 minutes. If the SPI reports the payment as completed, the transfer becomes `COMPLETED`. If the SPI reports it as rejected or failed, the transfer becomes `REJECTED` and Pix Lerian reverses the debit. If the SPI has no final outcome yet, the call is refused with `PIX-0556`: retry later. If Pix Lerian cannot get the status from the SPI, the call answers `502` (`PIX-0557`) and Pix Lerian changes nothing.

        A transfer that is already in a final status is refused with `PIX-0554`. A transfer in any other status is refused with `PIX-0551`.

        The caller needs the `transfer-recovery` permission with the post action. It is tenant level, and only the editor role holds it. In BYOC, only the SPI permission declaration grants it: create the SPI M2M credential in Access Manager, then set `IDP_DECLARATION_ENABLED` to `true`.

        The response is the transfer as [Get transfer](/es/reference/interfaces/pix-lerian/spi/get-transfer) returns it.
      operationId: unblockTransfer
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/unblock-transfer
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a different URL, X-Account-Id, X-Actor-Id, X-Override-Reason or X-Override-Ticket is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Transfer UUID
          in: path
          name: id
          required: true
          schema:
            description: Transfer UUID
            examples:
              - 0196070b-1234-7890-abcd-ef0123456789
            type: string
        - description: Source account UUID. A transfer that exists under a different account is answered 404.
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Source account UUID. A transfer that exists under a different account is answered 404.
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Optional. Identifies the person in your back office who asked for the check. Pix Lerian does not use it to decide the outcome.
          in: header
          name: X-Actor-Id
          schema:
            maxLength: 255
            description: Optional. Identifies the person in your back office who asked for the check. Pix Lerian does not use it to decide the outcome.
            examples:
              - ops-maria
            type: string
        - description: Optional. Reason for the check. Pix Lerian does not use it to decide the outcome.
          in: header
          name: X-Override-Reason
          schema:
            maxLength: 512
            description: Optional. Reason for the check. Pix Lerian does not use it to decide the outcome.
            examples:
              - outcome never arrived
            type: string
        - description: Optional. Ticket reference in your own back office. Pix Lerian does not use it to decide the outcome.
          in: header
          name: X-Override-Ticket
          schema:
            maxLength: 255
            description: Optional. Ticket reference in your own back office. Pix Lerian does not use it to decide the outcome.
            examples:
              - OPS-4711
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransferResponse'
          description: OK
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "Two shapes share this status, one per media type. application/problem+json: X-Account-Id or the transfer UUID is missing or malformed (PIX-0001, PIX-0015, PIX-0017), or an attribution header exceeds its maximum length (PIX-0706). application/json is the legacy {code,title,message} envelope, from the idempotency gate: X-Idempotency absent or longer than 64 bytes (PIX-0030)."
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: No outbound transfer exists for the supplied UUID in the calling account scope (PIX-0340).
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "The transfer cannot be unblocked now. PIX-0554: it is already in a final status. PIX-0555: it has been in PROCESSING for less than 90 minutes, so retry later. PIX-0551: it is not in PROCESSING. PIX-0556: the SPI has no final outcome yet, so retry later. PIX-0327: the transfer changed during the request, so read it again and retry."
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'The first request under this X-Idempotency is still running (with Retry-After: 1), or the key was replayed with a divergent request -- a different URL (including the path parameter), X-Account-Id, X-Actor-Id, X-Override-Reason or X-Override-Ticket (PIX-0031). Legacy {code,title,message} envelope, NOT problem+json.'
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        '502':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: "The call could not conclude. PIX-0557: Pix Lerian could not get the status from the SPI, and it changed nothing. PIX-0553: the debit reversal did not complete."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Unblock a Pix transfer stuck in PROCESSING
      tags:
        - Transfers
  /transfers/{id}/refunds:
    post:
      description: "Issues a refund against a previously completed CASHIN transfer with a structured pacs.004 reasonCode. A refund the rail refuses answers 422 PIX-0013 and its debit is reverted; if that revert does not complete, the refund stays PROCESSING. A provider send that fails without proving the pacs.004 was not sent (a timeout, a 5xx) compensates nothing and answers 201 with status PROCESSING, as a refund the provider accepts without a provider reference does: the debit stays recorded until the outcome arrives by end-to-end id (GET the refund or wait for its callback). A retry with the same X-Idempotency key replays the original 201 response, with X-Idempotency-Replayed: true, instead of creating a second refund, including when the request timed out while the provider was answering. After a 5xx or a 409 PIX-0406, the same key answers the refund that the first attempt created, in its current state, with 201 and without X-Idempotency-Replayed, as long as that refund is not FAILED: the refund can still be PROCESSING with its debit, so read it with GET to see its outcome. A resend that keeps answering 412 PIX-0031 with Retry-After: 1 is still in flight. The same key with a different transfer, amount, reasonCode or reason answers 412 PIX-0031. Once the refund is FAILED and no replay record is left, the key is free and a retry under it creates a new refund."
      operationId: createRefund
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/create-refund
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Account UUID
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Account UUID
            examples:
              - 019606a1-3b4c-7d8e-9f01-234567890abc
            type: string
        - description: Original transfer UUID
          in: path
          name: id
          required: true
          schema:
            description: Original transfer UUID
            examples:
              - 0196070b-1234-7890-abcd-ef0123456789
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRefundBody'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundCashoutOutput'
          description: Created
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0403
                title: Bad Request
                status: 400
                detail: Missing or malformed required fields for refund.
                code: PIX-0403
              schema:
                $ref: '#/components/schemas/Detail'
          description: Missing, duplicated, or malformed request headers/path/body fields, an invalid amount/reason, or another invalid refund input (PIX-0001-0003, PIX-0010, PIX-0015, PIX-0017, PIX-0403). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001, PIX-0010) answer in the legacy {code,title,message} envelope too.
        '404':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0400
                title: Not Found
                status: 404
                detail: Original transfer does not exist.
                code: PIX-0400
              schema:
                $ref: '#/components/schemas/Detail'
          description: The original transfer does not exist in the calling account scope (PIX-0400).
        '409':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0406
                title: Conflict
                status: 409
                detail: The refund changed during this request. Retry the operation.
                code: PIX-0406
              schema:
                $ref: '#/components/schemas/Detail'
          description: A concurrent refund update won the race, or the operation reached another conflicting state (PIX-0406, PIX-0704).
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0031
                title: Precondition Failed
                status: 412
                detail: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
                code: PIX-0031
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Two refusals share this status. The refund row's, problem+json: the X-Idempotency key already holds a refund for a different transfer, amount, reasonCode or reason (PIX-0031). The replay gate's, which answers first, follows. Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0401
                title: Unprocessable Entity
                status: 422
                detail: Original transfer is not in COMPLETED status.
                code: PIX-0401
              schema:
                $ref: '#/components/schemas/Detail'
          description: "The original transfer is not completed, the refund exceeds the remaining amount, the ledger account or balance cannot be used, or the rail refused the refund (PIX-0013, PIX-0401, PIX-0402, PIX-0328, PIX-0329). PIX-0323: the holder who received the Pix no longer has the funds; nothing is debited, the refund ends FAILED and its X-Idempotency is freed. PIX-0331: more than one ledger fee package matches the refund. PIX-0332: the ledger account is closed or its status forbids sending. PIX-0013 and PIX-0330: the rail refused the refund, or the ledger answer does not show the refund amount moved to the rail, so the refund was not sent; Pix Lerian reverts the debit, and the refund ends FAILED once the reversal is recorded. If the reversal does not complete, the refund stays PROCESSING. PIX-0335: the ledger refused the accounting route of the refund; nothing was debited."
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000).
        '502':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0404
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0404
              schema:
                $ref: '#/components/schemas/Detail'
          description: A required upstream service failed (PIX-0404, PIX-0405, PIX-0705); PIX-0405 includes a ledger refusal after an automatic retry (the debit may stand).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Create an outbound Pix refund (MED)
      tags:
        - Refunds
  /scheduled-payment-recurrences:
    get:
      description: "Returns a page of the organization's series, newest first. Creation order is the only ordering a series can offer: a series has no settlement date of its own -- its occurrences carry those -- which is also why this route takes no date range. To ask which payments fall in a period, or to see the occurrences of one series, use GET /v1/scheduled-payments with recurrence_id. Paging is by opaque cursor rather than offset: a series registered between two pages would shift every later row under an offset and silently skip one. Echo the cursor verbatim. The status filter takes the SERIES' statuses (ACTIVE, COMPLETED, CANCELLED), not an occurrence's -- a cancelled series still has settled occurrences behind it."
      operationId: listScheduledPaymentRecurrences
      parameters:
        - description: Page size, 1..100. Absent or 0 means 20.
          explode: false
          in: query
          name: limit
          schema:
            default: 20
            description: Page size, 1..100. Absent or 0 means 20.
            examples:
              - 20
            format: int64
            maximum: 100
            minimum: 0
            type: integer
        - description: Opaque cursor from a previous page. Echo it verbatim -- it is not a document to build.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from a previous page. Echo it verbatim -- it is not a document to build.
            type: string
        - description: Narrow to one payer account.
          explode: false
          in: query
          name: account_id
          schema:
            description: Narrow to one payer account.
            format: uuid
            type: string
        - description: "Narrow to one series status. These are the SERIES' statuses, not an occurrence's: a cancelled series still has settled occurrences behind it."
          explode: false
          in: query
          name: status
          schema:
            description: "Narrow to one series status. These are the SERIES' statuses, not an occurrence's: a cancelled series still has settled occurrences behind it."
            enum:
              - ACTIVE
              - COMPLETED
              - CANCELLED
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                items:
                  - id: 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    amount: "150.00"
                    currency: BRL
                    status: ACTIVE
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    metadata:
                      contractRef: A-4471
                    recurrence:
                      periodicity: MONTHLY
                      firstPaymentDate: "2027-08-10"
                      paymentCount: 12
                      endDate: null
                      indefinite: false
                      referenceDayOfMonth: 10
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    payeeKey:
                      keyType: EMAIL
                      keyValue: joao.pereira@example.com
                    materializedThrough: "2027-10-10"
                    lastPaymentDate: "2028-07-10"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
              schema:
                $ref: "#/components/schemas/RecurrencesPage"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: The request could not be bound, or a filter cannot be used. The cursor is not one this service issued or it was truncated (PIX-0789); a status is not a SERIES status, account_id is not a UUID, or limit is negative or above 100 (PIX-0020, naming each offending parameter; 0, like an absent limit, means the default page size of 20). An occurrence status such as PENDING or SETTLED is refused rather than answered with an empty page, because the two vocabularies sit side by side and an empty page would read as 'you have no series'. Restart a cursor listing without the cursor.
        "422":
          content:
            application/problem+json:
              example:
                title: Unprocessable Entity
                status: 422
                detail: validation failed
                errors:
                  - message: invalid integer
                    location: query.limit
                    value: abc
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`limit` is not an integer. This is the FRAMEWORK's request-binding refusal, not one of this service's: it carries no PIX-NNNN code, names the offending parameter in `errors`, and happens before any filter is looked at. Every other bad value on this operation -- an unknown status, a malformed cursor, a non-UUID account_id -- is the 400 above instead."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: List recurring series
      tags:
        - Scheduled Payment Recurrences
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/list-recurring-series
    post:
      description: "Registers a RULE -- weekly or monthly, with exactly one termination criterion -- plus the payment template every occurrence is stamped from, and materializes the first window of occurrences in the same transaction. Use it when the payer is committing to a standing payment rather than to one order; a single future payment is the scheduled-payments route. The payee is resolved once, at creation: send payeeKey with initiationType DICT or destination with MANUAL, never both -- a body carrying the other type's block is refused rather than resolved from one of them: a well-formed block with 422 PIX-0751; one with a missing field by request validation first (400 PIX-0002), and one with an invalid field likewise (400 PIX-0003). QR_CODE is refused on this route (PIX-0751). Supply exactly one of paymentCount, endDate and indefinite: sending none is refused (PIX-0761) rather than read as open-ended, and sending two is refused (PIX-0762) rather than reconciled. No ceiling is placed on the number of payments -- REG-Art.37-A forbids limiting the quantity of a user's transactions. THE MONTHLY CALENDAR RULE (IN BCB 513/2024 art. 13): the reference day is derived from firstPaymentDate and PRESERVED across occurrences, and when a month has no such day -- 29, 30 or 31 -- that occurrence moves to the FIRST DAY OF THE FOLLOWING MONTH, after which the reference day returns. A series on day 31 therefore pays on 1 March AND on 31 March: two occurrences in the same month. Shifting off a non-business day is a different matter and does not happen -- Pix settles every day, so a non-business date is executed as it stands. The response carries the occurrences created now, not the whole series: an indefinite series has no finite set of rows, and materializedThrough states how far the window currently reaches. The available balance is NOT touched, here or by the occurrences (REG-Art.9 caput): nothing moves until each scheduled date."
      operationId: createScheduledPaymentRecurrence
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. Within one hour of the first 2xx answer, an identical resend returns the original response, status included, with X-Idempotency-Replayed: true, and reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            examples:
              dict:
                description: "Pix Lerian resolves the payee from the directory at creation and again before every occurrence settles. Send payeeKey only: a destination alongside it is refused -- 422 PIX-0751 when well formed, 400 PIX-0002 when a field of it is missing, 400 PIX-0003 when one is invalid."
                summary: DICT -- monthly rent to a Pix key, twelve payments
                value:
                  accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                  amount: "150.00"
                  currency: BRL
                  initiationType: DICT
                  purpose: IPAY
                  payeeKey:
                    keyType: EMAIL
                    keyValue: joao.pereira@example.com
                  description: Aluguel
                  metadata:
                    contractRef: A-4471
                  recurrence:
                    periodicity: MONTHLY
                    firstPaymentDate: "2027-08-10"
                    paymentCount: 12
              manual:
                description: "The caller supplies the payee's account and owner, and the person type is derived from the document. Send destination only: a payeeKey alongside it is refused -- 422 PIX-0751 when well formed, 400 PIX-0002 when a field of it is missing, 400 PIX-0003 when one is invalid."
                summary: MANUAL -- weekly payment to bank details, until an end date
                value:
                  accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                  amount: "80.00"
                  currency: BRL
                  initiationType: MANUAL
                  purpose: IPAY
                  destination:
                    account:
                      branch: "0001"
                      number: "98765"
                      participant: "18236120"
                      type: CACC
                    owner:
                      document: "12345678000195"
                      name: Escola Exemplo LTDA
                  description: Aulas semanais
                  recurrence:
                    periodicity: WEEKLY
                    firstPaymentDate: "2027-08-02"
                    endDate: "2027-10-25"
            schema:
              $ref: "#/components/schemas/CreateRecurrenceBody"
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                id: 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
                accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                amount: "150.00"
                currency: BRL
                status: ACTIVE
                initiationType: DICT
                purpose: IPAY
                description: Aluguel
                metadata:
                  contractRef: A-4471
                recurrence:
                  periodicity: MONTHLY
                  firstPaymentDate: "2027-08-10"
                  paymentCount: 12
                  endDate: null
                  indefinite: false
                  referenceDayOfMonth: 10
                source:
                  branch: "0001"
                  accountNumber: "1234567"
                  accountType: CACC
                  ispb: "60746948"
                  personType: NATURAL_PERSON
                  taxId: "12345678909"
                  name: Ana Souza
                destination:
                  branch: "0001"
                  accountNumber: "7654321"
                  accountType: CACC
                  ispb: "18236120"
                  personType: NATURAL_PERSON
                  taxId: "98765432100"
                  name: Joao Pereira
                payeeKey:
                  keyType: EMAIL
                  keyValue: joao.pereira@example.com
                materializedThrough: "2027-10-10"
                lastPaymentDate: "2028-07-10"
                createdAt: "2026-09-25T14:32:10.123456Z"
                updatedAt: "2026-09-25T14:32:10.123456Z"
                occurrences:
                  - id: 01a0d8fb-1a8c-7b21-8c3d-4e5f6a7b8c91
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    scheduledDate: "2027-08-10"
                    amount: "150.00"
                    currency: BRL
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    status: PENDING
                    firstWindowOpensAt: "2027-08-10T00:00:00-03:00"
                    cancellationCutoff: "2027-08-09T23:59:59.999999-03:00"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
                    attempts: []
                  - id: 01a0d8fb-1a8d-7b22-8c3d-4e5f6a7b8c92
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    scheduledDate: "2027-09-10"
                    amount: "150.00"
                    currency: BRL
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    status: PENDING
                    firstWindowOpensAt: "2027-09-10T00:00:00-03:00"
                    cancellationCutoff: "2027-09-09T23:59:59.999999-03:00"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
                    attempts: []
                  - id: 01a0d8fb-1a8e-7b23-8c3d-4e5f6a7b8c93
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    scheduledDate: "2027-10-10"
                    amount: "150.00"
                    currency: BRL
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    status: PENDING
                    firstWindowOpensAt: "2027-10-10T00:00:00-03:00"
                    cancellationCutoff: "2027-10-09T23:59:59.999999-03:00"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
                    attempts: []
              schema:
                $ref: "#/components/schemas/RecurrenceDetailView"
          description: Created
        "400":
          content:
            application/json:
              examples:
                idempotencyGate:
                  summary: Idempotency gate refusal
                  value:
                    code: PIX-0030
                    title: Idempotency Key Required
                    message: The X-Idempotency header is required for this operation and must be within the accepted length.
                undecodableBody:
                  summary: PIX-0010 -- the body is not decodable as this operation's JSON
                  value:
                    code: PIX-0010
                    title: Client Error
                    message: The request could not be processed due to a client-side error.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              examples:
                invalidFieldValues:
                  summary: PIX-0003 -- a field fails its validation rule
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: periodicity must be one of [WEEKLY MONTHLY]
                        location: recurrence.periodicity
                    code: PIX-0003
                missingFields:
                  summary: PIX-0002 -- a required field is missing
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: destination.account.number is a required field
                        location: destination.account.number
                      - message: destination.account.participant is a required field
                        location: destination.account.participant
                      - message: destination.account.type is a required field
                        location: destination.account.type
                      - message: destination.owner.document is a required field
                        location: destination.owner.document
                      - message: destination.owner.name is a required field
                        location: destination.owner.name
                    code: PIX-0002
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Two shapes share this status, one per media type. application/problem+json is request validation, which refused the body before any rule of this operation was read, with errors[] naming each field: PIX-0002 a required field is missing -- what an incomplete payee block of either type answers; PIX-0003 a field fails its rule (enum, format, check digits, length) -- what a complete payee block with an invalid field answers. application/json is the legacy {code,title,message} envelope, for refusals that answer before validation runs: PIX-0010 the body is not decodable as this operation's JSON -- malformed, or a field of the wrong JSON type, such as a string where the payeeKey object belongs; and, from the idempotency gate: X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too."
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: The payer account does not resolve to an account visible to the caller (PIX-0750).
        "409":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: The payee key is registered to the PAYER's own account (PIX-0124), and a payer cannot schedule payments to their own key. Nothing was created; do not retry.
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "422":
          content:
            application/problem+json:
              examples:
                foreignBlock:
                  summary: PIX-0751 -- a block another initiation type reads is present; remove it
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0751
                    title: Unprocessable Entity
                    status: 422
                    detail: "The payload does not fit the declared initiation type: a field that type requires is missing or invalid, or a field that only another initiation type reads is present."
                    errors:
                      - message: "payeeKey is not allowed when initiationType is MANUAL: the payee is the destination sent"
                        location: payeeKey
                    code: PIX-0751
                missingBlock:
                  summary: PIX-0751 with no errors -- the block the initiation type requires is absent (supply it), or initiationType is QR_CODE, which a series cannot be initiated from. The same bare body also answers a zero amount.
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0751
                    title: Unprocessable Entity
                    status: 422
                    detail: "The payload does not fit the declared initiation type: a field that type requires is missing or invalid, or a field that only another initiation type reads is present."
                    code: PIX-0751
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The request is well formed and cannot be accepted. Read the code, not the status: PIX-0761 no termination criterion was supplied -- add exactly one; PIX-0762 more than one was supplied -- remove the others; PIX-0764 the first payment date is past, beyond this participant's scheduling horizon, or the end date precedes it; PIX-0758 the first payment is today and it is already 08:00 or later in America/Sao_Paulo -- start the series on a later date; PIX-0751 the payload lacks the block its initiationType requires -- supply it; this refusal carries no field detail -- or carries the other type's block -- a destination on DICT, a payeeKey on MANUAL -- in which case errors names that field, and it must be removed -- or declares QR_CODE, which a series cannot be initiated from; PIX-0755 the directory has no entry for the payee key; PIX-0766 the participant's materialization horizon is not usable, which is a configuration fault rather than a fault in this request; PIX-0328 the payer's ledger account is blocked -- unblock it in the ledger and send again; PIX-0332 the payer's ledger account is closed and can send nothing."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        "502":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "DICT Hub could not resolve the payee key (PIX-0700): unreachable, a server error, or any answer that says nothing about the key. PIX-0705: the ledger could not read the payer account (unreachable, or an answer that does not say the account is absent). PIX-0702: the CRM gave no verdict on the payer's holder (unreachable, refused this platform's credential, or a failure that does not say the holder is absent or malformed). The series was NOT created and nothing was charged. Retrying is safe."
        "503":
          content:
            application/json:
              example:
                code: PIX-0032
                title: Idempotency Unavailable
                message: The request was not processed because the idempotency store is unavailable. Please retry.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: Replay cache unavailable on this fail-closed route, so the mutation was refused rather than executed without replay protection (PIX-0032). Legacy {code,title,message} envelope, NOT problem+json.
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
      summary: Create a recurring series
      tags:
        - Scheduled Payment Recurrences
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/create-recurring-series
  /scheduled-payment-recurrences/{recurrence_id}:
    get:
      description: "Returns the series -- its rule, both parties as photographed at creation, and the window edge -- together with the occurrences currently materialized for it, oldest first. The list is empty and never null, and it is a WINDOW rather than the whole calendar: materializedThrough says how far it reaches, and a long-running series is enumerated in full through GET /v1/scheduled-payments with recurrence_id. A series belonging to another organization answers 404 rather than 403: the read is scoped by organization, so the row is never seen, and answering 'forbidden' would confirm the identifier exists."
      operationId: getScheduledPaymentRecurrence
      parameters:
        - description: Series identifier.
          in: path
          name: recurrence_id
          required: true
          schema:
            description: Series identifier.
            examples:
              - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
            format: uuid
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                id: 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
                accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                amount: "150.00"
                currency: BRL
                status: ACTIVE
                initiationType: DICT
                purpose: IPAY
                description: Aluguel
                metadata:
                  contractRef: A-4471
                recurrence:
                  periodicity: MONTHLY
                  firstPaymentDate: "2027-08-10"
                  paymentCount: 12
                  endDate: null
                  indefinite: false
                  referenceDayOfMonth: 10
                source:
                  branch: "0001"
                  accountNumber: "1234567"
                  accountType: CACC
                  ispb: "60746948"
                  personType: NATURAL_PERSON
                  taxId: "12345678909"
                  name: Ana Souza
                destination:
                  branch: "0001"
                  accountNumber: "7654321"
                  accountType: CACC
                  ispb: "18236120"
                  personType: NATURAL_PERSON
                  taxId: "98765432100"
                  name: Joao Pereira
                payeeKey:
                  keyType: EMAIL
                  keyValue: joao.pereira@example.com
                materializedThrough: "2027-10-10"
                lastPaymentDate: "2028-07-10"
                createdAt: "2026-09-25T14:32:10.123456Z"
                updatedAt: "2026-09-25T14:32:10.123456Z"
                occurrences:
                  - id: 01a0d8fb-1a8c-7b21-8c3d-4e5f6a7b8c91
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    scheduledDate: "2027-08-10"
                    amount: "150.00"
                    currency: BRL
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    status: PENDING
                    firstWindowOpensAt: "2027-08-10T03:00:00Z"
                    cancellationCutoff: "2027-08-10T02:59:59.999999Z"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
                    attempts: []
                  - id: 01a0d8fb-1a8d-7b22-8c3d-4e5f6a7b8c92
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    scheduledDate: "2027-09-10"
                    amount: "150.00"
                    currency: BRL
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    status: PENDING
                    firstWindowOpensAt: "2027-09-10T03:00:00Z"
                    cancellationCutoff: "2027-09-10T02:59:59.999999Z"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
                    attempts: []
                  - id: 01a0d8fb-1a8e-7b23-8c3d-4e5f6a7b8c93
                    accountId: 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
                    scheduledDate: "2027-10-10"
                    amount: "150.00"
                    currency: BRL
                    initiationType: DICT
                    purpose: IPAY
                    description: Aluguel
                    source:
                      branch: "0001"
                      accountNumber: "1234567"
                      accountType: CACC
                      ispb: "60746948"
                      personType: NATURAL_PERSON
                      taxId: "12345678909"
                      name: Ana Souza
                    destination:
                      branch: "0001"
                      accountNumber: "7654321"
                      accountType: CACC
                      ispb: "18236120"
                      personType: NATURAL_PERSON
                      taxId: "98765432100"
                      name: Joao Pereira
                    status: PENDING
                    firstWindowOpensAt: "2027-10-10T03:00:00Z"
                    cancellationCutoff: "2027-10-10T02:59:59.999999Z"
                    createdAt: "2026-09-25T14:32:10.123456Z"
                    updatedAt: "2026-09-25T14:32:10.123456Z"
                    attempts: []
              schema:
                $ref: "#/components/schemas/RecurrenceDetailView"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: recurrence_id is not a UUID (PIX-0015). The response names the parameter; the series is never looked up.
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "No series with that identifier exists for this organization (PIX-0760). A series belonging to another organization answers this too: the read is scoped by organization, and distinguishing the two cases would only help someone probing the identifier space. An identifier that is not a UUID is a DIFFERENT answer -- the binding contract refuses it with 400 before the query runs, and the response names the field."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Read one recurring series
      tags:
        - Scheduled Payment Recurrences
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-recurring-series
  /scheduled-payment-recurrences/{recurrence_id}/cancel:
    post:
      description: "Stops the series at the payer's request and, with it, the occurrences already materialized for it that are still PENDING. It is the right call when the payer wants the standing payment to end; to drop a single date and keep the series running, cancel that occurrence through POST /v1/scheduled-payments/{schedule_id}/cancel instead. Nothing is released -- nothing was held. WHAT IT DOES NOT STOP. It moves only PENDING occurrences to CANCELLED. It does not change an occurrence in any other status (EXECUTING, DISPATCHED_OUTCOME_UNKNOWN, AWAITING_RETRY, SETTLED, FAILED or CANCELLED), and skippedOccurrences counts those. READING THE RESPONSE. cancelledOccurrences and skippedOccurrences PARTITION the occurrences the series had: every one of them is in exactly one count, which is what lets a client reconcile the figures against the pending occurrences it was displaying a moment earlier. They describe THIS request and are not properties of the series -- re-reading the series afterwards does not report them again. CANCELLING TWICE. The second request meets a series that is already CANCELLED and is refused with PIX-0765, whether or not the replay cache is reachable. The occurrences the first request stopped do not return to PENDING, so a repeat can never undo it. A COMPLETED SERIES CAN STILL BE CANCELLED. completed means every occurrence the series will ever have has been created -- not that they have been paid. A short series reaches that state while every one of its payments is still in the future, so this route accepts it and stops the pending occurrences. A series that really has finished paying is accepted too and truthfully reports zero cancelled."
      operationId: cancelScheduledPaymentRecurrence
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Series identifier.
          in: path
          name: recurrence_id
          required: true
          schema:
            description: Series identifier.
            examples:
              - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
            format: uuid
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                recurrenceId: 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
                status: CANCELLED
                cancelledOccurrences: 5
                skippedOccurrences: 1
              schema:
                $ref: "#/components/schemas/RecurrenceCancellationView"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Two shapes share this status, one per media type. application/problem+json: recurrence_id is not a UUID (PIX-0015). The response names the parameter; the series is never looked up. application/json is the legacy {code,title,message} envelope, from the idempotency gate: X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json."
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "No series with that identifier exists for this organization (PIX-0760). A series belonging to another organization answers this too: the write is scoped by the organization on the validated credential, so the row is never seen, and answering 'forbidden' would confirm the identifier exists somewhere."
        "409":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The series has already been cancelled (PIX-0765). Re-read it rather than retrying: this is the durable backstop behind the degrading idempotency posture, and it is also the answer a repeated cancellation gets. A COMPLETED series is NOT refused -- completed means every occurrence the series will ever have has been created, not that they have been paid, so its pending occurrences are still stoppable here."
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Cancel a recurring series
      tags:
        - Scheduled Payment Recurrences
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/cancel-recurring-series
  /scheduled-payment-recurrences/{recurrence_id}/receipt:
    get:
      description: "Returns the proof of what the payer committed to when they created the series: when it was registered, the amount of each payment, the first payment date, the frequency, the number of payments when one was chosen, and the last payment date when the series has one. It is a DIFFERENT document from the single schedule's receipt and shares no field with it -- a series has no settlement date of its own and a single schedule has no frequency, so one shared schema would leave half the fields null on either side. paymentCount and lastPaymentDate are null on an indefinite series, where stating either would be a fabrication. cancellationCutoff is the deadline of the NEXT pending occurrence, because a cut-off belongs to a date and a series spans many; it is null when no occurrence is pending. The receipt carries no status and no history on purpose -- a document people save should not go stale the moment the series moves."
      operationId: getScheduledPaymentRecurrenceReceipt
      parameters:
        - description: Series identifier.
          in: path
          name: recurrence_id
          required: true
          schema:
            description: Series identifier.
            examples:
              - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
            format: uuid
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                recurrenceId: 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
                scheduledAt: "2026-09-25T14:32:10.123456Z"
                amount: "150.00"
                firstPaymentDate: "2027-08-10"
                periodicity: MONTHLY
                paymentCount: 12
                lastPaymentDate: "2028-07-10"
                payer:
                  branch: "0001"
                  accountNumber: "1234567"
                  accountType: CACC
                  ispb: "60746948"
                  personType: NATURAL_PERSON
                  taxId: "12345678909"
                  name: Ana Souza
                payee:
                  branch: "0001"
                  accountNumber: "7654321"
                  accountType: CACC
                  ispb: "18236120"
                  personType: NATURAL_PERSON
                  taxId: "98765432100"
                  name: Joao Pereira
                description: Aluguel
                metadata:
                  contractRef: A-4471
                cancellationCutoff: "2027-08-10T02:59:59.999999Z"
              schema:
                $ref: "#/components/schemas/RecurrenceReceiptView"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: recurrence_id is not a UUID (PIX-0015). The response names the parameter; the series is never looked up.
        "404":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: "No series with that identifier exists for this organization (PIX-0760). A series belonging to another organization answers this too: the read is scoped by organization, and distinguishing the two cases would only help someone probing the identifier space. An identifier that is not a UUID is a DIFFERENT answer -- the binding contract refuses it with 400 before the query runs, and the response names the field."
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Detail"
          description: Error
      summary: Read a recurring series' receipt
      tags:
        - Scheduled Payment Recurrences
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-recurring-series-receipt
  /balance-locks:
    get:
      description: |-
        Lists the balance locks of your institution of both kinds, oldest update first: the MED balance locks, and the cautelar blocks that Pix Lerian places on a received Pix held for review. There is no filter by kind, and a cautelar block has `origin_system` `antifraud-cautelar`. Filter by `origin_system`, `status` (repeatable), `updated_before` and `external_ref`. The list uses cursor pagination: pass `next_cursor` as `cursor` to read the next page; `next_cursor` is `null` on the last page. `limit` defaults to 20 and is at most 100. A non-integer `limit` is refused with `400` (`PIX-0020`).

        The `status` of a lock tells which operation applies. A `PENDING` MED balance lock can be settled, released or closed. A cautelar block cannot: it is refused with `409` (`PIX-0651`), except a whole-block `pix_refund` settle and a release once the block is due. A `SETTLING` lock waits for the confirmation of its settlement, and one whose devolution failed can also be closed. An `AWAITING_CREDIT` lock waits for the parked credit of its Pix and can only be released.
      operationId: listBalanceLocks
      parameters:
        - description: Scope of the calling consumer (e.g. med-infraction). Omit to list across every origin_system.
          explode: false
          in: query
          name: origin_system
          schema:
            description: Scope of the calling consumer (e.g. med-infraction). Omit to list across every origin_system.
            type: string
        - description: "Filter by status (repeatable): PENDING, SETTLING, RELEASED, SETTLED, AWAITING_CREDIT"
          explode: true
          in: query
          name: status
          schema:
            description: "Filter by status (repeatable): PENDING, SETTLING, RELEASED, SETTLED, AWAITING_CREDIT"
            examples:
              -   - PENDING
            items:
              type: string
            type:
              - array
              - "null"
        - description: Only balance locks with updated_at before this RFC 3339 timestamp
          explode: false
          in: query
          name: updated_before
          schema:
            description: Only balance locks with updated_at before this RFC 3339 timestamp
            type: string
        - description: Restrict to a single grouping operation
          explode: false
          in: query
          name: external_ref
          schema:
            description: Restrict to a single grouping operation
            type: string
        - description: Page size (1-100, default 20)
          explode: false
          in: query
          name: limit
          schema:
            description: Page size (1-100, default 20)
            examples:
              - "20"
            type: string
        - description: Opaque cursor returned by the previous page
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor returned by the previous page
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                items:
                  - lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                    origin_system: med-infraction
                    external_ref: med-2026-000123
                    end_to_end_id: E12345678202610271032k7Qm2Xp9Ld4
                    status: PENDING
                    requested_amount: "150.75"
                    effective_amount: "100.26"
                    settled_amount: null
                    payment_type: null
                    pix_end_to_end_id: null
                    settling_at: null
                    surplus_midaz_tx_id: null
                    created_at: "2026-10-27T10:41:07Z"
                    updated_at: "2026-10-27T10:41:07Z"
                  - lock_id: 01a17cf5-983a-7d13-a4c8-2e9f51b06d37
                    origin_system: med-infraction
                    external_ref: med-2026-000123
                    end_to_end_id: E12345678202610271032k7Qm2Xp9Ld4
                    status: PENDING
                    requested_amount: "50.49"
                    effective_amount: "50.49"
                    settled_amount: null
                    payment_type: null
                    pix_end_to_end_id: null
                    settling_at: null
                    surplus_midaz_tx_id: null
                    created_at: "2026-10-27T10:43:52Z"
                    updated_at: "2026-10-27T10:43:52Z"
                next_cursor: null
              schema:
                $ref: "#/components/schemas/ListBalanceLocksOutput"
          description: OK
        "400":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: An unknown status, an updated_before that is not RFC 3339 (PIX-0003), or a non-integer limit (PIX-0020).
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: List balance locks, MED and cautelar
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/list-cautionary-blocks
    post:
      description: |-
        Places a MED balance lock (MED 2.0) on the funds of a Pix that your institution received. Pix Lerian creates a pending ledger transaction that moves the funds from the available balance of the credited account to the blocking account. The amount held is the smaller of the requested amount and the available balance: `effective_amount` is what was held, and it can be lower than `requested_amount`.

        The blocking account of your institution must be configured. An inbound Pix transfer with this `end_to_end_id` must be completed, with available balance on the credited account, or have its ledger credit parked. For a Pix whose credit is parked, the lock holds at once (`PENDING`) when the ledger already lists that credit. Otherwise the lock is stored as `AWAITING_CREDIT`: nothing is held yet, and the credit of the Pix holds the funds before it completes the transfer.

        `request_ref` identifies the creation. A replay with the same payload returns the existing lock with `201`; the same `request_ref` with another payload is refused with `409` (`PIX-0012`). Another hold on the same transaction needs another `request_ref`. A retry after a failed create (`502`) reuses the amount that the failed attempt computed, so a hold that the attempt placed becomes this lock. A retry whose earlier hold no longer stands is refused with `422` (`PIX-0013`).

        Next, return the funds to the payer with [Settle a MED balance lock](/es/reference/interfaces/pix-lerian/spi/settle-a-cautionary-block) or [Settle every MED balance lock of a Pix](/es/reference/interfaces/pix-lerian/spi/settle-every-cautionary-block-of-a-pix), or give them back to the account holder with [Release a MED balance lock](/es/reference/interfaces/pix-lerian/spi/release-a-cautionary-block-to-the-account-holder).
      operationId: createBalanceLock
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            examples:
              hold:
                summary: Hold the funds of a suspicious received Pix
                value:
                  request_ref: med-2026-000123-hold-1
                  external_ref: med-2026-000123
                  origin_system: med-infraction
                  end_to_end_id: E12345678202610271032k7Qm2Xp9Ld4
                  amount: "150.75"
                  asset: BRL
            schema:
              $ref: "#/components/schemas/CreateBalanceLockBody"
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                midaz_tx_id: 01a17cf3-133d-7a52-8e19-0c4b6d2f7a91
                status: PENDING
                requested_amount: "150.75"
                effective_amount: "100.26"
                created_at: "2026-10-27T10:41:07Z"
              schema:
                $ref: "#/components/schemas/CreateBalanceLockResponse"
          description: The hold, created now or replayed by request_ref.
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: Missing or invalid body fields, or a body that is not valid JSON (PIX-0002, PIX-0003, PIX-0010). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0012
                title: Conflict
                status: 409
                detail: The entity already exists or conflicts with an existing resource.
                code: PIX-0012
              schema:
                $ref: "#/components/schemas/Detail"
          description: 'request_ref was already used with a different payload (PIX-0012); or a create on a live cautelar block of this Pix, by a caller that is not the DICT Hub service credential (PIX-0651). Only the DICT Hub adopts or replaces a cautelar block. With plugin authentication off, every caller counts as the DICT Hub.'
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0013
                title: Unprocessable Entity
                status: 422
                detail: The operation could not be processed due to a business rule violation.
                code: PIX-0013
              schema:
                $ref: "#/components/schemas/Detail"
          description: "No INBOUND transfer matches end_to_end_id that is completed or has its ledger credit parked, the locks waiting for that parked credit already sum to its amount, the credited account has no available balance to hold, the ledger refused the hold for another business reason, or the hold an earlier attempt placed under this request_ref no longer stands (PIX-0013); the ledger account is blocked or has no balance for the asset (PIX-0328, PIX-0329); the participant's blocking account is not configured (PIX-0650); an account has no ledger alias (PIX-0655). The ledger refused the accounting route of the hold, so nothing was held (PIX-0335)."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000).
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The ledger call failed, another write moved the balance while the ledger placed the hold, the create could not tell whether a hold already stands under request_ref, or storing an AWAITING_CREDIT lock failed: retry with the same request_ref (PIX-0652). With a detail naming overrides.allowFeeSkip, the ledger that holds the blocking account does not enable it, so nothing was held: retry with the same request_ref once it is enabled."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Create a MED balance lock
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/create-a-cautionary-block
  /balance-locks/audit:
    get:
      description: |-
        Returns the audit records of the manual interventions on one lock (`lock_id`) or on one group settlement (`refund_ref`), newest first. Send exactly one of the two. A record exists for every close and surplus return, for every release that moved funds out of the blocking account, and for every other release or settlement confirmation that carried an attribution header (`X-Actor-Id`, `X-Override-Reason` or `X-Override-Ticket`). Each record carries the actor declared in `X-Actor-Id` (Pix Lerian does not check it against the access token), the `principal` that the access token authenticated, the reason, the ticket and the request ID. An ID with no record returns an empty `entries` list, not `404`.
      operationId: listBalanceLockAudit
      parameters:
        - description: Per-block override lookup (mutually exclusive with refund_ref)
          explode: false
          in: query
          name: lock_id
          schema:
            description: Per-block override lookup (mutually exclusive with refund_ref)
            type: string
        - description: Group override lookup (mutually exclusive with lock_id)
          explode: false
          in: query
          name: refund_ref
          schema:
            description: Group override lookup (mutually exclusive with lock_id)
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                entries:
                  - id: 01a17e29-5544-7b96-8d2a-3f0e71c9a4b8
                    lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                    action: CLOSE
                    actor: backoffice.ops@example.com
                    reason: manual devolution paid by Pix
                    ticket: MED-4821
                    request_id: 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
                    correlation_id: med-2026-000123
                    created_at: "2026-10-27T16:20:00Z"
                    principal: example-org/0198f3a2-0000-7000-8000-000000000001
              schema:
                $ref: "#/components/schemas/ListBalanceLockAuditResponse"
          description: OK
        "400":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: Neither or both of lock_id and refund_ref (PIX-0003), or a lock_id that is not a UUID (PIX-0020).
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: List MED balance lock audit records
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/list-cautionary-block-audit-records
  /balance-locks/cautelar/{key}/fraud-decision:
    post:
      description: |-
        The antifraud partner, through the client's M2M application, or a person of the client, decides the cautelar block of a received Pix that the partner put in review. The event `inbound_transfer.blocked` announces the block. The `key` is `pix-cashin:` followed by the end-to-end id.


        `ALLOW` frees the funds at once and publishes `inbound_transfer.block_released`. `DENY` is recorded and published as `inbound_transfer.block_fraud_confirmed`. It moves no money: the funds stay held until the deadline of the block, 72 hours minus 15 minutes after Pix Lerian settles the received Pix. Pix Lerian then releases them to the account holder. A MED balance lock that the institution opens through DICT before the deadline keeps the funds held. After a partner `DENY`, a person of the client can still release the block with `ALLOW` and a `justification`. The `DENY` stays, and `fraudCheck.releasedBy` and `fraudCheck.releasedAt` show who freed the funds. A `DENY` opens no DICT infraction report.


        The first final decision wins. The record shows who decided: `fraudCheck.resolutionOrigin` is `PARTNER` or `OPERATOR`, and `fraudCheck.resolvedBy` is the subject of the token. A person of the client must send a `justification` of 10 to 500 characters. Pix Lerian never publishes it in an event. A person's release records it as the `reason` of the audit record of the block.


        A `200` also answers a repeat of the same decision. An `ALLOW` whose release did not finish still answers `200`: the block is due, and Pix Lerian releases it on its next pass.


        A `404` (`PIX-0340`) means that the key names no received Pix of the tenant that the partner put in review. A `409` (`PIX-0339`) means that another decision was recorded first, or that `analysisId` names another analysis. A `409` (`PIX-0344`) means that the block cannot take the decision: an `ALLOW` at or after the deadline, a block that Pix Lerian never placed, a settled block, or a Pix that the rail returned to the payer. A `422` (`PIX-0343`) means that the body is outside the contract, or that a person sent no `justification`. A `503` (`PIX-0345`) means that the settlement of the Pix may still be writing: retry after the `Retry-After` time.
      operationId: decideCautelarBlock
      parameters:
        - description: 'The key of the evaluation of the received Pix: pix-cashin: followed by its end-to-end id, as the antifraud partner holds it.'
          in: path
          name: key
          required: true
          schema:
            description: 'The key of the evaluation of the received Pix: pix-cashin: followed by its end-to-end id, as the antifraud partner holds it.'
            examples:
              - pix-cashin:E87654321202610291430AbCdEf12345
            type: string
      requestBody:
        content:
          application/json:
            examples:
              operatorDeny:
                summary: A person of the client denies it
                value:
                  analysisId: an-7f3a
                  decision: DENY
                  justification: Payee confirmed as a mule account by the fraud desk.
              partnerAllow:
                summary: The application of the partner releases the Pix
                value:
                  analysisId: an-7f3a
                  decision: ALLOW
            schema:
              $ref: '#/components/schemas/FraudDecisionBody'
      responses:
        '200':
          content:
            application/json:
              example:
                id: 01a18811-6b64-7a10-b2c3-d4e5f6071829
                accountId: 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
                endToEndId: E87654321202610291430AbCdEf12345
                status: COMPLETED
                type: INBOUND
                initiationType: DICT
                source:
                  account:
                    branch: '0001'
                    number: '1112223'
                    participant: '87654321'
                    type: CACC
                  owner:
                    document: '11144477735'
                    name: Maria Souza
                    type: NATURAL_PERSON
                destination:
                  account:
                    branch: '0001'
                    number: '9988776'
                    participant: '12345678'
                    type: CACC
                  owner:
                    document: '52998224725'
                    name: Joao Pereira
                    type: NATURAL_PERSON
                amount: '100.00'
                currency: BRL
                fraudCheck:
                  decision: REVIEW
                  origin: PROVIDER
                  analysisId: an-7f3a
                  resolution: DENY
                  resolutionOrigin: PARTNER
                  resolvedBy: service/antifraud-partner
                ledger:
                  transactionId: 01a18826-1aff-7d11-a2b3-c4d5e6f70819
                  sourceOperationId: 01a18826-1aff-7d12-a2b3-c4d5e6f7081a
                  destinationOperationId: 01a18826-1aff-7d13-a2b3-c4d5e6f7081b
                createdAt: '2026-10-29T14:30:05.412Z'
                updatedAt: '2026-10-29T14:52:41.087Z'
              schema:
                $ref: '#/components/schemas/TransferResponse'
          description: OK
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          description: 'The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '404':
          content:
            application/json:
              example:
                code: TENANT_NOT_FOUND
                title: Tenant Not Found
                message: 'tenant not found: 019606a1-3b4c-7d8e-9f01-234567890abc'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0340
                title: Not Found
                status: 404
                detail: Transfer ID does not exist for this organization.
                code: PIX-0340
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The key names no received Pix of the tenant that the partner put in review: unknown, malformed, or a Pix that the partner allowed (PIX-0340). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        '409':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0339
                title: Conflict
                status: 409
                detail: 'The transfer is not held in fraud analysis: it was never held, its analysis already ended (cancelled, expired or decided), or the call names another analysis. GET the transfer for its current state.'
                code: PIX-0339
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Another decision was recorded first, or the call names another analysis (PIX-0339); or the block cannot take the decision: an ALLOW at or after its deadline, on a block never placed, on a settled block, or on a Pix that the rail returned to the payer (PIX-0344).'
        '422':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0343
                title: Unprocessable Entity
                status: 422
                detail: 'The decision is not valid: it needs analysisId and decision ALLOW or DENY, in a body within 16 KiB, and a person of the client also needs a justification of 10 to 500 characters.'
                code: PIX-0343
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'A body outside the contract: no analysisId, a decision that is not ALLOW or DENY, more than 16 KiB; or a person of the client without a justification of 10 to 500 characters (PIX-0343).'
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Unexpected server error (PIX-0000). Nothing was recorded: the same call can repeat. The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        '503':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0345
                title: Service Unavailable
                status: 503
                detail: The server could not complete the request. Please try again later.
                code: PIX-0345
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The settlement of the Pix may still be writing: retry after Retry-After seconds (PIX-0345). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Decide the cautelar block of a received Pix
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/decide-the-cautelar-block-of-a-received-pix
  /balance-locks/settle:
    post:
      description: |-
        Returns to the payer, in one devolution, the funds that the locks of one received Pix hold, and moves every lock to `SETTLING`. With `pix_refund`, Pix Lerian sends one return (pacs.004) of the original transaction. With `pix_manual`, it pays one Pix (pacs.008) from the blocking account to the bank account that you give. Pix Lerian derives `settle_amount` from the locks and the ceiling: you do not send it.

        Every lock in `lock_ids` must be `PENDING` (a lock still `AWAITING_CREDIT` is refused with `409`, `PIX-0012`), belong to your institution and share the same `end_to_end_id` and `external_ref`. `original_amount` must not exceed the received transaction: [Quote the amount left to settle](/es/reference/interfaces/pix-lerian/spi/quote-the-amount-left-to-settle) tells what is left. For a lock opened for a MED infraction (`origin_system` `med-infraction`), use [Settle refund](/es/reference/interfaces/pix-lerian/dict/settle-refund) instead: DICT holds MED state that this route cannot see.

        The group settles all or nothing: a group with a lock whose surplus was already returned is refused with `409` (`PIX-0656`) before any lock is reserved. The call is idempotent by `refund_ref`, and a retry must send the same `lock_ids`: a `refund_ref` already bound to a lock outside `lock_ids` is refused with `400` (`PIX-0003`). A dispatch that fails without proof that the devolution was not sent (a timeout, a `5xx`) answers success, and every lock stays `SETTLING` until the outcome is confirmed. A `pix_manual` surplus is returned when the settlement is confirmed, not by this call.

        When the rail reports the outcome of the devolution, send it with [Confirm a group settlement](/es/reference/interfaces/pix-lerian/spi/confirm-a-group-settlement).
      operationId: createGroupSettle
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            examples:
              pixManual:
                summary: "pixManual: one Pix from the blocking account to the payer's account"
                value:
                  refund_ref: med-2026-000123-group-devolution
                  lock_ids:
                    - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                    - 01a17cf5-983a-7d13-a4c8-2e9f51b06d37
                  original_amount: "150.75"
                  original_end_to_end_id: E12345678202610271032k7Qm2Xp9Ld4
                  pix_manual:
                    ispb: "12345678"
                    branch: "0001"
                    account: "1234567"
                    account_type: CC
                    document: "12345678909"
                    asset: BRL
                    description: MED devolution to the payer
              pixRefund:
                summary: "pixRefund: one pacs.004 returning both locks"
                value:
                  refund_ref: med-2026-000123-group-devolution
                  lock_ids:
                    - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                    - 01a17cf5-983a-7d13-a4c8-2e9f51b06d37
                  original_amount: "150.75"
                  original_end_to_end_id: E12345678202610271032k7Qm2Xp9Ld4
                  pix_refund:
                    return_reason_code: FR01
                    asset: BRL
            schema:
              $ref: "#/components/schemas/CreateGroupSettleBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                refund_ref: med-2026-000123-group-devolution
                payment_type: PIX_REFUND
                status: SETTLING
                original_amount: "150.75"
                already_settled: "0"
                settle_amount: "150.75"
                surplus_amount: "0"
                lock_ids:
                  - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                  - 01a17cf5-983a-7d13-a4c8-2e9f51b06d37
                initiated_at: "2026-10-27T14:05:12Z"
              schema:
                $ref: "#/components/schemas/CreateGroupSettleResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: Missing or invalid body fields, a body that is not valid JSON, a lock_ids set with an unknown, duplicated or mixed lock, an original_end_to_end_id other than the locks' own, or a refund_ref bound to a lock outside lock_ids or replayed with a different request (PIX-0002, PIX-0003, PIX-0010). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0012
                title: Conflict
                status: 409
                detail: The entity already exists or conflicts with an existing resource.
                code: PIX-0012
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A lock is not PENDING or is bound to another refund_ref, has an unlock in progress, a pixRefund group holds a lock whose hold a pixManual settle already committed, or a pixManual group holds a lock whose hold was made in a blocking account other than the one configured now (the detail names it: unlock that lock) (PIX-0012); a reset (a FAILED confirm or the settle's own compensation) left part of the group SETTLING under this refund_ref: a FAILED confirm resets the rest, then retry, but once the rest is closed with /close this refund_ref keeps answering it, so settle the reset locks under a new one (PIX-0653); or a lock already returned its surplus (PIX-0656). A cautelar block at a door that does not open it: unlock before it is due, close, a pixManual or partial pixRefund settle, a group settle (PIX-0651)."
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0654
                title: Unprocessable Entity
                status: 422
                detail: There is nothing left to settle for this block.
                code: PIX-0654
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`original_amount` exceeds the received transaction, or that transaction is not found (`PIX-0013`). Nothing is left to settle (`PIX-0654`). A ledger account is blocked (`PIX-0328`), or a `pix_refund` debit leg holds no ledger balance (`PIX-0329`). The ledger refused the debit because the account is closed or its status forbids sending (`PIX-0332`), or because more than one fee package matches it (`PIX-0331`): nothing was debited. The ledger answer does not show the settled amount moved to the rail, so the order was not sent and Pix Lerian attempted to revert the debit (`PIX-0330`). A `pix_manual` settlement has no blocking account configured (`PIX-0650`) or an account has no ledger alias (`PIX-0655`). The ledger refused the accounting route (`PIX-0335`): nothing was debited."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000).
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A ledger call failed, including a ledger refusal after an automatic retry, so the debit can stand and a lock can stay `SETTLING` (`PIX-0652`). When the detail names `overrides.allowFeeSkip` on a `pix_manual` settlement, the ledger refused the transfer out of the blocking account: settle again with `pix_manual` once the setting is on, or release the lock."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Settle every MED balance lock of a Pix
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/settle-every-cautionary-block-of-a-pix
  /balance-locks/settle-quote:
    get:
      description: |-
        Returns, for the received Pix identified by its original `end_to_end_id`, the `original_amount`, the amount `already_settled` by both devolution mechanisms (`pix_manual` locks that are `SETTLING` or `SETTLED`, and outbound refunds that are `PROCESSING` or `COMPLETED`), and `available_to_settle`, their difference. The difference can be zero or negative. The call is read-only: it holds nothing, so the value can be stale against a concurrent close. The settle and close operations enforce the ceiling themselves.

        Call it before you settle, to size the devolution: a settle whose `original_amount` minus `already_settled` is zero or less is refused with `422` (`PIX-0654`).
      operationId: getSettleQuote
      parameters:
        - description: Canonical original end-to-end id of the INBOUND transfer to quote the settle ceiling for
          explode: false
          in: query
          name: end_to_end_id
          required: true
          schema:
            description: Canonical original end-to-end id of the INBOUND transfer to quote the settle ceiling for
            examples:
              - E12345678202610271032k7Qm2Xp9Ld4
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                original_amount: "150.75"
                already_settled: "100.26"
                available_to_settle: "50.49"
              schema:
                $ref: "#/components/schemas/SettleQuoteResponse"
          description: OK
        "400":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: end_to_end_id is missing or is not a valid end-to-end or return id (PIX-0003).
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0013
                title: Unprocessable Entity
                status: 422
                detail: The operation could not be processed due to a business rule violation.
                code: PIX-0013
              schema:
                $ref: "#/components/schemas/Detail"
          description: No INBOUND transfer matches end_to_end_id (PIX-0013).
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Quote the amount left to settle
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/quote-the-amount-left-to-settle
  /balance-locks/settle/confirm:
    post:
      description: |-
        Applies the outcome of a group devolution to every lock of the group: `SUCCESS` settles them, and `FAILED` returns them to `PENDING`. Send `SUCCESS` with the `end_to_end_id` of the devolution: the D-prefixed return ID of a `pix_refund` group, or the E-prefixed payment ID of a `pix_manual` group. Any other ID is refused with `409` (`PIX-0012`) and nothing changes. Omit `result` to read the current state of the group without changing it.

        A retryable `409` (`PIX-0653`) means that the debit of the devolution, or its outcome on the rail, is not confirmed yet: nothing changes, so repeat the call later. A group whose surplus was already returned is refused with `409` (`PIX-0656`) and stays `SETTLING`. A `pix_manual` surplus is returned once, when every lock is `SETTLED`. If that return fails, the group stays `SETTLED` and the answer is `200` without `surplus_midaz_tx_id`; this does not prove that the surplus stayed blocked, because a ledger timeout can have moved it. Check the ledger, then use [Return a settlement surplus to the account holder](/es/reference/interfaces/pix-lerian/spi/return-a-settlement-surplus-to-the-account-holder).

        `X-Actor-Id`, `X-Override-Reason` and `X-Override-Ticket` are optional. Sending any of them records the confirmation in the audit trail. For a lock opened for a MED infraction (`origin_system` `med-infraction`), use [Confirm settle refund](/es/reference/interfaces/pix-lerian/dict/confirm-settle-refund) instead: DICT holds MED state that this route cannot see.
      operationId: confirmGroupSettle
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      requestBody:
        content:
          application/json:
            examples:
              failed:
                summary: "FAILED: the rail rejected the devolution, every lock goes back to PENDING"
                value:
                  refund_ref: med-2026-000123-group-devolution
                  result: FAILED
              poll:
                summary: "No result: read the group's current state"
                value:
                  refund_ref: med-2026-000123-group-devolution
              success:
                summary: "SUCCESS: the rail paid the devolution"
                value:
                  refund_ref: med-2026-000123-group-devolution
                  result: SUCCESS
                  end_to_end_id: D87654321202610271405g7Bv3Nc9Jw2
            schema:
              $ref: "#/components/schemas/ConfirmGroupSettleBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                refund_ref: med-2026-000123-group-devolution
                payment_type: PIX_REFUND
                status: SETTLED
                pix_end_to_end_id: D87654321202610271405g7Bv3Nc9Jw2
                original_amount: "150.75"
                already_settled: "0"
                settle_amount: "150.75"
                surplus_amount: "0"
                settled_at: "2026-10-27T14:06:03Z"
              schema:
                $ref: "#/components/schemas/ConfirmGroupSettleResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: A duplicated or padded attribution header (PIX-0001), a missing refund_ref (PIX-0002), a result other than SUCCESS or FAILED, SUCCESS without end_to_end_id, an invalid end_to_end_id or an oversized attribution header (PIX-0003), or a body that is not valid JSON (PIX-0010). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001, PIX-0010) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0011
                title: Not Found
                status: 404
                detail: No entity was found for the given ID. Please make sure to use the correct ID.
                code: PIX-0011
              schema:
                $ref: "#/components/schemas/Detail"
          description: No lock carries this refund_ref, including a group a FAILED confirm already reset (PIX-0011).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0653
                title: Conflict
                status: 409
                detail: The balance lock's settlement is not final yet; retry once it is.
                code: PIX-0653
              schema:
                $ref: "#/components/schemas/Detail"
          description: The group is not SETTLING, FAILED was reported over a devolution the rail already paid, SUCCESS named an end_to_end_id other than the group's devolution, SUCCESS over a lock whose transfer back to the holder a close the holder paid has in progress, or a concurrent update won (PIX-0012); FAILED while the devolution is still in flight, or either result while the group's debit is unconfirmed, retryable (PIX-0653); FAILED over a group that already returned its surplus (PIX-0656).
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0328
                title: Unprocessable Entity
                status: 422
                detail: The ledger account is blocked and cannot be used for the requested operation.
                code: PIX-0328
              schema:
                $ref: "#/components/schemas/Detail"
          description: "FAILED on a pixRefund group whose re-hold, or SUCCESS whose cancel of a left-behind re-hold, finds a blocked ledger account (PIX-0328), a closed one or one whose status forbids sending, which refused the hold (PIX-0332), an account without a ledger alias (PIX-0655), or no blocking account configured for the participant (PIX-0650). The ledger refused the accounting route of a re-hold or of the cancel of a left-behind re-hold (PIX-0335)."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000). With attribution headers, the confirm may already have taken effect when the audit record fails.
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "SUCCESS whose ledger search for, or cancel of, a block's left-behind re-hold failed: every block stays SETTLING, repeat it (PIX-0652). FAILED on a pixRefund group whose re-hold failed in the ledger, or was refused after an automatic retry so it may stand: the blocks not yet reset stay SETTLING, repeat it (PIX-0652). With a detail naming overrides.allowFeeSkip, repeat it once the setting is enabled on the ledger that holds the blocking account."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Confirm a group settlement
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/confirm-a-group-settlement
  /balance-locks/{lock_id}/close:
    post:
      description: |-
        Marks a `PENDING` or `SETTLING` lock `SETTLED`, with `closed_manually` `true`, for a devolution that your institution paid by Pix through Pix Lerian outside the automatic settlement. Pix Lerian sends no Pix. `settled_amount` records what was paid and counts in what was already returned of the received transaction, so a later settle of another lock is capped to what is left.

        `X-Actor-Id` and `X-Override-Reason` are required. `payment_type` is required when you close a `PENDING` lock. `end_to_end_id` must name a completed Pix of your institution paid to the payer of the received transaction: a devolution of the received Pix itself or, on a `pix_manual` lock, a Pix to the payer's account. Any other Pix, or one that is in flight, rejected or failed, is refused with `422` (`PIX-0013`). A lock still `AWAITING_CREDIT` is refused with `409` (`PIX-0012`). When nothing was paid to the payer, or the payer was repaid through another channel, release the lock instead. Never settle a lock that was already repaid: the devolution would be paid twice.

        A failed ledger search or cancel answers `502` (`PIX-0652`): repeat the call. Pix Lerian records every close in the audit trail. A `pix_manual` lock closed with a surplus returns it with [Return a settlement surplus to the account holder](/es/reference/interfaces/pix-lerian/spi/return-a-settlement-surplus-to-the-account-holder). For a lock opened for a MED infraction (`origin_system` `med-infraction`), use [Blocks close refund](/es/reference/interfaces/pix-lerian/dict/blocks-close-refund) instead: DICT holds MED state that this route cannot see.
      operationId: closeBalanceLock
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Balance lock UUID
          in: path
          name: lock_id
          required: true
          schema:
            description: Balance lock UUID
            examples:
              - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          required: true
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          required: true
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      requestBody:
        content:
          application/json:
            examples:
              close:
                summary: Close a SETTLING lock whose devolution failed, the payer repaid by a manual Pix
                value:
                  end_to_end_id: D87654321202610271405r4Tn8Wq2Kx6
                  notes: devolution failed on the rail, payer repaid by a manual Pix, ticket MED-4821
              closePartial:
                summary: Close a SETTLING pixRefund lock whose devolution failed, the payer repaid part of it by a manual Pix
                value:
                  end_to_end_id: D87654321202610271405r4Tn8Wq2Kx6
                  settled_amount: "60.13"
                  notes: devolution failed on the rail, payer repaid 60.13 of 100.26 by a manual Pix, ticket MED-4821
            schema:
              $ref: "#/components/schemas/CloseBalanceLockBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                status: SETTLED
                pix_end_to_end_id: D87654321202610271405r4Tn8Wq2Kx6
                closed_manually: true
                closed_at: "2026-10-27T16:20:00Z"
              schema:
                $ref: "#/components/schemas/CloseBalanceLockResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: A duplicated or padded attribution header (PIX-0001); a missing end_to_end_id (PIX-0002); a missing X-Actor-Id or X-Override-Reason, an oversized attribution header, payment_type missing on a PENDING lock or different from a SETTLING lock's own, settled_amount above a PENDING lock's effective_amount or other than what a SETTLING lock's settle reserved, or another invalid field (PIX-0003); a body that is not valid JSON (PIX-0010); a lock_id that is not a UUID (PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001, PIX-0010) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0011
                title: Not Found
                status: 404
                detail: No entity was found for the given ID. Please make sure to use the correct ID.
                code: PIX-0011
              schema:
                $ref: "#/components/schemas/Detail"
          description: No lock exists for lock_id (PIX-0011).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0012
                title: Conflict
                status: 409
                detail: The entity already exists or conflicts with an existing resource.
                code: PIX-0012
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The lock is `SETTLED`, `RELEASED` or `AWAITING_CREDIT`, a transfer back to the holder is in progress for it, a `SETTLING` lock has a devolution still in flight or already paid (confirm its settlement first), or the hold of the lock cannot be committed (`PIX-0012`). A surplus of the payment already left the blocking account (`PIX-0656`). A cautelar block at a door that does not open it: unlock before it is due, close, a pixManual or partial pixRefund settle, a group settle (PIX-0651)."
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0013
                title: Unprocessable Entity
                status: 422
                detail: The operation could not be processed due to a business rule violation.
                code: PIX-0013
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`PIX-0013`: the amounts already returned plus `settled_amount` exceed the received transaction, the transaction is not found, `end_to_end_id` does not name a completed Pix of your institution to the payer, or its amount does not cover `settled_amount`; the hold is untouched. `PIX-0328`: a ledger account is blocked. `PIX-0332`: the transfer back to the holder was refused because the account is closed or its status forbids receiving. `PIX-0655`: an account has no ledger alias. `PIX-0335`: the ledger refused the accounting route of the hold's commit or cancel, or of the transfer back; nothing moved."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Unexpected server error (PIX-0000). The close writes its audit record in the same transaction, so a failure records neither: retry the close, which finds a transfer back to the holder already made rather than making another."
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The ledger search for the lock's settle compensation re-holds failed, or the ledger did not confirm such a re-hold or a pixRefund lock's hold cancelled, or a pixManual lock's hold committed or cancelled (PIX-0652). Or the transfer of a committed hold back to the holder failed (a refusal after an automatic retry included) or has an unknown outcome: the lock keeps that transfer in progress; retry the close, which never transfers twice (PIX-0652). With a detail naming overrides.allowFeeSkip, the ledger that holds the blocking account does not enable it, so nothing moved: retry once it is enabled."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Close a MED balance lock after a manual return
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/close-a-cautionary-block-after-a-manual-return
  /balance-locks/{lock_id}/return-surplus:
    post:
      description: |-
        Moves a `pix_manual` surplus from the blocking account back to the account holder. Use it when a `pix_manual` settlement paid the payer less than the lock held and the surplus did not go back to the holder: the lock was closed manually, or the surplus return of a settlement confirmation answered without `surplus_midaz_tx_id`. That answer does not prove that the surplus stayed blocked, because a ledger timeout can have moved it. Before you call, search the ledger for a transaction whose metadata carries the `lock_id` and an `origin` of `balance-lock-surplus`, `balance-lock-group-surplus` or `balance-lock-surplus-recovery`. Call only when none exists.

        The lock must be `SETTLED`: a `SETTLING` lock with a surplus is refused with `409` (`PIX-0653`), so confirm the settlement first. `X-Actor-Id` and `X-Override-Reason` are required. The call is idempotent: a lock with no surplus, or whose surplus was already returned, answers `200` with `surplus_amount` `0`. After a `5xx` that returns no `surplus_midaz_tx_id`, the surplus can have moved: check the ledger before you retry. For a group settlement, call it once for each `lock_id`. Pix Lerian records every call in the audit trail.
      operationId: returnSurplus
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Balance lock UUID
          in: path
          name: lock_id
          required: true
          schema:
            description: Balance lock UUID
            examples:
              - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          required: true
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          required: true
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                surplus_amount: "0"
                surplus_midaz_tx_id: 01a17dae-b16e-7f28-9a03-6b1c4d8e2f75
                returned_at: "2026-10-27T15:02:41Z"
              schema:
                $ref: "#/components/schemas/ReturnSurplusResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: A duplicated or padded attribution header (PIX-0001), a missing X-Actor-Id or X-Override-Reason or an oversized attribution header (PIX-0003), or a lock_id that is not a UUID (PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0011
                title: Not Found
                status: 404
                detail: No entity was found for the given ID. Please make sure to use the correct ID.
                code: PIX-0011
              schema:
                $ref: "#/components/schemas/Detail"
          description: No lock exists for lock_id (PIX-0011).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0653
                title: Conflict
                status: 409
                detail: The balance lock's settlement is not final yet; retry once it is.
                code: PIX-0653
              schema:
                $ref: "#/components/schemas/Detail"
          description: The lock has a surplus but is not SETTLED yet (PIX-0653).
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0655
                title: Unprocessable Entity
                status: 422
                detail: An account required for this operation has no resolvable alias in the ledger.
                code: PIX-0655
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A ledger account is blocked (PIX-0328), the surplus return was refused because the account is closed or its status forbids receiving (PIX-0332), or an account has no ledger alias (PIX-0655). The ledger refused the accounting route of the surplus transfer: nothing moved (PIX-0335)."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Unexpected server error (PIX-0000). The surplus may already be returned when the audit record fails: list the lock first; a retry is a no-op only when surplus_midaz_tx_id is recorded, otherwise reconcile the ledger before retrying."
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A ledger call failed, a refusal after an automatic retry included (PIX-0652). The transfer may still have been applied when the ledger's answer was lost: without a surplus_midaz_tx_id, reconcile before retrying. With a detail naming overrides.allowFeeSkip, the ledger that holds the blocking account does not enable it, so nothing moved: retry once it is enabled."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Return a settlement surplus to the account holder
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/return-a-settlement-surplus-to-the-account-holder
  /balance-locks/{lock_id}/settle:
    post:
      description: |-
        Starts the return of the funds of one lock to the payer and moves the lock to `SETTLING`. With `pix_refund`, Pix Lerian cancels the ledger hold and sends a return (pacs.004) of the original transaction. With `pix_manual`, it commits the hold to the blocking account and pays one Pix (pacs.008) from there to the bank account that you give. To return every lock of the transaction in one devolution, use [Settle every MED balance lock of a Pix](/es/reference/interfaces/pix-lerian/spi/settle-every-cautionary-block-of-a-pix).

        The lock must be `PENDING` (`AWAITING_CREDIT` is refused with `409`, `PIX-0012`). `original_amount` is the amount of the received transaction: a higher amount, or a transaction that is not found, is refused with `422` (`PIX-0013`). The amount settled is the smallest of the requested amount, what is left to settle and the `effective_amount` of the lock. The call is idempotent by `refund_ref`: a `refund_ref` already bound to this lock, alone or with the other locks of its group settlement, replays this settle; one bound only to other locks is refused with `400` (`PIX-0003`). A lock whose surplus was already returned is refused with `409` (`PIX-0656`). A dispatch that fails without proof that the devolution was not sent (a timeout, a `5xx`) answers success, and the lock stays `SETTLING` until the outcome is confirmed. A `pix_manual` surplus is returned when the settlement is confirmed, not by this call.

        When the outcome is known, call [Confirm a MED balance lock settlement](/es/reference/interfaces/pix-lerian/spi/confirm-a-cautionary-block-settlement). For a lock opened for a MED infraction (`origin_system` `med-infraction`), use [Settle refund](/es/reference/interfaces/pix-lerian/dict/settle-refund) instead: DICT holds MED state that this route cannot see.
      operationId: createSettle
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Balance lock UUID
          in: path
          name: lock_id
          required: true
          schema:
            description: Balance lock UUID
            examples:
              - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
            type: string
      requestBody:
        content:
          application/json:
            examples:
              pixManual:
                summary: "pixManual: pay part of it to the payer's account (pacs.008); the rest is surplus"
                value:
                  refund_ref: med-2026-000123-devolution
                  original_amount: "150.75"
                  pix_manual:
                    ispb: "12345678"
                    branch: "0001"
                    account: "1234567"
                    account_type: CC
                    document: "12345678909"
                    amount: "80.13"
                    asset: BRL
                    description: MED devolution to the payer
              pixRefund:
                summary: "pixRefund: return the held amount as a devolution (pacs.004)"
                value:
                  refund_ref: med-2026-000123-devolution
                  original_amount: "150.75"
                  pix_refund:
                    return_reason_code: FR01
                    amount: "100.26"
                    asset: BRL
            schema:
              $ref: "#/components/schemas/CreateSettleBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                payment_type: PIX_MANUAL
                status: SETTLING
                original_amount: "150.75"
                requested_amount: "80.13"
                already_settled: "0"
                settle_amount: "80.13"
                surplus_amount: "20.13"
                initiated_at: "2026-10-27T14:05:12Z"
              schema:
                $ref: "#/components/schemas/CreateSettleResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0003
                title: Bad Request
                status: 400
                detail: Your request contains one or more fields with an invalid data type.
                code: PIX-0003
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Missing or invalid body fields, neither or both of pix_refund and pix_manual, a body that is not valid JSON, a lock_id that is not a UUID, or a refund_ref bound only to other locks (PIX-0002, PIX-0003, PIX-0010, PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too."
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0011
                title: Not Found
                status: 404
                detail: No entity was found for the given ID. Please make sure to use the correct ID.
                code: PIX-0011
              schema:
                $ref: "#/components/schemas/Detail"
          description: No lock exists for lock_id (PIX-0011).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0653
                title: Conflict
                status: 409
                detail: The balance lock's settlement is not final yet; retry once it is.
                code: PIX-0653
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The lock is RELEASED, SETTLED or AWAITING_CREDIT, has an unlock in progress, a pixRefund over a hold a pixManual settle already committed, a pixManual settle over a hold made in a blocking account other than the one configured now (unlock the lock), or a concurrent settle won (PIX-0012); the lock is SETTLING (PIX-0653); the lock already returned its surplus (PIX-0656). A cautelar block at a door that does not open it: unlock before it is due, close, a pixManual or partial pixRefund settle, a group settle (PIX-0651)."
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "415":
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: "The request body must be sent with Content-Type: application/json."
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0654
                title: Unprocessable Entity
                status: 422
                detail: There is nothing left to settle for this block.
                code: PIX-0654
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`original_amount` exceeds the received transaction, or that transaction is not found (`PIX-0013`). Nothing is left to settle (`PIX-0654`). A ledger account is blocked (`PIX-0328`), or a `pix_refund` debit leg holds no ledger balance (`PIX-0329`). The ledger refused the debit because the account is closed or its status forbids sending (`PIX-0332`), or because more than one fee package matches it (`PIX-0331`): nothing was debited. The ledger answer does not show the settled amount moved to the rail, so the order was not sent and Pix Lerian attempted to revert the debit (`PIX-0330`). A `pix_manual` settlement has no blocking account configured (`PIX-0650`) or an account has no ledger alias (`PIX-0655`). `PIX-0335`: the ledger refused the accounting route, so nothing was debited."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000).
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A ledger call failed, including a ledger refusal after an automatic retry, so the debit can stand and a lock can stay `SETTLING` (`PIX-0652`). When the detail names `overrides.allowFeeSkip` on a `pix_manual` settlement, the ledger refused the transfer out of the blocking account: settle again with `pix_manual` once the setting is on, or release the lock."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Settle a MED balance lock
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/settle-a-cautionary-block
  /balance-locks/{lock_id}/settle/confirm:
    post:
      description: |-
        Applies the outcome of the devolution that Settle a MED balance lock started: the lock becomes `SETTLED` when the devolution was paid, goes back to `PENDING` when it was rejected, and stays as it is while the devolution is in flight. The call carries no result, because Pix Lerian reads it from the devolution. Repeat the call until the lock leaves `SETTLING`.

        A `pix_manual` surplus is returned once, when the lock settles. If that return fails, the lock stays `SETTLED` and the answer is `200` without `surplus_midaz_tx_id`; this does not prove that the surplus stayed blocked. Check the ledger, then use [Return a settlement surplus to the account holder](/es/reference/interfaces/pix-lerian/spi/return-a-settlement-surplus-to-the-account-holder). A lock whose surplus was already returned is refused with `409` (`PIX-0656`) and stays `SETTLING`.

        `X-Actor-Id`, `X-Override-Reason` and `X-Override-Ticket` are optional. Sending any of them records the confirmation in the audit trail. For a lock opened for a MED infraction (`origin_system` `med-infraction`), use [Confirm settle refund](/es/reference/interfaces/pix-lerian/dict/confirm-settle-refund) instead: DICT holds MED state that this route cannot see.
      operationId: confirmSettle
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Balance lock UUID
          in: path
          name: lock_id
          required: true
          schema:
            description: Balance lock UUID
            examples:
              - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                lock_id: 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
                payment_type: PIX_MANUAL
                status: SETTLED
                pix_end_to_end_id: E87654321202610271405m3Hs7Yc5Pv1
                settled_at: "2026-10-27T14:06:03Z"
                surplus_midaz_tx_id: 01a17dae-b16e-7f28-9a03-6b1c4d8e2f75
              schema:
                $ref: "#/components/schemas/ConfirmSettleResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0015
                title: Bad Request
                status: 400
                detail: One or more path parameters are invalid.
                code: PIX-0015
              schema:
                $ref: "#/components/schemas/Detail"
          description: A duplicated or padded attribution header (PIX-0001), an oversized attribution header (PIX-0003), or a lock_id that is not a UUID (PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0011
                title: Not Found
                status: 404
                detail: No entity was found for the given ID. Please make sure to use the correct ID.
                code: PIX-0011
              schema:
                $ref: "#/components/schemas/Detail"
          description: No lock exists for lock_id (PIX-0011).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0012
                title: Conflict
                status: 409
                detail: The entity already exists or conflicts with an existing resource.
                code: PIX-0012
              schema:
                $ref: "#/components/schemas/Detail"
          description: The lock is PENDING or RELEASED, or a concurrent update won (PIX-0012); the payment was rejected but the lock or its settle group already returned the surplus (PIX-0656).
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0328
                title: Unprocessable Entity
                status: 422
                detail: The ledger account is blocked and cannot be used for the requested operation.
                code: PIX-0328
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A rejected pixRefund whose re-hold, or a completed devolution whose cancel of a left-behind re-hold, finds a blocked ledger account (PIX-0328); a rejected pixRefund whose re-hold finds a closed account or one whose status forbids sending (PIX-0332); a rejected pixRefund whose re-hold finds an account without a ledger alias (PIX-0655); no blocking account is configured for the participant (PIX-0650). The ledger refused the accounting route of a re-hold or of the cancel of a left-behind re-hold (PIX-0335)."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000). With attribution headers, the confirm may already have taken effect when the audit record fails.
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A completed devolution whose ledger search for, or cancel of, a left-behind re-hold failed, the lock staying SETTLING: repeat the confirm (PIX-0652). A rejected pixRefund whose re-hold failed in the ledger, or was refused after an automatic retry so it may stand (PIX-0652); with a detail naming overrides.allowFeeSkip, the lock stays SETTLING: repeat the confirm once it is enabled on the ledger that holds the blocking account."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Confirm a MED balance lock settlement
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/confirm-a-cautionary-block-settlement
  /balance-locks/{lock_id}/unlock:
    post:
      description: |-
        Gives the funds of the lock back to the account holder and moves the lock to `RELEASED`. Funds still on hold have their pending ledger hold cancelled. Funds that a rejected or failed `pix_manual` settlement already moved to the blocking account are transferred back to the account of the holder in one ledger transfer, reported as `release_midaz_tx_id`. A released lock cannot be settled.

        The lock must be `PENDING` or `AWAITING_CREDIT`. A `SETTLING` lock is refused with `409` (`PIX-0653`): confirm its settlement first. Any other status is refused with `409` (`PIX-0012`). An `AWAITING_CREDIT` lock holds nothing, so Pix Lerian releases it with no ledger call. A lock whose funds sit in the blocking account is refused with `409` (`PIX-0656`) when any surplus of its payment was already returned. A transfer that fails or whose outcome is unknown answers `502` (`PIX-0652`): retry the call. A retry is safe at any time and never transfers twice. A release that moved funds out of the blocking account is always recorded in the audit trail. For a lock opened for a MED infraction (`origin_system` `med-infraction`), use [Release a balance block on an infraction report](/es/reference/interfaces/pix-lerian/dict/release-a-balance-block-on-an-infraction-report) instead: DICT holds MED state that this route cannot see.
      operationId: unlockBalanceLock
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: Balance lock UUID
          in: path
          name: lock_id
          required: true
          schema:
            description: Balance lock UUID
            examples:
              - 01a17d06-7910-7b35-9f4e-1c8a2d6e3b57
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                holdCancelled:
                  summary: "Funds still on hold: the ledger hold is cancelled"
                  value:
                    lock_id: 01a17d06-7910-7b35-9f4e-1c8a2d6e3b57
                    status: RELEASED
                    released_at: "2026-10-27T11:15:30Z"
                transferredBack:
                  summary: "Funds in the blocking account: one ledger transfer back to the holder"
                  value:
                    lock_id: 01a17d06-7910-7b35-9f4e-1c8a2d6e3b57
                    status: RELEASED
                    released_at: "2026-10-27T17:42:18Z"
                    release_midaz_tx_id: 01a17e12-4c3b-7d61-8b2f-3e9a5c7d1f48
              schema:
                $ref: "#/components/schemas/UnlockBalanceResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0015
                title: Bad Request
                status: 400
                detail: One or more path parameters are invalid.
                code: PIX-0015
              schema:
                $ref: "#/components/schemas/Detail"
          description: A duplicated or padded attribution header (PIX-0001), an oversized attribution header (PIX-0003), or a lock_id that is not a UUID (PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0011
                title: Not Found
                status: 404
                detail: No entity was found for the given ID. Please make sure to use the correct ID.
                code: PIX-0011
              schema:
                $ref: "#/components/schemas/Detail"
          description: No lock exists for lock_id (PIX-0011).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0653
                title: Conflict
                status: 409
                detail: The balance lock's settlement is not final yet; retry once it is.
                code: PIX-0653
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The lock is SETTLED or was released by cancelling its hold, is AWAITING_CREDIT with a hold the transfer's credit route may be placing, a concurrent unlock's transfer was refused and left it as it was, or its hold changed after it was read: retry (PIX-0012); the lock is SETTLING (PIX-0653); its funds sit in the blocking account and a surplus was already returned for its payment (PIX-0656). A cautelar block at a door that does not open it: unlock before it is due, close, a pixManual or partial pixRefund settle, a group settle (PIX-0651)."
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0328
                title: Unprocessable Entity
                status: 422
                detail: The ledger account is blocked and cannot be used for the requested operation.
                code: PIX-0328
              schema:
                $ref: "#/components/schemas/Detail"
          description: "A ledger account is blocked, so the ledger refused to cancel the hold or the transfer back (PIX-0328); the account is closed or its status forbids receiving, so the ledger refused the transfer back and nothing moved (PIX-0332); on a lock whose funds sit in the blocking account, an account has no ledger alias (PIX-0655). The ledger refused the accounting route of the hold's cancel or of the transfer back: nothing moved (PIX-0335)."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: Unexpected server error (PIX-0000). With attribution headers, the release may already have taken effect when the audit record fails.
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0652
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0652
              schema:
                $ref: "#/components/schemas/Detail"
          description: "The ledger search for the lock's left-behind re-holds failed, the ledger did not cancel such a re-hold or the hold, could not read the hold or refused the transfer back to the holder after an automatic retry, or that transfer failed or has an unknown outcome, so it may have moved: retry the unlock, which never transfers twice (PIX-0652). With a detail naming overrides.allowFeeSkip, the ledger that holds the blocking account does not enable it, so nothing moved and the lock stays PENDING: retry the unlock once it is enabled."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Release a MED balance lock to the account holder
      tags:
        - Balance Locks
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/release-a-cautionary-block-to-the-account-holder
  /transfers/{id}/credit:
    post:
      description: |-
        Credits a received Pix that BACEN settled and whose ledger credit Pix Lerian parked. The transfer is `PROCESSING`, and the `inbound_transfer.credit_parked` event named it with its reason: the `id` of the event is `{id}`, and its `accountId` is `X-Account-Id`, which finds the transfer and does not authorize the call. On success the transfer is `COMPLETED`, and Pix Lerian sends `inbound_transfer.completed`. The request has no body.

        The call never credits twice, whoever calls it and however often. When the ledger already lists the credit, the call completes the transfer without posting a second credit (`200`). Otherwise it posts the credit only while the ledger still answers the idempotency key of every earlier attempt, or after the ledger refused every earlier attempt. In any other case it answers `409` (`PIX-0474`): the ledger cannot confirm the credit, the transfer stays parked, and the credit is reconciled by hand. Never credit by hand in the ledger outside that reconciliation.

        The reason of the event decides who calls it. `LEDGER_OUTCOME_UNKNOWN` and `SETTLE_INTERRUPTED`: call it right away, by a person or by automation. A credit whose outcome is unknown can be completed for 45 minutes after the park: call at once, and retry a `502` until then. `ACCOUNT_BLOCKED` and `LEDGER_REFUSED`: do not call it automatically. Fix the cause first (unblock the account, or fix the account, alias, balance, credentials or ledger configuration). The first call then parks the transfer again as `LEDGER_OUTCOME_UNKNOWN` and starts a one-way 45-minute clock.

        A ledger without `overrides.allowFeeSkip` refuses the fee skip that the credit requires (`502`, `PIX-0652`; the detail names the setting) and posts nothing. Call again within 45 minutes of the first refused call, once the setting is on: after that, the transfer falls to the `PIX-0474` reconciliation. The caller needs the `transfer-recovery` permission with the post action. It is tenant level, and only the editor role holds it. In BYOC, only the SPI permission declaration grants it: create the SPI M2M credential in Access Manager, then set `IDP_DECLARATION_ENABLED` to `true`. When MED blocks wait for the credit, the call posts the credit and their holds together.

        When Lerian SPI settles the integral return of the received Pix while its credit is parked, the credit call posts no new credit for it. If no credit can be in flight (`ACCOUNT_BLOCKED` or `LEDGER_REFUSED`), Pix Lerian closes the transfer as `FAILED` and releases the MED blocks that wait for the credit, and this call answers `409` (`PIX-0473`). If the credit can already stand, the transfer stays parked and this call posts nothing. When the ledger lists a credit, this call completes the transfer, but the payer already got that Pix back: reverse the credit. Otherwise it answers `409` (`PIX-0474`): reconcile it by hand. After a partial return, the credit call works as usual.
      operationId: creditParkedTransfer
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: "Transfer UUID: the id of the inbound_transfer.credit_parked event"
          in: path
          name: id
          required: true
          schema:
            description: "Transfer UUID: the id of the inbound_transfer.credit_parked event"
            examples:
              - 01a18811-6b64-7a10-b2c3-d4e5f6071829
            type: string
        - description: "The credited account UUID: the accountId of the inbound_transfer.credit_parked event. It finds the transfer; it does not authorize the call"
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: "The credited account UUID: the accountId of the inbound_transfer.credit_parked event. It finds the transfer; it does not authorize the call"
            examples:
              - 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                id: 01a18811-6b64-7a10-b2c3-d4e5f6071829
                accountId: 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
                endToEndId: E87654321202610291430AbCdEf12345
                status: COMPLETED
                type: INBOUND
                initiationType: DICT
                source:
                  account:
                    branch: "0001"
                    number: "1112223"
                    participant: "87654321"
                    type: CACC
                  owner:
                    document: "11144477735"
                    name: Maria Souza
                    type: NATURAL_PERSON
                destination:
                  account:
                    branch: "0001"
                    number: "9988776"
                    participant: "12345678"
                    type: CACC
                  owner:
                    document: "52998224725"
                    name: Joao Pereira
                    type: NATURAL_PERSON
                amount: "100.00"
                currency: BRL
                description: Pagamento de aluguel
                ledger:
                  transactionId: 01a18826-1aff-7d11-a2b3-c4d5e6f70819
                  sourceOperationId: 01a18826-1aff-7d12-a2b3-c4d5e6f7081a
                  destinationOperationId: 01a18826-1aff-7d13-a2b3-c4d5e6f7081b
                createdAt: "2026-10-29T14:30:05.412Z"
                updatedAt: "2026-10-29T14:52:41.087Z"
                alreadyRefundedAmount: "0.00"
                remainingRefundableAmount: "100.00"
              schema:
                $ref: "#/components/schemas/TransferResponse"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0001
                title: Bad Request
                status: 400
                detail: Your request is missing one or more required header params.
                code: PIX-0001
              schema:
                $ref: "#/components/schemas/Detail"
          description: A missing (PIX-0001) or malformed (PIX-0017) X-Account-Id, a transfer id that is not a UUID (PIX-0015), or an attribution header over its length limit (PIX-0003). A duplicated or padded X-Account-Id or attribution header (PIX-0001). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0340
                title: Not Found
                status: 404
                detail: Transfer ID does not exist for this organization.
                code: PIX-0340
              schema:
                $ref: "#/components/schemas/Detail"
          description: No transfer with this id credits the X-Account-Id account (PIX-0340).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0474
                title: Conflict
                status: 409
                detail: The ledger cannot confirm this credit; reconcile it by hand.
                code: PIX-0474
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`PIX-0473`: not a parked inbound transfer, or a transfer that Pix Lerian closed as `FAILED` because the rail returned the Pix to the payer. `PIX-0474`: the ledger cannot confirm the credit, so the transfer stays parked and the credit is reconciled by hand."
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0328
                title: Unprocessable Entity
                status: 422
                detail: The ledger account is blocked and cannot be used for the requested operation.
                code: PIX-0328
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`PIX-0328`: the credited ledger account is blocked, and the transfer stays parked as `LEDGER_OUTCOME_UNKNOWN`: unblock it and retry within 45 minutes. `PIX-0475`: the ledger refused the credit for a cause that a retry does not clear (an account status that forbids receiving, a closed account, a usage limit, a missing alias, balance, asset, ledger or organization, a missing accounting route; a refused accounting route can also be the hold of a MED block that waits for the credit, after the credit posted), and the transfer stays parked: fix the cause, then retry within 45 minutes. A closed account is final: no call credits it. When MED blocks wait for the credit, a refusal of the credit or of the hold of a block (`PIX-0013`, `PIX-0328`, `PIX-0329`, `PIX-0650`, `PIX-0655`) leaves the transfer parked: fix the cause, then call again."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Unexpected server error, a concurrent call posting the payment's blocks, a listed credit whose MED batch hold the ledger does not list yet, or a ledger configuration that did not load for the only send of a MED batch, which parks the transfer refused again (PIX-0000). The transfer is parked or already COMPLETED: call again."
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0472
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0472
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`PIX-0472`: the ledger was unreachable, refused the credentials, failed the search or the post, or refused the post on a balance that another write moved; the transfer stays parked: retry within the 45-minute window, after you fix the credentials when the ledger refused them. `PIX-0652`: the ledger refused the fee skip (the detail names `overrides.allowFeeSkip`), or failed while posting the hold of a MED block that waits for the credit: call again within 45 minutes of the first refused call, once the setting is on when the detail names it."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Credit a received Pix whose ledger credit is parked
      tags:
        - Transfers
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/credit-a-received-pix-whose-ledger-credit-is-parked
  /refunds/{id}/credit:
    post:
      description: |-
        Credits a received Pix refund (a devolução that your institution received) that BACEN settled and whose ledger credit to the account of the original sender Pix Lerian parked. The refund is `PROCESSING`, and the `refund.credit_parked` event named it with its reason: the `id` of the event is `{id}`, and its `accountId` is `X-Account-Id`, which finds the refund and does not authorize the call. On success the refund is `COMPLETED`, and Pix Lerian sends `refund.completed`. The request has no body.

        The call never credits twice, whoever calls it and however often. When the ledger already lists the credit, the call completes the refund without posting a second credit (`200`). Otherwise it posts the credit only while the ledger still answers the idempotency key of every earlier attempt, or after the ledger refused every earlier attempt. In any other case it answers `409` (`PIX-0474`): the ledger cannot confirm the credit, the refund stays parked, and the credit is reconciled by hand. Never credit by hand in the ledger outside that reconciliation.

        The reason of the event decides who calls it. `LEDGER_OUTCOME_UNKNOWN` and `SETTLE_INTERRUPTED`: call it right away, by a person or by automation. A credit whose outcome is unknown can be completed for 45 minutes after the park: call at once, and retry a `502` until then. `ACCOUNT_BLOCKED` and `LEDGER_REFUSED`: do not call it automatically. Fix the cause first (unblock the account, or fix the account, alias, balance, credentials or ledger configuration). The first call then parks the refund again as `LEDGER_OUTCOME_UNKNOWN` and starts a one-way 45-minute clock.

        A ledger without `overrides.allowFeeSkip` refuses the fee skip that the credit requires (`502`, `PIX-0652`; the detail names the setting) and posts nothing. Call again within 45 minutes of the first refused call, once the setting is on: after that, the refund falls to the `PIX-0474` reconciliation. The caller needs the `refund-recovery` permission with the post action. It is tenant level, and only the editor role holds it. In BYOC, only the SPI permission declaration grants it: create the SPI M2M credential in Access Manager, then set `IDP_DECLARATION_ENABLED` to `true`.
      operationId: creditParkedRefund
      parameters:
        - description: "REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412."
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: "Refund UUID: the id of the refund.credit_parked event"
          in: path
          name: id
          required: true
          schema:
            description: "Refund UUID: the id of the refund.credit_parked event"
            examples:
              - 019a3c41-7e2b-7d10-9c4a-5b6e7f805678
            type: string
        - description: "The credited account UUID: the accountId of the refund.credit_parked event (the original payment's source account). It finds the refund; it does not authorize the call"
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: "The credited account UUID: the accountId of the refund.credit_parked event (the original payment's source account). It finds the refund; it does not authorize the call"
            examples:
              - 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
            type: string
        - description: Who is acting. Declared by the caller; not verified against the access token
          in: header
          name: X-Actor-Id
          schema:
            description: Who is acting. Declared by the caller; not verified against the access token
            examples:
              - backoffice.ops@example.com
            type: string
        - description: Why the caller is acting
          in: header
          name: X-Override-Reason
          schema:
            description: Why the caller is acting
            examples:
              - manual devolution paid by Pix
            type: string
        - description: Ticket reference
          in: header
          name: X-Override-Ticket
          schema:
            description: Ticket reference
            examples:
              - MED-4821
            type: string
        - description: Correlation id
          in: header
          name: X-Correlation-Id
          schema:
            description: Correlation id
            examples:
              - med-2026-000123
            type: string
        - description: Request id
          in: header
          name: X-Request-Id
          schema:
            description: Request id
            examples:
              - 01a17e29-5302-7c0a-b5e1-94d2f6a83c17
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                id: 019a3c41-7e2b-7d10-9c4a-5b6e7f805678
                accountId: 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
                originalEndToEndId: E12345678202610281015AbCdEf12345
                returnEndToEndId: D87654321202610291430FeDcBa54321
                status: COMPLETED
                type: INBOUND
                amount: "40.00"
                reasonCode: MD06
                description: Valor enviado em duplicidade
                ledger:
                  transactionId: 019a3c52-1aff-7d11-a2b3-c4d5e6f70819
                  sourceOperationId: 019a3c52-1aff-7d12-a2b3-c4d5e6f7081a
                  destinationOperationId: 019a3c52-1aff-7d13-a2b3-c4d5e6f7081b
                createdAt: "2026-10-29T14:30:05.412Z"
                updatedAt: "2026-10-29T14:52:41.087Z"
              schema:
                $ref: "#/components/schemas/RefundCashoutOutput"
          description: OK
        "400":
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0001
                title: Bad Request
                status: 400
                detail: Your request is missing one or more required header params.
                code: PIX-0001
              schema:
                $ref: "#/components/schemas/Detail"
          description: A missing (PIX-0001) or malformed (PIX-0017) X-Account-Id, a refund id that is not a UUID (PIX-0015), or an attribution header over its length limit (PIX-0003). A duplicated or padded X-Account-Id or attribution header (PIX-0001). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope too.
        "404":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0420
                title: Not Found
                status: 404
                detail: Refund ID does not exist for this organization.
                code: PIX-0420
              schema:
                $ref: "#/components/schemas/Detail"
          description: No refund with this id credits the X-Account-Id account (PIX-0420).
        "409":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0474
                title: Conflict
                status: 409
                detail: The ledger cannot confirm this credit; reconcile it by hand.
                code: PIX-0474
              schema:
                $ref: "#/components/schemas/Detail"
          description: '`PIX-0523`: not a parked inbound refund. `PIX-0474`: the ledger cannot confirm the credit, so the refund stays parked and the credit is reconciled by hand.'
        "412":
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
          description: "Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json."
        "422":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0328
                title: Unprocessable Entity
                status: 422
                detail: The ledger account is blocked and cannot be used for the requested operation.
                code: PIX-0328
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`PIX-0328`: the credited ledger account is blocked, and the refund stays parked as `LEDGER_OUTCOME_UNKNOWN`: unblock it and retry within 45 minutes. `PIX-0475`: the ledger refused the credit for a cause that a retry does not clear (an account status that forbids receiving, a closed account, a usage limit, a missing alias, balance, asset, ledger or organization, a missing accounting route), and the refund stays parked: fix the cause, then retry within 45 minutes. A closed account, or one without an alias, is final: no call credits it."
        "500":
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: "#/components/schemas/LegacyErrorEnvelope"
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: "#/components/schemas/Detail"
          description: "Unexpected server error (PIX-0000). The refund is parked or already COMPLETED: call again."
        "502":
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0522
                title: Bad Gateway
                status: 502
                detail: The server could not complete the request. Please try again later.
                code: PIX-0522
              schema:
                $ref: "#/components/schemas/Detail"
          description: "`PIX-0522`: the ledger was unreachable, refused the credentials, failed the search or the post, or refused the post on a balance that another write moved; the refund stays parked: retry within the 45-minute window, after you fix the credentials when the ledger refused them. `PIX-0652`: a ledger without `overrides.allowFeeSkip` refuses the fee skip that the credit requires and posts nothing: call again within 45 minutes of the first refused call, once the setting is on."
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      summary: Credit a received Pix refund whose ledger credit is parked
      tags:
        - Refunds
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/credit-a-received-pix-refund-whose-ledger-credit-is-parked
  /transfers/{id}/cancel:
    post:
      description: 'The payer cancels a sent Pix that Pix Lerian holds in fraud analysis (status `FRAUD_ANALYSIS`, announced by the `outbound_transfer.fraud_analysis` event). Pix Lerian reverses the debit, returns the usage limit, and closes the transfer `REJECTED` with `fraudCheck.resolution` `CANCELLED`. The `outbound_transfer.rejected` event announces it. The request has no body.


        `X-Account-Id` is the paying account. Send a new `X-Idempotency` value for each attempt. A repeat of the same value answers the original `200`.


        A `404` (`PIX-0340`) means that this account sent no transfer with this id. A `409` (`PIX-0339`) means that the transfer is not held in analysis: it was never held, or its analysis already ended by a cancel, a decision or the deadline. Read the transfer for its state. A `500` (`PIX-0000`) means that Pix Lerian has not recorded the debit reversal yet. The cancel is taken: read the transfer, which is `PENDING` with `fraudCheck.resolution` `CANCELLED`, or already `REJECTED`. A new cancel answers `409`.'
      operationId: cancelFraudAnalysis
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: 'Transfer UUID: the id of the outbound_transfer.fraud_analysis event'
          in: path
          name: id
          required: true
          schema:
            description: 'Transfer UUID: the id of the outbound_transfer.fraud_analysis event'
            examples:
              - 01a18811-6b64-7a10-b2c3-d4e5f6071829
            type: string
        - description: 'The paying account UUID: the accountId of the outbound_transfer.fraud_analysis event'
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: 'The paying account UUID: the accountId of the outbound_transfer.fraud_analysis event'
            examples:
              - 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
            type: string
      responses:
        '200':
          content:
            application/json:
              example:
                id: 01a18811-6b64-7a10-b2c3-d4e5f6071829
                accountId: 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
                endToEndId: E12345678202611181400AbCdEf12345
                status: REJECTED
                type: OUTBOUND
                initiationType: DICT
                source:
                  account:
                    branch: '0001'
                    number: '9988776'
                    participant: '12345678'
                    type: CACC
                  owner:
                    document: '52998224725'
                    name: Joao Pereira
                    type: NATURAL_PERSON
                destination:
                  account:
                    branch: '0001'
                    number: '1112223'
                    participant: '87654321'
                    type: CACC
                  owner:
                    document: '11144477735'
                    name: Maria Souza
                    type: NATURAL_PERSON
                amount: '100.17'
                currency: BRL
                fraudCheck:
                  decision: REVIEW
                  origin: PROVIDER
                  analysisId: an-7f3a
                  decideBy: '2026-11-18T14:30:00Z'
                  resolution: CANCELLED
                ledger:
                  transactionId: 01a18826-1aff-7d11-a2b3-c4d5e6f70819
                  revert:
                    transactionId: 01a18826-9c20-7e41-b2c3-d4e5f6071a2b
                createdAt: '2026-11-18T14:00:05.412Z'
                updatedAt: '2026-11-18T14:12:41.087Z'
              schema:
                $ref: '#/components/schemas/TransferResponse'
          description: OK
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0001
                title: Bad Request
                status: 400
                detail: Your request is missing one or more required header params.
                code: PIX-0001
              schema:
                $ref: '#/components/schemas/Detail'
          description: A missing (PIX-0001) or malformed (PIX-0017) X-Account-Id, or a transfer id that is not a UUID (PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0001) answer in the legacy {code,title,message} envelope too.
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          description: 'The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '404':
          content:
            application/json:
              example:
                code: TENANT_NOT_FOUND
                title: Tenant Not Found
                message: 'tenant not found: 019606a1-3b4c-7d8e-9f01-234567890abc'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0340
                title: Not Found
                status: 404
                detail: Transfer ID does not exist for this organization.
                code: PIX-0340
              schema:
                $ref: '#/components/schemas/Detail'
          description: No transfer with this id was sent by the X-Account-Id account (PIX-0340). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '409':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0339
                title: Conflict
                status: 409
                detail: 'The transfer is not held in fraud analysis: it was never held, its analysis already ended (cancelled, expired or decided), or the call names another analysis. GET the transfer for its current state.'
                code: PIX-0339
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The transfer is not held in fraud analysis: it was never held, or its analysis already ended by a cancel, the deadline or a decision (PIX-0339).'
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Unexpected server error, or the debit reversal is not recorded yet (PIX-0000). The cancel is taken once the transfer is PENDING with fraudCheck.resolution CANCELLED, or REJECTED: GET the transfer; Pix Lerian closes it REJECTED. The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Cancel a sent Pix held in fraud analysis
      tags:
        - Transfers
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/cancel-a-sent-pix-held-in-fraud-analysis
  /transfers/{id}/fraud-decision:
    post:
      description: 'The antifraud partner, through the client''s M2M application, or a person of the client, decides a sent Pix that Pix Lerian holds in fraud analysis (status `FRAUD_ANALYSIS`, announced by the `outbound_transfer.fraud_analysis` event).


        `ALLOW` sends the Pix as a normal payment. `DENY` reverses the debit, returns the usage limit, and closes the transfer `REJECTED`. The first final decision wins. The record shows who decided: `fraudCheck.resolutionOrigin` is `PARTNER` or `OPERATOR`, and `fraudCheck.resolvedBy` is the subject of the token. A person of the client must send a `justification` of 10 to 500 characters. Pix Lerian never returns it and never publishes it in an event.


        A `200` with `PROCESSING` is an `ALLOW` taken. A `200` with `REJECTED` is a `DENY` taken, or an `ALLOW` whose order the rail refused or never received: the debit is reversed and `fraudCheck.resolution` stays `ALLOW`. A repeat of a decision already taken answers `200` with the transfer as it stands.


        A `404` (`PIX-0340`) means that the tenant has no such sent transfer. A `409` (`PIX-0339`) means that the transfer is not held in analysis, that another decision, the payer''s cancel or the deadline ended it first, or that `analysisId` names another analysis. A `409` (`PIX-0344`) means an `ALLOW` after `decideBy`: a `DENY` is still accepted. A `422` (`PIX-0343`) means that the body is outside the contract, or that a person sent no `justification`. A `503` (`PIX-0345`) means that Pix Lerian is still recording the hold: retry after the `Retry-After` time. A `500` (`PIX-0000`) means either that a `DENY` has no recorded debit reversal yet, so the decision is taken and Pix Lerian closes the transfer `REJECTED`, or that nothing changed and the same call can repeat.'
      operationId: decideFraudAnalysis
      parameters:
        - description: 'Transfer UUID: the id of the outbound_transfer.fraud_analysis event, which the antifraud partner also holds as the key of its evaluation'
          in: path
          name: id
          required: true
          schema:
            description: 'Transfer UUID: the id of the outbound_transfer.fraud_analysis event, which the antifraud partner also holds as the key of its evaluation'
            examples:
              - 01a18811-6b64-7a10-b2c3-d4e5f6071829
            type: string
      requestBody:
        content:
          application/json:
            examples: {}
            schema:
              $ref: '#/components/schemas/FraudDecisionBody'
      responses:
        '200':
          content:
            application/json:
              example:
                id: 01a18811-6b64-7a10-b2c3-d4e5f6071829
                accountId: 019cadd4-5620-7c2d-8e3f-4a5b6c7d8e9f
                endToEndId: E12345678202611181400AbCdEf12345
                status: REJECTED
                type: OUTBOUND
                initiationType: DICT
                source:
                  account:
                    branch: '0001'
                    number: '9988776'
                    participant: '12345678'
                    type: CACC
                  owner:
                    document: '52998224725'
                    name: Joao Pereira
                    type: NATURAL_PERSON
                destination:
                  account:
                    branch: '0001'
                    number: '1112223'
                    participant: '87654321'
                    type: CACC
                  owner:
                    document: '11144477735'
                    name: Maria Souza
                    type: NATURAL_PERSON
                amount: '100.17'
                currency: BRL
                fraudCheck:
                  decision: REVIEW
                  origin: PROVIDER
                  analysisId: an-7f3a
                  decideBy: '2026-11-18T14:30:00Z'
                  resolution: DENY
                  resolutionOrigin: OPERATOR
                  resolvedBy: user-1
                ledger:
                  transactionId: 01a18826-1aff-7d11-a2b3-c4d5e6f70819
                  revert:
                    transactionId: 01a18826-9c20-7e41-b2c3-d4e5f6071a2b
                createdAt: '2026-11-18T14:00:05.412Z'
                updatedAt: '2026-11-18T14:12:41.087Z'
              schema:
                $ref: '#/components/schemas/TransferResponse'
          description: OK
        '400':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0015
                title: Bad Request
                status: 400
                detail: One or more path parameters are invalid.
                code: PIX-0015
              schema:
                $ref: '#/components/schemas/Detail'
          description: A transfer id that is not a UUID (PIX-0015).
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          description: 'The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '404':
          content:
            application/json:
              example:
                code: TENANT_NOT_FOUND
                title: Tenant Not Found
                message: 'tenant not found: 019606a1-3b4c-7d8e-9f01-234567890abc'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0340
                title: Not Found
                status: 404
                detail: Transfer ID does not exist for this organization.
                code: PIX-0340
              schema:
                $ref: '#/components/schemas/Detail'
          description: No sent transfer with this id exists for the tenant (PIX-0340). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '409':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0339
                title: Conflict
                status: 409
                detail: 'The transfer is not held in fraud analysis: it was never held, its analysis already ended (cancelled, expired or decided), or the call names another analysis. GET the transfer for its current state.'
                code: PIX-0339
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The transfer is not held in fraud analysis: it was never held, its analysis already ended by another decision, the payer''s cancel or the deadline, or the call names another analysis (PIX-0339); or an ALLOW after decideBy, after which Pix Lerian reverses the debit and closes the transfer REJECTED (PIX-0344).'
        '422':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0343
                title: Unprocessable Entity
                status: 422
                detail: 'The decision is not valid: it needs analysisId and decision ALLOW or DENY, in a body within 16 KiB, and a person of the client also needs a justification of 10 to 500 characters.'
                code: PIX-0343
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'A body outside the contract: no analysisId, a decision that is not ALLOW or DENY, more than 16 KiB; or a person of the client without a justification of 10 to 500 characters (PIX-0343).'
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: The server could not complete the request. Please try again later.
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Unexpected server error, or a DENY whose debit reversal is not recorded yet (PIX-0000). The decision is taken once the transfer is PENDING with fraudCheck.resolution DENY, or REJECTED: GET the transfer; Pix Lerian closes it REJECTED. The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        '503':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0345
                title: Service Unavailable
                status: 503
                detail: The server could not complete the request. Please try again later.
                code: PIX-0345
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The hold is still being recorded by the request that created it: retry after Retry-After seconds (PIX-0345). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Decide a sent Pix held in fraud analysis
      tags:
        - Transfers
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/decide-a-sent-pix-held-in-fraud-analysis
  /regulatory/apix001/report:
    get:
      description: 'Returns the current report of the month in the `period` query parameter: the ten blocks of the APIX001 layout for the ISPB of the tenant, in layout order and with the fixed rows of the layout, zero rows included. Every indicator and block carries `coverage`, so a `0.00` that is a filler is never read as a measured zero. A block that Pix Lerian does not compute comes back `UNAVAILABLE` with a reason, never omitted. A time indicator is in seconds, except `maxCautionaryBlockTime`, in hours.


        A month never closed, or reopened and not closed again, answers `404` (`PIX-0711`): close it first. A future month answers `422` (`PIX-0710`). A `period` that is absent or not `YYYY-MM` answers `400` (`PIX-0020`), and a month before 2020-11 answers `400` (`PIX-0003`). The month state is read on the read replica, and on the primary when none is configured, so a reopen or a new close is visible once the replica has applied it. The close response already carries the report.'
      operationId: getApix001Report
      parameters:
        - description: Reference month, YYYY-MM. Absent or not YYYY-MM is 400 PIX-0020; a month before 2020-11, when Pix started, is 400 PIX-0003; a month in the future is 422 PIX-0710.
          explode: false
          in: query
          name: period
          required: true
          schema:
            description: Reference month, YYYY-MM. Absent or not YYYY-MM is 400 PIX-0020; a month before 2020-11, when Pix started, is 400 PIX-0003; a month in the future is 422 PIX-0710.
            examples:
              - 2026-10
            pattern: ^[0-9]{4}-(0[1-9]|1[0-2])$
            type: string
      responses:
        '200':
          content:
            application/json:
              example:
                reportId: 0193a6f0-7c1e-7b4a-9d2e-5f6a7b8c9d0e
                period: 2026-10
                ispb: '12345678'
                layoutVersion: '2.7'
                blocks:
                  transactions:
                    rows:
                      - transactionDetail: 5
                        transactionPurpose: 1
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 5
                        transactionPurpose: 2
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 5
                        transactionPurpose: 3
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 5
                        transactionPurpose: 4
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 1
                        transactionCount: 1
                        transactionAmount: '150.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 2
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 3
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 4
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 1
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 2
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 3
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 4
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                    detailCoverage:
                      - transactionDetail: 5
                        coverage:
                          status: NOT_APPLICABLE
                          reason: no indirect participant declaration valid in the month
                      - transactionDetail: 6
                        coverage:
                          status: COMPLETE
                      - transactionDetail: 7
                        coverage:
                          status: UNAVAILABLE
                          reason: no outbound fraud refusal informed for the month
                  refunds:
                    rows:
                      - refundDetail: 1
                        refundCount: 0
                        refundAmount: '0.00'
                      - refundDetail: 2
                        refundCount: 1
                        refundAmount: '89.90'
                    coverage:
                      status: COMPLETE
                  cautionaryBlocks:
                    rows:
                      - cautionaryBlockDetail: 1
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                      - cautionaryBlockDetail: 2
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                      - cautionaryBlockDetail: 3
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                      - cautionaryBlockDetail: 4
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
                  revenues:
                    rows:
                      - revenueSource: 1
                        revenueAmount: '0.00'
                      - revenueSource: 2
                        revenueAmount: '0.00'
                      - revenueSource: 3
                        revenueAmount: '0.00'
                      - revenueSource: 4
                        revenueAmount: '0.00'
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
                  transactionTimes:
                    p50SpiUserExperienceTime:
                      value: '2.84'
                      coverage:
                        status: PARTIAL
                        reason: measured from the client call to the result delivery; ends before t6a (Manual de Tempos v7.0 4.1.2)
                    p99SpiUserExperienceTime:
                      value: '7.91'
                      coverage:
                        status: PARTIAL
                        reason: measured from the client call to the result delivery; ends before t6a (Manual de Tempos v7.0 4.1.2)
                    p50OutsideSpiUserExperienceTime:
                      value: '1.37'
                      coverage:
                        status: COMPLETE
                    p99OutsideSpiUserExperienceTime:
                      value: '1.37'
                      coverage:
                        status: COMPLETE
                    maxCautionaryBlockTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                  dictTimes:
                    p99KeyLookupTime:
                      value: '0.42'
                      coverage:
                        status: PARTIAL
                        reason: 'lower bound: only the DICT hub call inside the initiate is measured, not the participant channel nor the rest of the initiate; a key lookup the client makes before the initiate is not seen; lookups that failed technically (timeout, connection, 5xx) are left out; negative answers are not measured; Pix Agendado key lookups are not measured'
                    p95KeyRegistrationCodeSendTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95KeyRegistrationUserExperienceTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95KeyDeletionUserExperienceTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95PortabilityNotificationTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95PortabilitySendTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95MedOpeningTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                  dictLookups:
                    lookupCount: 48210
                    coverage:
                      status: PARTIAL
                      reason: a key lookup the client makes before the initiate is not seen; negative answers are not measured; Pix Agendado key lookups are not measured
                  availability:
                    availabilityIndex: '0.00'
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
                  authorizationTimes:
                    p95AuthorizationTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                  authorizations:
                    rows:
                      - payerType: 1
                        authorizationCount: 0
                        activeAuthorizationCount: 0
                      - payerType: 2
                        authorizationCount: 0
                        activeAuthorizationCount: 0
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
              schema:
                $ref: '#/components/schemas/ApixReport'
          description: OK
        '400':
          content:
            application/problem+json:
              examples:
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    code: PIX-0003
                PIX-0020:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0020
                    title: Bad Request
                    status: 400
                    detail: One or more query parameters are in an incorrect format.
                    errors:
                      - message: period does not match the 2006-01 format
                        location: period
                    code: PIX-0020
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`period` absent or not YYYY-MM (PIX-0020), or a month before 2020-11, when Pix started (PIX-0003).'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          description: 'The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '404':
          content:
            application/json:
              example:
                code: TENANT_NOT_FOUND
                title: Tenant Not Found
                message: 'tenant not found: 019606a1-3b4c-7d8e-9f01-234567890abc'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0711:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0711
                    title: Not Found
                    status: 404
                    detail: The month has no closed report. Close it first.
                    code: PIX-0711
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The month has no current report: it was never closed, or it was reopened and not closed again (PIX-0711). Close it, then read it. The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0710:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0710
                    title: Unprocessable Entity
                    status: 422
                    detail: The reference month has not started.
                    code: PIX-0710
              schema:
                $ref: '#/components/schemas/Detail'
          description: The reference month is in the future (PIX-0710).
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '503':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0062:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0062
                    title: Service Unavailable
                    status: 503
                    detail: A dependency of this service is temporarily unavailable. Retry as the route's guidance for an unknown outcome says.
                    code: PIX-0062
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The month or its report could not be read: the read replica, or the primary it falls back to, is unreachable (PIX-0062). Nothing changed; send the request again. The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.'
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Get the APIX001 report of a closed reference month
      tags:
        - APIX001 Reports
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/get-the-apix001-report-of-a-closed-reference-month
  /regulatory/apix001/close:
    post:
      description: 'Closes a month that has ended and freezes its result as an immutable report, which the call returns.


        The close fixes a cutoff 60 seconds or more before it runs, and it reads the read replica when one is configured, and the primary otherwise. The replica must be a physical standby of the SPI database. A node that is not in recovery answers `503` (`PIX-0727`) before anything is claimed. A replica that has not applied every commit up to the cutoff answers `503` (`PIX-0715`) with `Retry-After`, and nothing is frozen. The report leaves out a fact, a correction or a declaration recorded after the cutoff, and it counts only after a reopen and a new close.


        `transactions` comes from the settlements outside SPI and the outbound fraud refusals that you recorded as facts, each settlement classified by the declarations in force at the cutoff. `refunds` comes from the refunds outside SPI that you recorded as facts, and it is `UNAVAILABLE` when the month has none. `transactionTimes` comes from the SPI transfers and the settlements that the tenant paid. `dictLookups` and the `p99KeyLookupTime` indicator come from the key lookups recorded on key and QR code initiations, and their coverage is always `PARTIAL` or `UNAVAILABLE`. Every other block and indicator is `UNAVAILABLE` with its reason.


        Only a past month can be closed. A future month answers `422` (`PIX-0710`) and the current month answers `422` (`PIX-0713`). A month already closed answers its current report with `200`. A close under another `X-Idempotency` key while one runs, or a resend while the claim of an earlier failed attempt holds, answers `409` (`PIX-0712`) with `Retry-After`. Each serving instance computes one close for each tenant at a time, and each database one close at a time. When no slot is free, the route answers `429` (`PIX-0006`) with `Retry-After` before it claims anything. The month goes in the `period` of the body. An absent `period` answers `400` (`PIX-0002`). A `period` that is not `YYYY-MM`, or is before 2020-11, answers `400` (`PIX-0003`).'
      operationId: closeApix001Period
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            examples: {}
            schema:
              $ref: '#/components/schemas/ApixPeriodBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                reportId: 0193a6f0-7c1e-7b4a-9d2e-5f6a7b8c9d0e
                period: 2026-10
                ispb: '12345678'
                layoutVersion: '2.7'
                blocks:
                  transactions:
                    rows:
                      - transactionDetail: 5
                        transactionPurpose: 1
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 5
                        transactionPurpose: 2
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 5
                        transactionPurpose: 3
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 5
                        transactionPurpose: 4
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 1
                        transactionCount: 1
                        transactionAmount: '150.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 2
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 3
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 6
                        transactionPurpose: 4
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 1
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 2
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 3
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                      - transactionDetail: 7
                        transactionPurpose: 4
                        transactionCount: 0
                        transactionAmount: '0.00'
                        cashAmount: '0.00'
                    detailCoverage:
                      - transactionDetail: 5
                        coverage:
                          status: NOT_APPLICABLE
                          reason: no indirect participant declaration valid in the month
                      - transactionDetail: 6
                        coverage:
                          status: COMPLETE
                      - transactionDetail: 7
                        coverage:
                          status: UNAVAILABLE
                          reason: no outbound fraud refusal informed for the month
                  refunds:
                    rows:
                      - refundDetail: 1
                        refundCount: 0
                        refundAmount: '0.00'
                      - refundDetail: 2
                        refundCount: 1
                        refundAmount: '89.90'
                    coverage:
                      status: COMPLETE
                  cautionaryBlocks:
                    rows:
                      - cautionaryBlockDetail: 1
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                      - cautionaryBlockDetail: 2
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                      - cautionaryBlockDetail: 3
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                      - cautionaryBlockDetail: 4
                        cautionaryBlockCount: 0
                        cautionaryBlockAmount: '0.00'
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
                  revenues:
                    rows:
                      - revenueSource: 1
                        revenueAmount: '0.00'
                      - revenueSource: 2
                        revenueAmount: '0.00'
                      - revenueSource: 3
                        revenueAmount: '0.00'
                      - revenueSource: 4
                        revenueAmount: '0.00'
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
                  transactionTimes:
                    p50SpiUserExperienceTime:
                      value: '2.84'
                      coverage:
                        status: PARTIAL
                        reason: measured from the client call to the result delivery; ends before t6a (Manual de Tempos v7.0 4.1.2)
                    p99SpiUserExperienceTime:
                      value: '7.91'
                      coverage:
                        status: PARTIAL
                        reason: measured from the client call to the result delivery; ends before t6a (Manual de Tempos v7.0 4.1.2)
                    p50OutsideSpiUserExperienceTime:
                      value: '1.37'
                      coverage:
                        status: COMPLETE
                    p99OutsideSpiUserExperienceTime:
                      value: '1.37'
                      coverage:
                        status: COMPLETE
                    maxCautionaryBlockTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                  dictTimes:
                    p99KeyLookupTime:
                      value: '0.42'
                      coverage:
                        status: PARTIAL
                        reason: 'lower bound: only the DICT hub call inside the initiate is measured, not the participant channel nor the rest of the initiate; a key lookup the client makes before the initiate is not seen; lookups that failed technically (timeout, connection, 5xx) are left out; negative answers are not measured; Pix Agendado key lookups are not measured'
                    p95KeyRegistrationCodeSendTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95KeyRegistrationUserExperienceTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95KeyDeletionUserExperienceTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95PortabilityNotificationTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95PortabilitySendTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                    p95MedOpeningTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                  dictLookups:
                    lookupCount: 48210
                    coverage:
                      status: PARTIAL
                      reason: a key lookup the client makes before the initiate is not seen; negative answers are not measured; Pix Agendado key lookups are not measured
                  availability:
                    availabilityIndex: '0.00'
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
                  authorizationTimes:
                    p95AuthorizationTime:
                      value: '0.00'
                      coverage:
                        status: UNAVAILABLE
                        reason: not computed by Pix Lerian
                  authorizations:
                    rows:
                      - payerType: 1
                        authorizationCount: 0
                        activeAuthorizationCount: 0
                      - payerType: 2
                        authorizationCount: 0
                        activeAuthorizationCount: 0
                    coverage:
                      status: UNAVAILABLE
                      reason: not computed by Pix Lerian
              schema:
                $ref: '#/components/schemas/ApixReport'
          description: OK
          headers:
            X-Idempotency-Fenced:
              description: 'Present only when the request committed but its receipt could not be stored. true: a resend under the key within the hour is 412 PIX-0031, so read the resource instead. false: a resend under the key may run again.'
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
            X-Idempotency-Replayed:
              description: true when the idempotency gate answered from the receipt of an earlier request under the same X-Idempotency; absent on a first execution.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0002:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: period is a required field
                        location: period
                    code: PIX-0002
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: period does not match the 2006-01 format
                        location: period
                    code: PIX-0003
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`period` absent (PIX-0002), or not YYYY-MM or before 2020-11, when Pix started (PIX-0003). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          content:
            application/problem+json:
              examples:
                PIX-0005:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0005
                    title: Forbidden
                    status: 403
                    detail: You do not have permission to perform this operation.
                    errors:
                      - message: the token names no identity lib-auth can attribute; an operator conclusion records who concluded, so it requires one
                        location: principal
                    code: PIX-0005
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'With authorization on, a token that names no identity that Access Manager can attribute (PIX-0005, errors[] at principal): each report version records who closed or reopened the month, so nothing was read or written. The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '409':
          content:
            application/problem+json:
              examples:
                PIX-0712:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0712
                    title: Conflict
                    status: 409
                    detail: Another close of this month is running. Read the month again shortly.
                    code: PIX-0712
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'A close of the month holds its claim (PIX-0712): another close under a different X-Idempotency is still running, or an earlier attempt ended in an error and its claim stays held until its lease ends. This request did not conclude the close; resend the identical request after Retry-After to get the report.'
          headers:
            Retry-After:
              description: Seconds until the lease of the close in flight ends, at least 1.
              schema:
                minimum: 1
                type: integer
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '413':
          content:
            application/json:
              example:
                code: PIX-0034
                title: Payload Too Large
                message: The request body exceeds the maximum size allowed for this operation.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: A body over 1 KiB (PIX-0034). Route-guard refusals (PIX-0034) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: 'The request body must be sent with Content-Type: application/json.'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0710:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0710
                    title: Unprocessable Entity
                    status: 422
                    detail: The reference month has not started.
                    code: PIX-0710
                PIX-0713:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0713
                    title: Unprocessable Entity
                    status: 422
                    detail: The current month can only be closed after it ends.
                    code: PIX-0713
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Only past months can be closed: a future month is PIX-0710, the current month PIX-0713.'
        '429':
          content:
            application/problem+json:
              examples:
                PIX-0006:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0006
                    title: Too Many Requests
                    status: 429
                    detail: Rate limit exceeded. Please wait before making additional requests.
                    code: PIX-0006
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The tenant''s close slot on the serving instance stayed busy for 5 seconds, or another close computes on the same database from any instance (PIX-0006): each instance computes one close per tenant and two across tenants, and each database one close at a time. Nothing was claimed or written and the gate freed the key: resend the identical request after Retry-After.'
          headers:
            Retry-After:
              description: Seconds to wait before sending the same request again.
              schema:
                minimum: 1
                type: integer
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '503':
          content:
            application/json:
              example:
                code: PIX-0032
                title: Idempotency Unavailable
                message: The request was not processed because the idempotency store is unavailable. Please retry.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0062:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0062
                    title: Service Unavailable
                    status: 503
                    detail: A dependency of this service is temporarily unavailable. Retry as the route's guidance for an unknown outcome says.
                    code: PIX-0062
                PIX-0715:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0715
                    title: Service Unavailable
                    status: 503
                    detail: The read replica has not reached the cutoff and nothing was frozen. Retry later.
                    code: PIX-0715
                PIX-0727:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0727
                    title: Service Unavailable
                    status: 503
                    detail: No APIX read pool is configured, or the configured read replica is not a standby in recovery.
                    code: PIX-0727
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'PIX-0715: the read replica has not applied every commit up to the cutoff plus the settle margin or has left recovery since the close opened its connection, or, for a few seconds after the month becomes closable, the database clock is behind the serving instance''s; nothing was frozen and the month stays OPEN. Retry after Retry-After, the larger of the claim''s lease left and the measured lag. PIX-0727: there is no APIX read pool, or the configured read replica is not in recovery, so not a physical streaming standby of the SPI primary; nothing was claimed or frozen. PIX-0062: a database connection failed or was lost. The close may have concluded; a resend returns its report. In multi-tenant mode the tenant middleware refuses a request with no tenant (401) or an unknown tenant (404) before this operation, and answers a tenant without the SPI module with 503 SERVICE_UNAVAILABLE; the close''s own answers to those cases (PIX-0062, and PIX-0727 for a tenant without the SPI module) are reached only in a race. Replay cache unavailable on this fail-closed route, so the mutation was refused rather than executed without replay protection (PIX-0032). Legacy {code,title,message} envelope, NOT problem+json.'
          headers:
            Retry-After:
              description: 'With PIX-0715 only: seconds to wait, at least 1.'
              schema:
                minimum: 1
                type: integer
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Close a reference month into an immutable report
      tags:
        - APIX001 Periods
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/close-a-reference-month-into-an-immutable-report
  /regulatory/apix001/reopen:
    post:
      description: Moves the closed month in the `period` of the body back to open, so that the facts and the declarations recorded after the close, and the corrections, enter the next close. Use it to rectify a report that you already sent. Until the month is closed again, the report route answers `404` (`PIX-0711`). A month that is not closed answers `409` (`PIX-0714`), and so does a reopen that lost the race to another. A future month answers `422` (`PIX-0710`). An absent `period` answers `400` (`PIX-0002`), and a `period` that is not `YYYY-MM` or is before 2020-11 answers `400` (`PIX-0003`).
      operationId: reopenApix001Period
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            examples: {}
            schema:
              $ref: '#/components/schemas/ApixPeriodBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                period: 2026-10
                status: OPEN
              schema:
                $ref: '#/components/schemas/ApixPeriod'
          description: OK
          headers:
            X-Idempotency-Fenced:
              description: 'Present only when the request committed but its receipt could not be stored. true: a resend under the key within the hour is 412 PIX-0031, so read the resource instead. false: a resend under the key may run again.'
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
            X-Idempotency-Replayed:
              description: true when the idempotency gate answered from the receipt of an earlier request under the same X-Idempotency; absent on a first execution.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0002:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: period is a required field
                        location: period
                    code: PIX-0002
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: period does not match the 2006-01 format
                        location: period
                    code: PIX-0003
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`period` absent (PIX-0002), or not YYYY-MM or before 2020-11, when Pix started (PIX-0003). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          content:
            application/problem+json:
              examples:
                PIX-0005:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0005
                    title: Forbidden
                    status: 403
                    detail: You do not have permission to perform this operation.
                    errors:
                      - message: the token names no identity lib-auth can attribute; an operator conclusion records who concluded, so it requires one
                        location: principal
                    code: PIX-0005
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'With authorization on, a token that names no identity that Access Manager can attribute (PIX-0005, errors[] at principal): each report version records who closed or reopened the month, so nothing was read or written. The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '409':
          content:
            application/problem+json:
              examples:
                PIX-0714:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0714
                    title: Conflict
                    status: 409
                    detail: The month is not closed, so there is nothing to reopen.
                    code: PIX-0714
              schema:
                $ref: '#/components/schemas/Detail'
          description: The month is not CLOSED, so there is nothing to reopen (PIX-0714).
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '413':
          content:
            application/json:
              example:
                code: PIX-0034
                title: Payload Too Large
                message: The request body exceeds the maximum size allowed for this operation.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: A body over 1 KiB (PIX-0034). Route-guard refusals (PIX-0034) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: 'The request body must be sent with Content-Type: application/json.'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0710:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0710
                    title: Unprocessable Entity
                    status: 422
                    detail: The reference month has not started.
                    code: PIX-0710
              schema:
                $ref: '#/components/schemas/Detail'
          description: The reference month is in the future (PIX-0710).
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '503':
          content:
            application/json:
              example:
                code: PIX-0032
                title: Idempotency Unavailable
                message: The request was not processed because the idempotency store is unavailable. Please retry.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: Replay cache unavailable on this fail-closed route, so the mutation was refused rather than executed without replay protection (PIX-0032). Legacy {code,title,message} envelope, NOT problem+json.
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Reopen a closed reference month
      tags:
        - APIX001 Periods
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/reopen-a-closed-reference-month
  /regulatory/apix/facts/{fact_type}:
    post:
      description: 'Records version 1 of a fact that only your institution knows, for the APIX001 report of a month. `fact_type` in the path selects the body, and the `factType` of the body must have the same value (`422`, `PIX-0723`).


        The route accepts `OUTSIDE_SPI_SETTLEMENT`, `OUTSIDE_SPI_REFUND`, `OUTBOUND_FRAUD_REFUSAL` and `DICT_SCREEN_STEP`. The same `clientRequestId` with the same content creates nothing and answers the fact already recorded. The same `clientRequestId` with other content answers `409` (`PIX-0717`): correct the fact with the correct route. A new `clientRequestId` for a subject that already has a current fact of the same type answers `409` (`PIX-0725`). An `OUTSIDE_SPI_REFUND` needs a `reasonCode` of `FR01`, `MD06`, `SL02` or `BE08`, or the route answers `422` (`PIX-0726`). `FR01` counts as fraud (`refundDetail` 1). The other three count as other (`refundDetail` 2).


        A fact for a closed month is accepted. It enters a report only after a reopen and a new close.


        Pix Lerian limits recording and correcting facts to 2 in flight for each tenant on each serving instance. Above that, the route answers `429` (`PIX-0006`) with `Retry-After` and records nothing. Send a backfill one request at a time.'
      operationId: recordApixClientFact
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: "Fact type, the same value as the `factType` of the body. Each value is one event that only the participant knows. OUTSIDE_SPI_SETTLEMENT: a transaction that the participant settled outside the SPI in its own systems, on-us or for an indirect participant that it settles. It feeds transactions details 5 and 6 and the outside-SPI pair of transactionTimes. OUTSIDE_SPI_REFUND: a refund that the participant settled outside the SPI in its own systems. It feeds refunds. OUTBOUND_FRAUD_REFUSAL: an outbound Pix that the participant refused for fraud suspicion. It feeds transactions detail 7. DICT_SCREEN_STEP: a numbered DICT flow step that happens in the participant's channel. It is kept for the P95 indicators of dictTimes. Any other value is refused."
          in: path
          name: fact_type
          required: true
          schema:
            description: "Fact type, the same value as the `factType` of the body. Each value is one event that only the participant knows. OUTSIDE_SPI_SETTLEMENT: a transaction that the participant settled outside the SPI in its own systems, on-us or for an indirect participant that it settles. It feeds transactions details 5 and 6 and the outside-SPI pair of transactionTimes. OUTSIDE_SPI_REFUND: a refund that the participant settled outside the SPI in its own systems. It feeds refunds. OUTBOUND_FRAUD_REFUSAL: an outbound Pix that the participant refused for fraud suspicion. It feeds transactions detail 7. DICT_SCREEN_STEP: a numbered DICT flow step that happens in the participant's channel. It is kept for the P95 indicators of dictTimes. Any other value is refused."
            enum:
              - OUTBOUND_FRAUD_REFUSAL
              - OUTSIDE_SPI_SETTLEMENT
              - OUTSIDE_SPI_REFUND
              - DICT_SCREEN_STEP
            examples:
              - OUTSIDE_SPI_REFUND
            type: string
      requestBody:
        content:
          application/json:
            examples:
              dictScreenStep:
                summary: DICT_SCREEN_STEP
                value:
                  factType: DICT_SCREEN_STEP
                  clientRequestId: dss-2026-10-key-reg-0042-s6
                  operation: KEY_REGISTRATION
                  operationRef: 0193a5c1-9e8f-7a6b-8c5d-4e3f2a1b0c9d
                  step: 6
                  occurredAt: '2026-10-12T11:20:31.507Z'
              outboundFraudRefusal:
                summary: OUTBOUND_FRAUD_REFUSAL
                value:
                  factType: OUTBOUND_FRAUD_REFUSAL
                  clientRequestId: ofr-2026-10-000233
                  endToEndId: null
                  amount: '4800.00'
                  cashAmount: '0.00'
                  purpose: IPAY
                  refusedAt: '2026-10-21T22:47:13.880Z'
              outsideSpiRefund:
                summary: OUTSIDE_SPI_REFUND
                value:
                  factType: OUTSIDE_SPI_REFUND
                  clientRequestId: osr-2026-10-000071
                  endToEndId: D12345678202610311702a9b8c7d6e5f
                  originalEndToEndId: E12345678202610311545f6e5d4c3b2a
                  amount: '89.90'
                  reasonCode: MD06
                  settledAt: '2026-10-31T17:02:44.019Z'
              outsideSpiSettlement:
                summary: OUTSIDE_SPI_SETTLEMENT
                value:
                  factType: OUTSIDE_SPI_SETTLEMENT
                  clientRequestId: osp-2026-10-004512
                  endToEndId: E12345678202610311545f6e5d4c3b2a
                  amount: '89.90'
                  cashAmount: '0.00'
                  purpose: IPAY
                  payerIspb: '12345678'
                  receiverIspb: '12345678'
                  settledAt: '2026-10-31T15:45:10.958Z'
                  acceptedAt: '2026-10-31T15:45:10.412Z'
                  payerNotifiedAt: '2026-10-31T15:45:11.204Z'
                  highPriority: true
                  initiationChannel: APP
                  scheduled: false
                  fraudSuspected: false
                  initiationProcedure: MANUAL
                  initiationMechanism: KEY
                  payerPersonType: NATURAL_PERSON
                  receiverPersonType: LEGAL_PERSON
            schema:
              $ref: '#/components/schemas/ApixClientFactInput'
        required: true
      responses:
        '201':
          content:
            application/json:
              example:
                factId: 0193a7c2-5d4e-7f10-a2b3-c4d5e6f7a8b9
                factType: OUTSIDE_SPI_REFUND
                clientRequestId: osr-2026-10-000071
                version: 1
                period: 2026-10
                payload:
                  factType: OUTSIDE_SPI_REFUND
                  clientRequestId: osr-2026-10-000071
                  endToEndId: D12345678202610311702a9b8c7d6e5f
                  originalEndToEndId: E12345678202610311545f6e5d4c3b2a
                  amount: '89.90'
                  reasonCode: MD06
                  settledAt: '2026-10-31T17:02:44.019Z'
              schema:
                $ref: '#/components/schemas/ApixClientFact'
          description: Created
          headers:
            X-Idempotency-Fenced:
              description: 'Present only when the request committed but its receipt could not be stored. true: a resend under the key within the hour is 412 PIX-0031, so read the resource instead. false: a resend under the key may run again.'
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
            X-Idempotency-Replayed:
              description: true when the idempotency gate answered from the receipt of an earlier request under the same X-Idempotency; absent on a first execution.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0002:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: endToEndId is required
                        location: body.endToEndId
                    code: PIX-0002
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: cashAmount is malformed
                        location: body.cashAmount
                    code: PIX-0003
                PIX-0015:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0015
                    title: Bad Request
                    status: 400
                    detail: One or more path parameters are invalid.
                    errors:
                      - message: is not an APIX fact type
                        location: fact_type
                    code: PIX-0015
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'A required body field is missing (PIX-0002), or a body field has an invalid value (PIX-0003): a value outside its format, such as a `clientRequestId` outside its pattern or a malformed end-to-end id or a `reasonCode` not of four upper-case letters or digits, a `step` that is not an integer from 1 to 30 or an `operationRef` that is not a lowercase hyphenated UUID; a `cashAmount` outside the rule of its `purpose`; a `highPriority` of true on an OUTSIDE_SPI_SETTLEMENT with `purpose` AUTOMATIC, `scheduled` true or `fraudSuspected` true; or, on an OUTSIDE_SPI_SETTLEMENT whose `payerIspb` is the tenant, an absent `acceptedAt`, an absent or null `payerNotifiedAt`, or a `payerNotifiedAt` more than 999999.99 seconds after `acceptedAt`, the longest time the layout renders. `errors[].location` names the field, as `body.<field>`. Field names are case-sensitive: a field the type does not define, such as `Amount` for `amount`, is PIX-0003 at `body`. A `fact_type` that is not an APIX fact type is PIX-0015 at `fact_type`. X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          description: 'The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '409':
          content:
            application/problem+json:
              examples:
                PIX-0717:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0717
                    title: Conflict
                    status: 409
                    detail: This clientRequestId is already recorded with different content.
                    code: PIX-0717
                PIX-0725:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0725
                    title: Conflict
                    status: 409
                    detail: Another current fact of this type already covers the same subject.
                    code: PIX-0725
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`clientRequestId` already recorded with different content (PIX-0717), or another `clientRequestId` for a subject that already has a current fact of this type (PIX-0725).'
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '413':
          content:
            application/json:
              example:
                code: PIX-0034
                title: Payload Too Large
                message: The request body exceeds the maximum size allowed for this operation.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: A body over 16 KiB (PIX-0034). Route-guard refusals (PIX-0034) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: 'The request body must be sent with Content-Type: application/json.'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0723:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0723
                    title: Unprocessable Entity
                    status: 422
                    detail: The fact body does not match the path.
                    code: PIX-0723
                PIX-0724:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0724
                    title: Unprocessable Entity
                    status: 422
                    detail: This fact type is not accepted.
                    code: PIX-0724
                PIX-0726:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0726
                    title: Unprocessable Entity
                    status: 422
                    detail: The refund reason code is not in the APIX refund reason catalog.
                    errors:
                      - message: reasonCode is not in the APIX refund reason catalog
                        location: body.reasonCode
                    code: PIX-0726
              schema:
                $ref: '#/components/schemas/Detail'
          description: The body does not match the path (PIX-0723), the type is not accepted (PIX-0724), or an OUTSIDE_SPI_REFUND carries a `reasonCode` outside the APIX refund reason catalog FR01, MD06, SL02 and BE08 (PIX-0726, errors[] at body.reasonCode).
        '429':
          content:
            application/problem+json:
              examples:
                PIX-0006:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0006
                    title: Too Many Requests
                    status: 429
                    detail: Rate limit exceeded. Please wait before making additional requests.
                    code: PIX-0006
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The tenant already has 2 facts in flight on the serving instance, records and corrections together (PIX-0006). Nothing was recorded and the gate freed the key: resend the identical request after Retry-After.'
          headers:
            Retry-After:
              description: Seconds to wait before sending the same request again.
              schema:
                minimum: 1
                type: integer
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Record a fact only the participant knows
      tags:
        - APIX Client Facts
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/record-a-fact-only-the-participant-knows
  /regulatory/apix/facts/{fact_type}/{client_request_id}/correct:
    post:
      description: 'Records a new version of a fact, with the content of the body. Pix Lerian keeps the previous version, and it still governs the reports whose cutoff precedes the correction. The body carries the whole fact. Its `factType` must equal `{fact_type}`, and its `clientRequestId` must equal `{client_request_id}` (`422`, `PIX-0723`). A body identical to the current version creates no version and answers the current one. A fact of this type with this `clientRequestId` that does not exist answers `404` (`PIX-0718`): record it first.


        For a closed month, the correction counts only after a reopen and a new close. Pix Lerian limits recording and correcting facts to 2 in flight for each tenant on each serving instance. Above that, the route answers `429` (`PIX-0006`) with `Retry-After` and records nothing.'
      operationId: correctApixClientFact
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: "Fact type, the same value as the `factType` of the body. Each value is one event that only the participant knows. OUTSIDE_SPI_SETTLEMENT: a transaction that the participant settled outside the SPI in its own systems, on-us or for an indirect participant that it settles. It feeds transactions details 5 and 6 and the outside-SPI pair of transactionTimes. OUTSIDE_SPI_REFUND: a refund that the participant settled outside the SPI in its own systems. It feeds refunds. OUTBOUND_FRAUD_REFUSAL: an outbound Pix that the participant refused for fraud suspicion. It feeds transactions detail 7. DICT_SCREEN_STEP: a numbered DICT flow step that happens in the participant's channel. It is kept for the P95 indicators of dictTimes. Any other value is refused."
          in: path
          name: fact_type
          required: true
          schema:
            description: "Fact type, the same value as the `factType` of the body. Each value is one event that only the participant knows. OUTSIDE_SPI_SETTLEMENT: a transaction that the participant settled outside the SPI in its own systems, on-us or for an indirect participant that it settles. It feeds transactions details 5 and 6 and the outside-SPI pair of transactionTimes. OUTSIDE_SPI_REFUND: a refund that the participant settled outside the SPI in its own systems. It feeds refunds. OUTBOUND_FRAUD_REFUSAL: an outbound Pix that the participant refused for fraud suspicion. It feeds transactions detail 7. DICT_SCREEN_STEP: a numbered DICT flow step that happens in the participant's channel. It is kept for the P95 indicators of dictTimes. Any other value is refused."
            enum:
              - OUTBOUND_FRAUD_REFUSAL
              - OUTSIDE_SPI_SETTLEMENT
              - OUTSIDE_SPI_REFUND
              - DICT_SCREEN_STEP
            examples:
              - OUTSIDE_SPI_REFUND
            type: string
        - description: 'clientRequestId of the fact to correct. The fact is addressed by the client key, not by factId: each version is its own row with its own factId, while the client key is stable across versions.'
          in: path
          name: client_request_id
          required: true
          schema:
            description: 'clientRequestId of the fact to correct. The fact is addressed by the client key, not by factId: each version is its own row with its own factId, while the client key is stable across versions.'
            examples:
              - cb-2026-10-000017
            maxLength: 64
            minLength: 1
            pattern: ^[A-Za-z0-9._:-]+$
            type: string
      requestBody:
        content:
          application/json:
            examples:
              dictScreenStep:
                summary: DICT_SCREEN_STEP
                value:
                  factType: DICT_SCREEN_STEP
                  clientRequestId: dss-2026-10-key-reg-0042-s6
                  operation: KEY_REGISTRATION
                  operationRef: 0193a5c1-9e8f-7a6b-8c5d-4e3f2a1b0c9d
                  step: 6
                  occurredAt: '2026-10-12T11:20:31.507Z'
              outboundFraudRefusal:
                summary: OUTBOUND_FRAUD_REFUSAL
                value:
                  factType: OUTBOUND_FRAUD_REFUSAL
                  clientRequestId: ofr-2026-10-000233
                  endToEndId: null
                  amount: '4800.00'
                  cashAmount: '0.00'
                  purpose: IPAY
                  refusedAt: '2026-10-21T22:47:13.880Z'
              outsideSpiRefund:
                summary: OUTSIDE_SPI_REFUND
                value:
                  factType: OUTSIDE_SPI_REFUND
                  clientRequestId: osr-2026-10-000071
                  endToEndId: D12345678202610311702a9b8c7d6e5f
                  originalEndToEndId: E12345678202610311545f6e5d4c3b2a
                  amount: '89.90'
                  reasonCode: MD06
                  settledAt: '2026-10-31T17:02:44.019Z'
              outsideSpiSettlement:
                summary: OUTSIDE_SPI_SETTLEMENT
                value:
                  factType: OUTSIDE_SPI_SETTLEMENT
                  clientRequestId: osp-2026-10-004512
                  endToEndId: E12345678202610311545f6e5d4c3b2a
                  amount: '89.90'
                  cashAmount: '0.00'
                  purpose: IPAY
                  payerIspb: '12345678'
                  receiverIspb: '12345678'
                  settledAt: '2026-10-31T15:45:10.958Z'
                  acceptedAt: '2026-10-31T15:45:10.412Z'
                  payerNotifiedAt: '2026-10-31T15:45:11.204Z'
                  highPriority: true
                  initiationChannel: APP
                  scheduled: false
                  fraudSuspected: false
                  initiationProcedure: MANUAL
                  initiationMechanism: KEY
                  payerPersonType: NATURAL_PERSON
                  receiverPersonType: LEGAL_PERSON
            schema:
              $ref: '#/components/schemas/ApixClientFactInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                factId: 0193b1e4-2a7c-7d11-b3c4-d5e6f7a8b9c0
                factType: OUTSIDE_SPI_REFUND
                clientRequestId: osr-2026-10-000071
                version: 2
                period: 2026-10
                payload:
                  factType: OUTSIDE_SPI_REFUND
                  clientRequestId: osr-2026-10-000071
                  endToEndId: D12345678202610311702a9b8c7d6e5f
                  originalEndToEndId: E12345678202610311545f6e5d4c3b2a
                  amount: '90.00'
                  reasonCode: MD06
                  settledAt: '2026-10-31T17:02:44.019Z'
              schema:
                $ref: '#/components/schemas/ApixClientFact'
          description: OK
          headers:
            X-Idempotency-Fenced:
              description: 'Present only when the request committed but its receipt could not be stored. true: a resend under the key within the hour is 412 PIX-0031, so read the resource instead. false: a resend under the key may run again.'
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
            X-Idempotency-Replayed:
              description: true when the idempotency gate answered from the receipt of an earlier request under the same X-Idempotency; absent on a first execution.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0002:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: endToEndId is required
                        location: body.endToEndId
                    code: PIX-0002
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: cashAmount is malformed
                        location: body.cashAmount
                    code: PIX-0003
                PIX-0015:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0015
                    title: Bad Request
                    status: 400
                    detail: One or more path parameters are invalid.
                    errors:
                      - message: is not an APIX fact type
                        location: fact_type
                    code: PIX-0015
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'A required body field is missing (PIX-0002), or a body field has an invalid value (PIX-0003): a value outside its format, such as a `clientRequestId` outside its pattern or a malformed end-to-end id or a `reasonCode` not of four upper-case letters or digits, a `step` that is not an integer from 1 to 30 or an `operationRef` that is not a lowercase hyphenated UUID; a `cashAmount` outside the rule of its `purpose`; a `highPriority` of true on an OUTSIDE_SPI_SETTLEMENT with `purpose` AUTOMATIC, `scheduled` true or `fraudSuspected` true; or, on an OUTSIDE_SPI_SETTLEMENT whose `payerIspb` is the tenant, an absent `acceptedAt`, an absent or null `payerNotifiedAt`, or a `payerNotifiedAt` more than 999999.99 seconds after `acceptedAt`, the longest time the layout renders. `errors[].location` names the field, as `body.<field>`. Field names are case-sensitive: a field the type does not define, such as `Amount` for `amount`, is PIX-0003 at `body`. A `fact_type` that is not an APIX fact type is PIX-0015 at `fact_type`. X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          description: 'The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '404':
          content:
            application/json:
              example:
                code: TENANT_NOT_FOUND
                title: Tenant Not Found
                message: 'tenant not found: 019606a1-3b4c-7d8e-9f01-234567890abc'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0718:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0718
                    title: Not Found
                    status: 404
                    detail: No fact of this type with this clientRequestId.
                    code: PIX-0718
              schema:
                $ref: '#/components/schemas/Detail'
          description: No fact of this type with this `clientRequestId` (PIX-0718). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '409':
          content:
            application/problem+json:
              examples:
                PIX-0717:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0717
                    title: Conflict
                    status: 409
                    detail: This clientRequestId is already recorded with different content.
                    code: PIX-0717
                PIX-0725:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0725
                    title: Conflict
                    status: 409
                    detail: Another current fact of this type already covers the same subject.
                    code: PIX-0725
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`clientRequestId` already recorded with different content (PIX-0717), or another `clientRequestId` for a subject that already has a current fact of this type (PIX-0725).'
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '413':
          content:
            application/json:
              example:
                code: PIX-0034
                title: Payload Too Large
                message: The request body exceeds the maximum size allowed for this operation.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: A body over 16 KiB (PIX-0034). Route-guard refusals (PIX-0034) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: 'The request body must be sent with Content-Type: application/json.'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0723:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0723
                    title: Unprocessable Entity
                    status: 422
                    detail: The fact body does not match the path.
                    code: PIX-0723
                PIX-0724:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0724
                    title: Unprocessable Entity
                    status: 422
                    detail: This fact type is not accepted.
                    code: PIX-0724
                PIX-0726:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0726
                    title: Unprocessable Entity
                    status: 422
                    detail: The refund reason code is not in the APIX refund reason catalog.
                    errors:
                      - message: reasonCode is not in the APIX refund reason catalog
                        location: body.reasonCode
                    code: PIX-0726
              schema:
                $ref: '#/components/schemas/Detail'
          description: The body does not match the path (PIX-0723), the type is not accepted (PIX-0724), or an OUTSIDE_SPI_REFUND carries a `reasonCode` outside the APIX refund reason catalog FR01, MD06, SL02 and BE08 (PIX-0726, errors[] at body.reasonCode).
        '429':
          content:
            application/problem+json:
              examples:
                PIX-0006:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0006
                    title: Too Many Requests
                    status: 429
                    detail: Rate limit exceeded. Please wait before making additional requests.
                    code: PIX-0006
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'The tenant already has 2 facts in flight on the serving instance, records and corrections together (PIX-0006). Nothing was recorded and the gate freed the key: resend the identical request after Retry-After.'
          headers:
            Retry-After:
              description: Seconds to wait before sending the same request again.
              schema:
                minimum: 1
                type: integer
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Correct a recorded fact (new version)
      tags:
        - APIX Client Facts
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/correct-a-recorded-fact-new-version
  /regulatory/apix/settled-participants:
    post:
      description: 'Declares an indirect participant (`ispb`) that the tenant settles for, in force from `validFrom`, with no end until you end it with the end route. The `id` of the response addresses the declaration from then on.


        A close classifies each settlement outside SPI by the declarations in force at its cutoff. When both ISPBs are the tenant''s, the settlement is `transactionDetail` 6. When the two ISPBs differ and each is the tenant''s or the one of a declared indirect participant, for the civil day of `settledAt`, it is `transactionDetail` 5. Any other pair stays out of the rows.


        The tenant''s own ISPB (`body.ispb`), or a validity that overlaps another declaration of the same ISPB (`body.validFrom`), answers `422` (`PIX-0719`). The message of an overlap names the id of the declaration it meets. A declaration that starts after the last day of an earlier one, or of one voided, is accepted.


        The optional `clientRequestId` keys the declaration per tenant. The same body under it answers the current declaration and creates nothing. Another body under it answers `409` (`PIX-0717`). A declaration, an end or a void that covers a closed month leaves that month''s report unchanged. It enters only the close that follows a reopen.'
      operationId: declareSettledParticipant
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            examples: {}
            schema:
              $ref: '#/components/schemas/ApixSettledParticipantInput'
        required: true
      responses:
        '201':
          content:
            application/json:
              example:
                id: 0193a7d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f
                version: 1
                ispb: '23456789'
                name: Exemplo Pagamentos IP S.A.
                validFrom: '2026-11-01'
                validTo: null
              schema:
                $ref: '#/components/schemas/ApixSettledParticipant'
          description: Created
          headers:
            X-Idempotency-Fenced:
              description: 'Present only when the request committed but its receipt could not be stored. true: a resend under the key within the hour is 412 PIX-0031, so read the resource instead. false: a resend under the key may run again.'
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
            X-Idempotency-Replayed:
              description: true when the idempotency gate answered from the receipt of an earlier request under the same X-Idempotency; absent on a first execution.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0002:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: validFrom is required
                        location: body.validFrom
                    code: PIX-0002
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: validFrom is malformed
                        location: body.validFrom
                    code: PIX-0003
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`ispb` or `validFrom` absent (PIX-0002), or a field with an invalid value or outside the schema (PIX-0003). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          content:
            application/problem+json:
              examples:
                PIX-0005:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0005
                    title: Forbidden
                    status: 403
                    detail: You do not have permission to perform this operation.
                    errors:
                      - message: the token names no identity lib-auth can attribute; an operator conclusion records who concluded, so it requires one
                        location: principal
                    code: PIX-0005
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'With authorization on, a token that names no identity that Access Manager can attribute (PIX-0005, errors[] at principal): each declaration version records who declared or ended it, so nothing was read or written. The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '409':
          content:
            application/problem+json:
              examples:
                PIX-0717:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0717
                    title: Conflict
                    status: 409
                    detail: This clientRequestId is already recorded with different content.
                    code: PIX-0717
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`clientRequestId` already declared with another body (PIX-0717).'
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '413':
          content:
            application/json:
              example:
                code: PIX-0034
                title: Payload Too Large
                message: The request body exceeds the maximum size allowed for this operation.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: A body over 1 KiB (PIX-0034). Route-guard refusals (PIX-0034) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: 'The request body must be sent with Content-Type: application/json.'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0719-overlap:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0719
                    title: Unprocessable Entity
                    status: 422
                    detail: The settled participant declaration is invalid.
                    errors:
                      - message: validFrom overlaps settled participant declaration 0193a7c4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
                        location: body.validFrom
                    code: PIX-0719
                PIX-0719-own-ispb:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0719
                    title: Unprocessable Entity
                    status: 422
                    detail: The settled participant declaration is invalid.
                    errors:
                      - message: ispb is not valid for this declaration
                        location: body.ispb
                    code: PIX-0719
              schema:
                $ref: '#/components/schemas/Detail'
          description: The tenant's own ISPB (`body.ispb`), or a validity that overlaps another declaration of the same ISPB (`body.validFrom`, whose message names that declaration's id) (PIX-0719).
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '503':
          content:
            application/json:
              example:
                code: PIX-0032
                title: Idempotency Unavailable
                message: The request was not processed because the idempotency store is unavailable. Please retry.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: Replay cache unavailable on this fail-closed route, so the mutation was refused rather than executed without replay protection (PIX-0032). Legacy {code,title,message} envelope, NOT problem+json.
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: Declare an indirect participant the tenant settles
      tags:
        - APIX Settled Participants
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/declare-an-indirect-participant-the-tenant-settles
  /regulatory/apix/settled-participants/{settled_participant_id}/end:
    post:
      description: 'Ends declaration `{settled_participant_id}` on `validTo`, the last day it is in force, by recording a new version of it. The previous version is kept. `validTo` is required, cannot be null, and is the only field that changes. A `validTo` one day before `validFrom` voids the declaration: it is never in force, the close and the overlap check skip it, and the ISPB can be declared again from any day. A later `validTo` puts it back in force. The same `validTo` as the current version creates no version and answers `200` with it.


        A `validTo` earlier than the day before `validFrom`, or one that makes the validity overlap another declaration of the same ISPB, answers `422` (`PIX-0719`) at `body.validTo`. No declaration with this id answers `404` (`PIX-0722`), and an id that is not a UUID answers `400` (`PIX-0015`).


        `version` is the current version of the declaration, as the last response for it gave it. Another version answers `409` (`PIX-0728`), and nothing is written. A declaration, an end or a void that covers a closed month leaves that month''s report unchanged. It enters only the close that follows a reopen.'
      operationId: endSettledParticipant
      parameters:
        - description: 'REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.'
          in: header
          name: X-Idempotency
          required: true
          schema:
            maxLength: 64
            minLength: 1
            type: string
        - description: id of the declaration, stable across its versions. Not a UUID is 400 PIX-0015.
          in: path
          name: settled_participant_id
          required: true
          schema:
            description: id of the declaration, stable across its versions. Not a UUID is 400 PIX-0015.
            examples:
              - 0193a7d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            examples: {}
            schema:
              $ref: '#/components/schemas/ApixEndSettledParticipantInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                id: 0193a7d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f
                version: 2
                ispb: '23456789'
                name: Exemplo Pagamentos IP S.A.
                validFrom: '2026-11-01'
                validTo: '2027-01-31'
              schema:
                $ref: '#/components/schemas/ApixSettledParticipant'
          description: OK
          headers:
            X-Idempotency-Fenced:
              description: 'Present only when the request committed but its receipt could not be stored. true: a resend under the key within the hour is 412 PIX-0031, so read the resource instead. false: a resend under the key may run again.'
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
            X-Idempotency-Replayed:
              description: true when the idempotency gate answered from the receipt of an earlier request under the same X-Idempotency; absent on a first execution.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: The X-Idempotency header is required for this operation and must be within the accepted length.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0002:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0002
                    title: Bad Request
                    status: 400
                    detail: Your request is missing one or more required fields.
                    errors:
                      - message: validTo is required
                        location: body.validTo
                    code: PIX-0002
                PIX-0003:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0003
                    title: Bad Request
                    status: 400
                    detail: Your request contains one or more fields with an invalid data type.
                    errors:
                      - message: validTo is malformed
                        location: body.validTo
                    code: PIX-0003
                PIX-0015:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0015
                    title: Bad Request
                    status: 400
                    detail: One or more path parameters are invalid.
                    errors:
                      - message: settled_participant_id must be a valid UUID
                        location: settled_participant_id
                    code: PIX-0015
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`validTo` or `version` absent (PIX-0002), `validTo` null or not YYYY-MM-DD, `version` below 1, or a field outside the schema (PIX-0003), or `settled_participant_id` not a UUID (PIX-0015). X-Idempotency absent or longer than 64 bytes (PIX-0030). Legacy {code,title,message} envelope, NOT problem+json. Route-guard refusals (PIX-0010) answer in the legacy {code,title,message} envelope too.'
        '401':
          description: 'Missing, malformed or expired bearer token, refused ahead of this operation by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. In a multi-tenant deployment the tenant middleware refuses a token it cannot read, or one with no usable tenantId claim, in the same shape with a code outside the PIX-NNNN catalogue: MISSING_TOKEN, INVALID_TOKEN, MISSING_TENANT or INVALID_TENANT. Branch on the status, not the body code.'
        '403':
          content:
            application/problem+json:
              examples:
                PIX-0005:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0005
                    title: Forbidden
                    status: 403
                    detail: You do not have permission to perform this operation.
                    errors:
                      - message: the token names no identity lib-auth can attribute; an operator conclusion records who concluded, so it requires one
                        location: principal
                    code: PIX-0005
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'With authorization on, a token that names no identity that Access Manager can attribute (PIX-0005, errors[] at principal): each declaration version records who declared or ended it, so nothing was read or written. The token lacks the permission this operation''s resource and action require, refused ahead of it by the authorization middleware in the legacy {code,title,message} envelope over application/json, with the generic client-error code PIX-0010. The tenant middlewares also answer 403 with a code outside the PIX-NNNN catalogue: TENANT_SUSPENDED or TENANT_ACCESS_DENIED in a multi-tenant deployment, in the same shape, and TENANT_CONFIG_NOT_FOUND, in a {code,message} body, when the tenant''s configuration cannot be resolved. Branch on the status, not the body code.'
        '404':
          content:
            application/json:
              example:
                code: TENANT_NOT_FOUND
                title: Tenant Not Found
                message: 'tenant not found: 019606a1-3b4c-7d8e-9f01-234567890abc'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0722:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0722
                    title: Not Found
                    status: 404
                    detail: No declaration with this id.
                    code: PIX-0722
              schema:
                $ref: '#/components/schemas/Detail'
          description: No declaration with this id (PIX-0722). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '409':
          content:
            application/problem+json:
              examples:
                PIX-0728:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0728
                    title: Conflict
                    status: 409
                    detail: The declaration is not at the version sent. Send its current version.
                    errors:
                      - message: version 1 is not the current version 2
                        location: body.version
                    code: PIX-0728
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`version` is not the declaration''s current version, which the message names (PIX-0728).'
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The X-Idempotency header is held by a request still running or whose receipt could not be stored, or was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: 'Refused under this X-Idempotency (PIX-0031): the first request under it is still running (with Retry-After: 1), its receipt could not be stored and the key is held for the hour, or the request differs from the first (method, URL, body or identity header). An earlier request under this key may already have executed. Legacy {code,title,message} envelope, NOT problem+json.'
        '413':
          content:
            application/json:
              example:
                code: PIX-0034
                title: Payload Too Large
                message: The request body exceeds the maximum size allowed for this operation.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: A body over 1 KiB (PIX-0034). Route-guard refusals (PIX-0034) answer in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '415':
          content:
            application/json:
              example:
                code: PIX-0016
                title: Unsupported Media Type
                message: 'The request body must be sent with Content-Type: application/json.'
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: The non-empty request body is missing an accepted JSON Content-Type (PIX-0016), answered in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '422':
          content:
            application/problem+json:
              examples:
                PIX-0719:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0719
                    title: Unprocessable Entity
                    status: 422
                    detail: The settled participant declaration is invalid.
                    errors:
                      - message: validTo is not valid for this declaration
                        location: body.validTo
                    code: PIX-0719
                PIX-0719-overlap:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0719
                    title: Unprocessable Entity
                    status: 422
                    detail: The settled participant declaration is invalid.
                    errors:
                      - message: validTo overlaps settled participant declaration 0193a7c4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
                        location: body.validTo
                    code: PIX-0719
              schema:
                $ref: '#/components/schemas/Detail'
          description: '`validTo` earlier than the day before `validFrom`, or a validity that overlaps another declaration of the same ISPB, whose message names that declaration''s id (PIX-0719).'
        '500':
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              examples:
                PIX-0000:
                  value:
                    type: https://errors.lerian.studio/v1/PIX-0000
                    title: Internal Server Error
                    status: 500
                    detail: The server encountered an unexpected error. Please try again later.
                    code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unexpected server error (PIX-0000). The middleware ahead of this operation answers this status too (see default), in the legacy {code,title,message} envelope over application/json, NOT problem+json.
        '503':
          content:
            application/json:
              example:
                code: PIX-0032
                title: Idempotency Unavailable
                message: The request was not processed because the idempotency store is unavailable. Please retry.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: Replay cache unavailable on this fail-closed route, so the mutation was refused rather than executed without replay protection (PIX-0032). Legacy {code,title,message} envelope, NOT problem+json.
        default:
          content:
            application/json:
              example:
                code: PIX-0000
                title: Internal Server Error
                message: The server encountered an unexpected error. Please try again later.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Error. Middleware ahead of this operation also refuses in the legacy {code,title,message} envelope over application/json: a body over the server''s 4 MiB limit with 413 PIX-0010; a query value holding the NUL character (%00) or invalid UTF-8 with 400 PIX-0020; the Access Manager unavailable (503) or timing out (504) with PIX-0000; and, in a multi-tenant deployment, the tenant middleware with 404 TENANT_NOT_FOUND, 500 TENANT_DB_ERROR, 503 TENANT_MANAGER_UNAVAILABLE or SERVICE_UNAVAILABLE, and 504 TENANT_MANAGER_TIMEOUT. Branch on the status; these middleware 503 and 504 refusals are retryable. Any operation that uses the database also answers 503 PIX-0062 when its Postgres connection is lost; that request may or may not have been processed, so repeat it only as this operation''s own guidance for an unknown outcome allows.'
      summary: End a declaration
      tags:
        - APIX Settled Participants
      x-mint:
        href: /es/reference/interfaces/pix-lerian/spi/end-a-declaration
components:
  schemas:
    AccountDetails:
      additionalProperties: false
      properties:
        branch:
          examples:
            - '0001'
          type: string
        number:
          examples:
            - '0007654321'
          type: string
        participant:
          examples:
            - '87654321'
          type: string
        type:
          examples:
            - CACC
          type: string
      required:
        - branch
        - number
        - participant
        - type
      type: object
    CreateRefundBody:
      additionalProperties: false
      properties:
        amount:
          description: Refund amount
          examples:
            - '100.00'
          type: string
        reason:
          description: Human-readable refund reason, sent in the pacs.004. U+0000 is refused (400 PIX-0010); U+FFFE, U+FFFF or U+0001-U+001F other than tab, line feed or carriage return is refused (400 PIX-0003).
          examples:
            - Estorno solicitado pelo pagador
          type: string
        reasonCode:
          description: pacs.004 RtrRsnInf reason code
          examples:
            - MD06
          type: string
          enum:
            - MD06
            - SL02
            - FR01
            - BE08
      required:
        - amount
        - reasonCode
        - reason
      type: object
    CreateScheduledPaymentBody:
      additionalProperties: false
      properties:
        accountId:
          description: Payer account UUID.
          examples:
            - 019606a1-3b4c-7d8e-9f01-234567890abc
          type: string
        amount:
          description: Amount to settle, in BRL with two decimals. The available balance is NOT touched at creation.
          examples:
            - '150.00'
          type: string
        currency:
          description: Always BRL. Present for forward compatibility only.
          enum:
            - BRL
          examples:
            - BRL
          type: string
        description:
          description: 'Free-text memo, at most 140 characters -- the RmtInf ceiling. Stored and returned VERBATIM: markup is not interpreted, escaped or stripped, and escaping belongs to whoever renders it.'
          examples:
            - Aluguel de setembro
          type: string
        destination:
          $ref: '#/components/schemas/DestinationBody'
          description: The payee's account and owner. Required when initiationType is MANUAL; refused on DICT and QR_CODE (422 PIX-0751; first 400 PIX-0002 if a field of it is missing, 400 PIX-0003 if one is invalid).
        initiationType:
          description: "How the destination is resolved. DICT reads the directory and requires payeeKey; MANUAL requires destination; QR_CODE requires emvPayload and resolves the payee from the key the BR Code carries. Each type reads only its own block: a payeeKey, destination or emvPayload sent on a type that does not read it is refused rather than ignored: well formed with 422 PIX-0751, a block with a missing field by request validation first (400 PIX-0002), one with an invalid field likewise (400 PIX-0003)."
          enum:
            - MANUAL
            - DICT
            - QR_CODE
          examples:
            - DICT
          type: string
        payeeKey:
          $ref: '#/components/schemas/PayeeKeyBody'
          description: The Pix key to resolve. Required when initiationType is DICT; refused on MANUAL and QR_CODE (422 PIX-0751; first 400 PIX-0002 if a field of it is missing, 400 PIX-0003 if one is invalid).
        purpose:
          description: Only IPAY can be scheduled. Pix Saque (OTHR) and Pix Troco (GSCB) are point-in-time operations and REG-Art.11-P prohibits scheduling them, so they are refused at creation rather than on the scheduled date.
          enum:
            - IPAY
          examples:
            - IPAY
          type: string
        scheduledDate:
          description: "Civil settlement date in AAAA-MM-DD, evaluated in America/Sao_Paulo. Never an instant: a date that is still today in UTC can already be yesterday here. Non-business days are accepted -- Pix settles every day. Today is accepted only before 08:00 in America/Sao_Paulo (PIX-0758)."
          examples:
            - '2026-09-10'
          format: date
          type: string
        emvPayload:
          description: "The BR Code the payer scanned or pasted, sent WHOLE and unmodified. Required when initiationType is QR_CODE and rejected on any other type. It is stored verbatim and shown on the receipt: normalising or re-serialising it breaks the CRC-16 the standard embeds, and the receipt would then display a code that pays nobody. A due-date collection BR Code is accepted; the txId it carries is recorded with the schedule."
          examples:
            - 00020101021226900014br.gov.bcb.pix2568qrcodepix.exemplo.com.br/cobv/8f3a1c2d4e5b6f7a8b9c0d1e2f3a4b5c52040000530398654071500.005802BR5919Mercado Central LTDA6008BRASILIA62070503***6304A1B2
          type: string
      required:
        - accountId
        - scheduledDate
        - amount
        - initiationType
      type: object
    DestinationAccountBody:
      additionalProperties: false
      properties:
        branch:
          description: "Branch code at the receiving institution: 1 to 4 digits, no check digit."
          examples:
            - '0001'
          type: string
        number:
          description: "Account number at the receiving institution: 1 to 20 uppercase letters or digits, no dash."
          examples:
            - '654321'
          type: string
        participant:
          description: 8-character BACEN ISPB (digits or uppercase letters) of the receiving institution.
          examples:
            - '60746948'
          type: string
        type:
          description: "Account type. SLRY (salary account) is refused by request validation (400 PIX-0003): a salary account cannot receive a Pix, and the rail would refuse it only on the scheduled date."
          enum:
            - CACC
            - SVGS
            - TRAN
          examples:
            - CACC
          type: string
      required:
        - number
        - participant
        - type
      type: object
    DestinationAccountOutput:
      additionalProperties: false
      properties:
        branch:
          examples:
            - '0001'
          type: string
        number:
          examples:
            - '0007654321'
          type: string
        participant:
          examples:
            - '87654321'
          type: string
        type:
          examples:
            - CACC
          type: string
      required:
        - branch
        - number
        - participant
        - type
      type: object
    DestinationAccountReq:
      additionalProperties: false
      properties:
        branch:
          description: 1 to 4 digits, no check digit
          examples:
            - '0001'
          type: string
        number:
          description: 1 to 20 uppercase letters or digits, no dash
          examples:
            - '0007654321'
          type: string
        participant:
          examples:
            - '87654321'
          type: string
        type:
          examples:
            - CACC
          type: string
      required:
        - branch
        - number
        - participant
        - type
      type: object
    DestinationBody:
      additionalProperties: false
      properties:
        account:
          $ref: '#/components/schemas/DestinationAccountBody'
        owner:
          $ref: '#/components/schemas/DestinationOwnerBody'
      required:
        - account
        - owner
      type: object
    DestinationOutput:
      additionalProperties: false
      properties:
        account:
          $ref: '#/components/schemas/DestinationAccountOutput'
        key:
          examples:
            - '+5511999998888'
          type: string
        owner:
          $ref: '#/components/schemas/DestinationOwnerOutput'
      required:
        - account
        - owner
      type: object
    DestinationOwnerBody:
      additionalProperties: false
      properties:
        document:
          description: "Payee CPF or CNPJ, digits only (no mask). The check digits are verified, and the person type is derived from it."
          examples:
            - '11222333000181'
          type: string
        name:
          description: Payee name as it should appear on the receipt.
          examples:
            - Mercado Central LTDA
          type: string
      required:
        - document
        - name
      type: object
    DestinationOwnerOutput:
      additionalProperties: false
      properties:
        document:
          examples:
            - '12345678901'
          type: string
        name:
          examples:
            - João da Silva
          type: string
        tradeName:
          examples:
            - Empresa Exemplo LTDA
          type: string
        type:
          examples:
            - NATURAL_PERSON
          type: string
      required:
        - document
        - name
      type: object
    DestinationOwnerReq:
      additionalProperties: false
      properties:
        document:
          description: CPF or CNPJ, digits only (no mask)
          examples:
            - "12345678909"
          type: string
        name:
          examples:
            - João da Silva
          type: string
        tradeName:
          examples:
            - Empresa Exemplo LTDA
          type: string
      required:
        - document
        - name
      type: object
    DestinationReq:
      additionalProperties: false
      properties:
        account:
          $ref: '#/components/schemas/DestinationAccountReq'
        owner:
          $ref: '#/components/schemas/DestinationOwnerReq'
      required:
        - account
        - owner
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: 'Stable, machine-readable domain error code scoped to the emitting service (format: <SERVICE>-NNNN).'
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: 'RFC 9457 extension member: the error a proxied third-party provider reported. Absent unless the emitting service explicitly surfaced one.'
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    FeeChargeResponse:
      additionalProperties: false
      properties:
        applied:
          examples:
            - true
          type: boolean
          description: "Whether the ledger charged a fee on the create that moved the operation's money. When false, no other field is present. applied reports what the create did and the object is kept as its record. Where the operation carries ledger.revert (transfers only: REJECTED, or FAILED after the debit was reverted), the revert inverted the fee legs with the amount, so the fee was returned; on a transfer without ledger.revert, feeCharge says nothing about the fee's final position."
        calculationType:
          examples:
            - LEDGER
          type: string
          description: How the total fee was calculated. LEDGER when the ledger's fee package computed it.
        fees:
          items:
            $ref: '#/components/schemas/FeeEntryResponse'
          type:
            - array
            - 'null'
          description: Individual fee entries that make up the total, one per ledger fee leg.
        netAmount:
          examples:
            - "100.00"
          type: string
          description: "Amount that reached the destination: on an outbound operation what the ledger moved to the rail, on an inbound one what it credited to the receiving account (the operation's amount when the ledger reported no such leg; on an outbound operation a deductible fee package, a misconfiguration on a Pix ledger, makes it lower than the amount)."
        totalAmount:
          examples:
            - '1.50'
          type: string
          description: Sum of every fee entry the ledger charged on the operation.
      required:
        - applied
      type: object
    FeeEntryResponse:
      additionalProperties: false
      properties:
        amount:
          examples:
            - '1.50'
          type: string
          description: Amount of this fee entry.
        calculationType:
          examples:
            - LEDGER
          type: string
          description: How this entry was calculated. LEDGER when the ledger's fee package computed it.
        calculationValue:
          type: string
          description: Raw value the calculation was parameterised with. Absent when calculationType is LEDGER.
        creditAccount:
          examples:
            - "@fees-pix"
          type: string
          description: Ledger account credited with this fee entry.
        feeLabel:
          examples:
            - LEDGER_FEE
          type: string
          description: "Label of this fee entry. LEDGER_FEE on every entry the ledger reported: its answer names no fee, so creditAccount is what distinguishes one entry from another."
      required:
        - feeLabel
        - amount
      type: object
    InitiateTransferBody:
      additionalProperties: false
      properties:
        description:
          description: Free-form payment description. U+0000 is refused (400 PIX-0010); U+FFFE, U+FFFF or U+0001-U+001F other than tab, line feed or carriage return is refused (400 PIX-0003).
          examples:
            - Pagamento de aluguel
          type: string
        destination:
          $ref: '#/components/schemas/DestinationReq'
          description: Manual destination (MANUAL initiation only)
        emv:
          description: EMV BR Code payload (QR_CODE initiation only)
          examples:
            - 00020101021126360014br.gov.bcb.pix0114+5511999998888520400005303986540510.005802BR5913JOAO DA SILVA6008BRASILIA62070503***63045B56
          type: string
        endToEndId:
          description: "Optional caller-supplied 32-char BACEN endToEndId (E-prefixed). DICT and QR_CODE only: the key is looked up in DICT under it and the transfer is later sent under the same id; omit it to let SPI generate one, returned as endToEndId. Ignored for MANUAL."
          examples:
            - E12345678202605061030abcdef12345
          type: string
        initiationType:
          description: Resolution strategy for the destination
          examples:
            - DICT
          type: string
        key:
          description: DICT key (DICT initiation only)
          examples:
            - '+5511999998888'
          type: string
      required:
        - initiationType
      type: object
    InitiateTransferOutput:
      additionalProperties: false
      properties:
        amount:
          examples:
            - '10.00'
          type: string
        createdAt:
          examples:
            - '2026-05-06T10:30:00Z'
          format: date-time
          type: string
        description:
          examples:
            - Pagamento de aluguel
          type: string
        destination:
          $ref: '#/components/schemas/DestinationOutput'
        emv:
          examples:
            - 00020101021126360014br.gov.bcb.pix0114+5511999998888520400005303986540510.005802BR5913JOAO DA SILVA6008BRASILIA62070503***63045B56
          type: string
        endToEndId:
          examples:
            - E12345678202605061030abcdef12345
          type: string
          description: "BACEN end-to-end id fixed at initiate for DICT and QR_CODE: the id the DICT lookup was made under, reused automatically by process as the transfer's id (do not send X-End-To-End-Id at process: it is refused for DICT and QR_CODE). Absent for MANUAL."
        expiresAt:
          examples:
            - '2026-05-06T10:35:00Z'
          format: date-time
          type: string
        id:
          examples:
            - 019606a1-3b4c-7d8e-9f01-234567890abc
          type: string
        initiationType:
          examples:
            - DICT
          type: string
        qrCodeDetails: {}
        source:
          $ref: '#/components/schemas/SourceDestination'
        updatedAt:
          examples:
            - '2026-05-06T10:30:00Z'
          format: date-time
          type: string
      required:
        - id
        - initiationType
        - expiresAt
        - createdAt
        - updatedAt
      type: object
    LedgerInfo:
      additionalProperties: false
      properties:
        destinationOperationId:
          examples:
            - 019606a5-7f80-7182-3c4d-56789012cdf1
          type: string
        revert:
          $ref: '#/components/schemas/LedgerRevertInfo'
        sourceOperationId:
          examples:
            - 019606a5-7f80-7182-3c4d-56789012cdf0
          type: string
        transactionId:
          examples:
            - 019606a5-7f80-7182-3c4d-56789012cdef
          type: string
      type: object
    LedgerRevertInfo:
      additionalProperties: false
      properties:
        destinationOperationId:
          examples:
            - 019606a5-7f80-7182-3c4d-56789012cdf1
          type: string
        sourceOperationId:
          examples:
            - 019606a5-7f80-7182-3c4d-56789012cdf0
          type: string
        transactionId:
          examples:
            - 019606a5-7f80-7182-3c4d-56789012cdef
          type: string
      type: object
    LegacyErrorEnvelope:
      additionalProperties: false
      properties:
        code:
          description: PIX-XXXX error code
          type: string
        message:
          description: Human-readable error message
          type: string
        title:
          description: Short error title
          type: string
        fields:
          additionalProperties:
            type: string
          description: Per-field detail, keyed by the field or header the refusal names
          type: object
        headers:
          additionalProperties:
            type: string
          description: Per-header detail, keyed by the request header the refusal names
          type: object
      required:
        - code
        - title
        - message
      type: object
    LimitImpactItemView:
      additionalProperties: false
      properties:
        amount:
          type: string
        dateTotal:
          description: 'Total scheduled for that date. It travels with the row so the caller sees WHY a schedule is affected rather than only that it is: a small schedule sharing its date with a large one is unviable because of the other, and without this that reads as a bug.'
          type: string
        recurrenceId:
          type: string
        scheduleId:
          type: string
        scheduledDate:
          format: date
          type: string
      required:
        - scheduleId
        - scheduledDate
        - amount
        - dateTotal
      type: object
    LimitImpactPageView:
      additionalProperties: false
      properties:
        items:
          description: The affected schedules, soonest first. Empty when nothing is affected -- never null.
          items:
            $ref: '#/components/schemas/LimitImpactItemView'
          type:
            - array
            - 'null'
        nextCursor:
          type: string
        proposedLimit:
          description: Echoed back, so the page is self-describing when it is saved or forwarded.
          type: string
      required:
        - proposedLimit
        - items
      type: object
    OwnerDetails:
      additionalProperties: false
      properties:
        document:
          examples:
            - '12345678901'
          type: string
        name:
          examples:
            - João da Silva
          type: string
        tradeName:
          examples:
            - Empresa Exemplo LTDA
          type: string
        type:
          examples:
            - NATURAL_PERSON
          type: string
      required:
        - document
        - name
      type: object
    ParticipantView:
      additionalProperties: false
      properties:
        accountNumber:
          examples:
            - '123456'
          type: string
        accountType:
          enum:
            - CACC
            - SVGS
            - TRAN
            - SLRY
          examples:
            - CACC
          type: string
        branch:
          examples:
            - '0001'
          type: string
        ispb:
          description: 8-character BACEN participant identifier (digits or uppercase letters).
          examples:
            - '32074986'
          type: string
        name:
          examples:
            - Ana Souza
          type: string
        personType:
          enum:
            - NATURAL_PERSON
            - LEGAL_PERSON
          examples:
            - NATURAL_PERSON
          type: string
        taxId:
          description: CPF or CNPJ, digits only.
          examples:
            - '39053344705'
          type: string
      required:
        - accountType
        - ispb
        - personType
        - taxId
        - name
      type: object
    PayeeKeyBody:
      additionalProperties: false
      properties:
        keyType:
          description: Kind of Pix key.
          enum:
            - EMAIL
            - PHONE
            - CPF
            - CNPJ
            - EVP
          examples:
            - EMAIL
          type: string
        keyValue:
          description: 'The key itself. Resolved at creation to photograph the payee, and resolved AGAIN on the scheduled date: REG-Art.9§5 makes the re-lookup mandatory because a key can be reassigned in between.'
          examples:
            - joao.pereira@example.com
          type: string
      required:
        - keyType
        - keyValue
      type: object
    ProcessTransferBody:
      additionalProperties: false
      properties:
        amount:
          description: Confirmed amount (required unless locked by a fixed QR amount; a dynamic charge the payer may change only suggests one)
          examples:
            - '100.00'
          type: string
        initiationId:
          description: Initiation UUID returned by step 1
          examples:
            - 019606a1-3b4c-7d8e-9f01-234567890abc
          type: string
        metadata:
          additionalProperties: {}
          description: Caller-owned annotation, at most 4096 bytes as JSON. Pix Lerian stores it and returns it with the same content, and never reads it. It passes the object to the antifraud partner when the partner screens the Pix. The key order is not kept. A number keeps only double (IEEE 754) precision. Absent and empty are distinct.
          examples:
            - orderRef: A-4471
          type: object
      required:
        - initiationId
      type: object
    RefundCashoutOutput:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 019606a0-1a2b-7c3d-8e4f-567890123abc
          type: string
        amount:
          examples:
            - '100.00'
          type: string
        createdAt:
          examples:
            - '2026-05-06T10:45:00Z'
          format: date-time
          type: string
        deletedAt:
          format: date-time
          type: string
        description:
          examples:
            - Estorno solicitado pelo pagador
          type: string
        id:
          examples:
            - 019606b1-3b4c-7d8e-9f01-234567890dee
          type: string
        ledger:
          $ref: '#/components/schemas/LedgerInfo'
        metadata:
          additionalProperties: {}
          type: object
        originalEndToEndId:
          examples:
            - E12345678202605061030abcdef12345
          type: string
        reasonCode:
          examples:
            - MD06
          type: string
        returnEndToEndId:
          examples:
            - D12345678202605061045fedcba54321
          type: string
        status:
          examples:
            - COMPLETED
          type: string
        type:
          examples:
            - OUTBOUND
          type: string
        updatedAt:
          examples:
            - '2026-05-06T10:45:30Z'
          format: date-time
          type: string
        feeCharge:
          $ref: "#/components/schemas/FeeChargeResponse"
          description: "Fee the ledger reported on the create that moved the refund's money. Absent when no fee answer was recorded for this refund (its ledger create never landed, an error was logged at the time, or the refund was created before fees were read back); {\"applied\": false} when the ledger reported that no fee was charged; the full object when it charged one. A refund carries no ledger.revert field and needs none here: a FAILED refund that carries feeCharge was reverted first -- every path that writes a refund FAILED after its ledger create landed reverts the debit before marking it (a revert that does not complete leaves the refund PROCESSING), and every other path fails before any create -- so the fee was returned with the amount; applied reports what the create did and the object records the create."
      required:
        - id
        - originalEndToEndId
        - status
        - type
        - amount
        - reasonCode
        - createdAt
        - updatedAt
      type: object
    RefundsListOutput:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/RefundCashoutOutput'
          type:
            - array
            - 'null'
        next_cursor:
          examples:
            - eyJpZCI6IjAxOTYwNmIxLTNiNGMtN2Q4ZS05ZjAxLTIzNDU2Nzg5MGRlZSJ9
          type: string
        prev_cursor:
          examples:
            - eyJpZCI6IjAxOTYwNmIxLTNiNGMtN2Q4ZS05ZjAxLTIzNDU2Nzg5MGRlZSJ9
          type: string
      required:
        - items
      type: object
    ScheduleAttemptView:
      additionalProperties: false
      properties:
        attemptNumber:
          examples:
            - 1
          format: int64
          type: integer
        endToEndId:
          description: The identifier the attempt dispatched under. Reconciliation of an unknown outcome happens by this value, and it is never minted twice.
          type: string
        finishedAt:
          description: Present exactly when outcome is.
          format: date-time
          type: string
        id:
          type: string
        isLastAttempt:
          description: Whether the day's window schedule allowed a further attempt after this one.
          type: boolean
        outcome:
          description: How the attempt ended. The two OPERATIONAL_FAILURE members are distinct because only the pre-dispatch one is safe to retry.
          enum:
            - SETTLED
            - INSUFFICIENT_FUNDS
            - INSUFFICIENT_LIMIT
            - OWNERSHIP_MISMATCH
            - KEY_NOT_FOUND
            - CHARGE_AMOUNT_CHANGED
            - CHARGE_NOT_PAYABLE
            - OPERATIONAL_FAILURE_PRE_DISPATCH
            - OPERATIONAL_FAILURE_POST_DISPATCH
          type: string
        providerChannel:
          description: The CSM channel the attempt went out on. UNKNOWN is a real answer from a rail that cannot report one.
          enum:
            - PRIMARY
            - SECONDARY
            - UNKNOWN
          type: string
        startedAt:
          format: date-time
          type: string
      required:
        - id
        - attemptNumber
        - isLastAttempt
        - startedAt
      type: object
    ScheduledPaymentReceiptView:
      additionalProperties: false
      properties:
        amount:
          description: Amount to settle, in BRL.
          type: string
        cancellationCutoff:
          description: The deadline recorded for this schedule -- the one the payer was told, not one recomputed today.
          format: date-time
          type: string
        description:
          description: The payer's memo, exactly as stored. Not escaped here and not escaped on the way in.
          type: string
        payee:
          $ref: '#/components/schemas/ParticipantView'
          description: The payee as photographed at creation.
        payer:
          $ref: '#/components/schemas/ParticipantView'
          description: The payer as photographed at creation.
        scheduleId:
          description: Schedule identifier.
          type: string
        scheduledAt:
          description: When the schedule was registered.
          format: date-time
          type: string
        scheduledDate:
          description: Civil settlement date in AAAA-MM-DD.
          format: date
          type: string
        brCodePayload:
          description: The BR Code the payer submitted, stored and returned VERBATIM -- re-serialising it would break the CRC-16 the standard embeds, and the receipt would show a code that pays nobody. Present only when initiationType is QR_CODE.
          examples:
            - 00020101021226900014br.gov.bcb.pix2568qrcodepix.exemplo.com.br/cobv/8f3a1c2d4e5b6f7a8b9c0d1e2f3a4b5c52040000530398654071500.005802BR5919Mercado Central LTDA6008BRASILIA62070503***6304A1B2
          type: string
        txId:
          description: Identifier of the due-date collection this schedule pays, as carried by the BR Code. Present only when initiationType is QR_CODE.
          examples:
            - COBV20260910MERCADOCENTRAL0001
          type: string
      required:
        - scheduleId
        - scheduledDate
        - amount
        - scheduledAt
        - payer
        - payee
        - cancellationCutoff
      type: object
    ScheduledPaymentView:
      additionalProperties: false
      properties:
        accountId:
          description: Payer account.
          examples:
            - 019606a1-3b4c-7d8e-9f01-234567890abc
          type: string
        amount:
          description: Amount to settle, in BRL.
          examples:
            - '150.00'
          type: string
        attempts:
          description: Every attempt of the scheduled day, oldest first. Empty before that date, and never null.
          items:
            $ref: '#/components/schemas/ScheduleAttemptView'
          type:
            - array
            - 'null'
        cancellationCutoff:
          description: The first instant a cancellation is REFUSED. Cancellation is accepted right up to it and refused AT it, and it is strictly before the first window so the two can never overlap.
          format: date-time
          type: string
        cancelledReason:
          description: "Present exactly when status is CANCELLED. A cancellation the payer asked for and one the domain performed are deliberately distinguishable. CHARGE_AMOUNT_CHANGED and CHARGE_NOT_PAYABLE: on the scheduled date the QR charge asked another amount, or the receiver refused reading it (the charge was removed, concluded or expired); nothing was debited. A failed check of the receiver's site or signature cancels nothing: like a receiver that does not answer, it pays the recorded amount."
          enum:
            - USER_REQUEST
            - OWNERSHIP_MISMATCH
            - KEY_NOT_FOUND
            - CHARGE_AMOUNT_CHANGED
            - CHARGE_NOT_PAYABLE
            - RECURRENCE_CANCELLED
          type: string
        createdAt:
          format: date-time
          type: string
        currency:
          description: Always BRL.
          examples:
            - BRL
          type: string
        description:
          description: The payer's memo, returned exactly as it was stored. Markup is not interpreted here and was not escaped on the way in; escaping belongs to whoever renders it.
          examples:
            - Aluguel de setembro
          type: string
        destination:
          $ref: '#/components/schemas/ParticipantView'
          description: The payee as photographed at creation. On a DICT schedule it is compared on the scheduled date against a fresh directory answer (REG-Art.9§6), which is why it is stored rather than re-resolved; a MANUAL or QR_CODE schedule is sent to it as photographed, with no second lookup.
        firstWindowOpensAt:
          description: When the first settlement window of the scheduled date opens (IN 513 art. 12 caput). Photographed at creation.
          format: date-time
          type: string
        id:
          description: Schedule identifier.
          examples:
            - 019606a1-3b4c-7d8e-9f01-234567890abc
          type: string
        initiationType:
          description: How the destination was resolved.
          enum:
            - MANUAL
            - DICT
            - QR_CODE
          examples:
            - DICT
          type: string
        purpose:
          description: 'Always IPAY: REG-Art.11-P prohibits scheduling any other purpose.'
          enum:
            - IPAY
          examples:
            - IPAY
          type: string
        scheduledDate:
          description: Civil settlement date in AAAA-MM-DD, in America/Sao_Paulo.
          examples:
            - '2026-09-10'
          format: date
          type: string
        source:
          $ref: '#/components/schemas/ParticipantView'
          description: The payer as photographed at creation.
        status:
          description: 'Lifecycle status. DISPATCHED_OUTCOME_UNKNOWN is NOT terminal: the order is awaiting reconciliation and will resolve to SETTLED or FAILED. It does NOT assert that the order reached the rail -- it also covers an order that provably did not, whose reserved funds are still being released.'
          enum:
            - PENDING
            - EXECUTING
            - DISPATCHED_OUTCOME_UNKNOWN
            - AWAITING_RETRY
            - SETTLED
            - CANCELLED
            - FAILED
          examples:
            - PENDING
          type: string
        transferId:
          description: The transfer that settled this schedule, once it has.
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - accountId
        - scheduledDate
        - amount
        - currency
        - initiationType
        - purpose
        - source
        - destination
        - status
        - firstWindowOpensAt
        - cancellationCutoff
        - createdAt
        - updatedAt
        - attempts
      type: object
    ScheduledPaymentsPage:
      additionalProperties: false
      properties:
        items:
          description: The page, newest settlement date first. Never null.
          items:
            $ref: '#/components/schemas/ScheduledPaymentView'
          type:
            - array
            - 'null'
        nextCursor:
          description: Pass back as cursor for the following page. Absent on the last page -- its absence is how the listing ends, not an empty items array.
          type: string
      required:
        - items
      type: object
    ScheduledTotalsView:
      additionalProperties: false
      properties:
        accountId:
          type: string
        currency:
          examples:
            - BRL
          type: string
        nightPeriodScheduleCount:
          format: int64
          type: integer
        nightPeriodTotal:
          description: 'The IN 512 art. 7 §7 slice: created inside the night period, settling the NEXT day, to a natural person distinct from the payer. This is NOT the general night period of art. 3 -- it is a separate rule with its own fixed shape. Present only when night_period_start was supplied.'
          type: string
        scheduleCount:
          description: How many schedules the total sums, so a zero total can be told apart from an absent one.
          format: int64
          type: integer
        scheduledDate:
          format: date
          type: string
        total:
          description: Sum of every NON-TERMINAL schedule for that account on that date. Cancelled and failed schedules are excluded, because neither will move money.
          type: string
      required:
        - accountId
        - scheduledDate
        - total
        - currency
        - scheduleCount
      type: object
    SourceDestination:
      additionalProperties: false
      properties:
        account:
          $ref: '#/components/schemas/AccountDetails'
        key:
          examples:
            - '+5511999998888'
          type: string
        owner:
          $ref: '#/components/schemas/OwnerDetails'
      type: object
    TransferResponse:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 019606a0-1a2b-7c3d-8e4f-567890123abc
          type: string
        aliasId:
          type: string
        alreadyRefundedAmount:
          description: Cross-mechanism settled and reserved refund amount. Returned only for INBOUND transfers.
          examples:
            - '60.00'
          type: string
        amount:
          examples:
            - '100.00'
          type: string
        createdAt:
          examples:
            - '2026-05-06T10:30:00Z'
          format: date-time
          type: string
        currency:
          examples:
            - BRL
          type: string
        deletedAt:
          format: date-time
          type: string
        description:
          examples:
            - Pagamento de aluguel
          type: string
        destination:
          $ref: '#/components/schemas/SourceDestination'
        endToEndId:
          examples:
            - E12345678202605061030abcdef12345
          type: string
        feeCharge:
          $ref: '#/components/schemas/FeeChargeResponse'
          description: "Fee the ledger reported on the transfer. Absent when the ledger's fee answer was not recorded for this transfer (an error logged at the time, or a transfer created before fees were read back); {\"applied\": false} when the ledger reported that no fee was charged; the full object when it charged one."
        fraudCheck:
          $ref: '#/components/schemas/FraudCheckResponse'
          description: "The antifraud partner's answer for a Pix, as the partner gave it. Present on a transfer that the institution's antifraud partner evaluated: a received Pix that was approved, or a sent Pix, allowed or refused. Absent when the flow is off and on Pix Automático settlements."
        id:
          examples:
            - 019606a2-4c5d-7e8f-90a1-345678901bcd
          type: string
        initiatedAt:
          examples:
            - '2026-05-06T10:30:00Z'
          format: date-time
          type: string
        initiationType:
          examples:
            - DICT
          type: string
        ledger:
          $ref: '#/components/schemas/LedgerInfo'
        metadata:
          additionalProperties: {}
          type: object
        paymentType:
          examples:
            - PIX
          type: string
        purpose:
          examples:
            - IACT
          type: string
        remainingRefundableAmount:
          description: Amount minus alreadyRefundedAmount. Returned only for INBOUND transfers and can be negative.
          examples:
            - '40.00'
          type: string
        source:
          $ref: '#/components/schemas/SourceDestination'
        status:
          examples:
            - COMPLETED
          type: string
        type:
          examples:
            - OUTBOUND
          type: string
        updatedAt:
          examples:
            - '2026-05-06T10:30:05Z'
          format: date-time
          type: string
        urgency:
          examples:
            - HIGH
          type: string
      required:
        - id
        - endToEndId
        - status
        - type
        - amount
        - createdAt
        - updatedAt
      type: object
    TransfersListOutput:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/TransferResponse'
          type:
            - array
            - 'null'
        next_cursor:
          examples:
            - eyJpZCI6IjAxOTYwNmEyLTRjNWQtN2U4Zi05MGExLTM0NTY3ODkwMTJjZCJ9
          type: string
        prev_cursor:
          examples:
            - eyJpZCI6IjAxOTYwNmEyLTRjNWQtN2U4Zi05MGExLTM0NTY3ODkwMTJjY30=
          type: string
      required:
        - items
      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
    CreateRecurrenceBody:
      additionalProperties: false
      properties:
        accountId:
          description: Payer account UUID. The payer travels in the body rather than in a header because a series is written once and read for months afterwards, so it belongs to the record rather than to the transport.
          examples:
            - 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
          format: uuid
          type: string
        amount:
          description: Amount of EVERY occurrence, in BRL with two decimals. The available balance is NOT touched at creation, nor by the occurrences this call materializes.
          examples:
            - "150.00"
          type: string
        currency:
          description: Always BRL. Present for forward compatibility only.
          enum:
            - BRL
          examples:
            - BRL
          type: string
        description:
          description: Free-text memo carried by every occurrence, at most 140 characters -- the RmtInf ceiling. Stored and returned VERBATIM.
          examples:
            - Aluguel
          maxLength: 140
          type: string
        destination:
          $ref: "#/components/schemas/DestinationBody"
          description: The payee's account and owner. Required when initiationType is MANUAL; refused on DICT (422 PIX-0751; first 400 PIX-0002 if a field of it is missing, 400 PIX-0003 if one is invalid).
        initiationType:
          description: "How the destination is resolved, once, at creation. DICT reads the directory and requires payeeKey; MANUAL requires destination. The two blocks are mutually exclusive: a DICT body that also carries destination, or a MANUAL body that also carries payeeKey, is refused rather than resolved from one of them. A well-formed block of another type is refused with 422 PIX-0751; one with a missing field fails request validation first (400 PIX-0002), and one with an invalid field likewise (400 PIX-0003). The key is stored with the series because REG-Art.9 section 5 makes the directory re-lookup mandatory before EVERY occurrence settles. QR_CODE is REFUSED on this route with PIX-0751: a BR Code names one collection, and a series reusing it would pay that same collection every period. Use the single scheduled-payments route for a BR Code."
          enum:
            - MANUAL
            - DICT
            - QR_CODE
          examples:
            - DICT
          type: string
        metadata:
          additionalProperties: {}
          description: "Caller-owned annotation, stored and returned verbatim. This service never reads a key nor derives behaviour from a value. Absent and empty are distinct: absent stays null on read."
          examples:
            - contractRef: A-4471
          type: object
        payeeKey:
          $ref: "#/components/schemas/PayeeKeyBody"
          description: The Pix key to resolve. Required when initiationType is DICT; refused on MANUAL (422 PIX-0751; first 400 PIX-0002 if a field of it is missing, 400 PIX-0003 if one is invalid).
        purpose:
          description: Only IPAY can be scheduled. Pix Saque (OTHR) and Pix Troco (GSCB) are point-in-time operations and REG-Art.11-P prohibits scheduling them.
          enum:
            - IPAY
          examples:
            - IPAY
          type: string
        recurrence:
          $ref: "#/components/schemas/RecurrenceSpecBody"
          description: The rule that describes the series.
      required:
        - accountId
        - amount
        - initiationType
        - recurrence
      type: object
    PayeeKeyView:
      additionalProperties: false
      properties:
        keyType:
          description: Kind of Pix key.
          enum:
            - EMAIL
            - PHONE
            - CPF
            - CNPJ
            - EVP
          examples:
            - EMAIL
          type: string
        keyValue:
          description: The key itself, as it was resolved.
          examples:
            - joao.pereira@example.com
          type: string
      required:
        - keyType
        - keyValue
      type: object
    RecurrenceCancellationView:
      additionalProperties: false
      properties:
        cancelledOccurrences:
          description: How many occurrences this request moved to CANCELLED. It counts ONLY the ones that were still PENDING, and it is the row count of the write itself rather than a census taken beforehand.
          examples:
            - 5
          format: int64
          type: integer
        recurrenceId:
          description: The series that was stopped.
          examples:
            - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
          type: string
        skippedOccurrences:
          description: How many materialized occurrences this request did not change, because they were not PENDING. Together with cancelledOccurrences it accounts for every occurrence the series had.
          examples:
            - 1
          format: int64
          type: integer
        status:
          description: The series' status after the operation. Always CANCELLED on a 200 -- a series that could not be stopped answers PIX-0765 instead of reporting an unchanged status.
          enum:
            - ACTIVE
            - COMPLETED
            - CANCELLED
          examples:
            - CANCELLED
          type: string
      required:
        - recurrenceId
        - status
        - cancelledOccurrences
        - skippedOccurrences
      type: object
    RecurrenceDetailView:
      additionalProperties: false
      properties:
        accountId:
          description: Payer account.
          examples:
            - 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
          type: string
        amount:
          description: Amount of every occurrence, in BRL.
          examples:
            - "150.00"
          type: string
        createdAt:
          format: date-time
          type: string
        currency:
          description: Always BRL.
          examples:
            - BRL
          type: string
        description:
          description: The payer's memo, carried by every occurrence and returned exactly as stored.
          examples:
            - Aluguel
          type: string
        destination:
          $ref: "#/components/schemas/ParticipantView"
          description: The payee as photographed at creation. On a DICT series it is compared, before EVERY occurrence settles, against a fresh directory answer (REG-Art.9 section 6), which is why it is stored rather than re-resolved; the occurrences of a MANUAL series are sent to it as photographed, with no second lookup.
        id:
          description: Series identifier.
          examples:
            - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
          type: string
        initiationType:
          description: How the destination was resolved at creation.
          enum:
            - MANUAL
            - DICT
            - QR_CODE
          examples:
            - DICT
          type: string
        lastPaymentDate:
          description: Civil date of the series' final payment, when it has one. Null on an indefinite series, where reporting one would be a fabrication.
          examples:
            - "2028-07-10"
          format: date
          type:
            - string
            - "null"
        materializedThrough:
          description: Civil date up to which occurrences exist -- the edge of the materialized window. Occurrences beyond it do not exist yet. Null on a series that has never been materialized.
          examples:
            - "2027-10-10"
          format: date
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          description: The annotation the caller sent at creation, returned verbatim. Absent when none was sent -- this service never invents one.
          examples:
            - contractRef: A-4471
          type: object
        occurrences:
          description: The currently materialized occurrences, oldest first -- NOT necessarily the whole series. materializedThrough states how far the window reaches, and a long-running series is enumerated in full through GET /v1/scheduled-payments?recurrence_id=. Empty and never null.
          items:
            $ref: "#/components/schemas/ScheduledPaymentView"
          type: array
        payeeKey:
          $ref: "#/components/schemas/PayeeKeyView"
          description: The directory key a DICT-initiated series resolved at creation. It is kept because the mandatory re-lookup needs the key that was used, and a key is not one of the payee's attributes -- it cannot be reconstructed from the photograph above.
        purpose:
          description: "Always IPAY: REG-Art.11-P prohibits scheduling any other purpose."
          enum:
            - IPAY
          examples:
            - IPAY
          type: string
        recurrence:
          $ref: "#/components/schemas/RecurrenceSpecView"
          description: The rule the occurrences are computed from.
        source:
          $ref: "#/components/schemas/ParticipantView"
          description: The payer as photographed at creation.
        status:
          description: "Situation of the SERIES, not of any one occurrence: a cancelled series still has settled occurrences behind it, and each occurrence carries its own status."
          enum:
            - ACTIVE
            - COMPLETED
            - CANCELLED
          examples:
            - ACTIVE
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - occurrences
        - id
        - accountId
        - amount
        - currency
        - status
        - initiationType
        - purpose
        - recurrence
        - source
        - destination
        - materializedThrough
        - lastPaymentDate
        - createdAt
        - updatedAt
      type: object
    RecurrenceReceiptView:
      additionalProperties: false
      properties:
        amount:
          description: Amount of every occurrence, in BRL.
          examples:
            - "150.00"
          type: string
        cancellationCutoff:
          description: Deadline to cancel the NEXT pending occurrence. A cut-off belongs to a date and a series spans many, so this is the one field here that is not a property of the series itself. Null when no occurrence is pending -- there is then nothing left to cancel in the materialized window.
          format: date-time
          type:
            - string
            - "null"
        description:
          description: The payer's memo, exactly as stored.
          examples:
            - Aluguel
          type: string
        firstPaymentDate:
          description: Civil date of the first payment.
          examples:
            - "2027-08-10"
          format: date
          type: string
        lastPaymentDate:
          description: Civil date of the final payment, when the series has one. Null on an indefinite series.
          examples:
            - "2028-07-10"
          format: date
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          description: The annotation the caller sent at creation, returned verbatim.
          examples:
            - contractRef: A-4471
          type: object
        payee:
          $ref: "#/components/schemas/ParticipantView"
          description: The payee as photographed at creation.
        payer:
          $ref: "#/components/schemas/ParticipantView"
          description: The payer as photographed at creation.
        paymentCount:
          description: How many payments the series has in all, when the payer terminated it by count. Null otherwise -- an indefinite series has no total, and reporting one would be a fabrication.
          examples:
            - 12
          format: int64
          type:
            - integer
            - "null"
        periodicity:
          description: How often the series pays.
          enum:
            - WEEKLY
            - MONTHLY
          examples:
            - MONTHLY
          type: string
        recurrenceId:
          description: Series identifier.
          examples:
            - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
          type: string
        scheduledAt:
          description: When the series was registered.
          format: date-time
          type: string
      required:
        - recurrenceId
        - scheduledAt
        - amount
        - firstPaymentDate
        - periodicity
        - paymentCount
        - lastPaymentDate
        - payer
        - payee
        - cancellationCutoff
      type: object
    RecurrenceSpecBody:
      additionalProperties: false
      properties:
        endDate:
          description: Termination by civil date. It may equal firstPaymentDate, which is a legitimate series of one payment.
          examples:
            - "2028-07-10"
          format: date
          type: string
        firstPaymentDate:
          description: "Civil date of the first payment, in America/Sao_Paulo. Never an instant: a date that is still today in UTC can already be yesterday here. It is used VERBATIM as the first occurrence and, on a monthly series, is what the reference day is derived from. Today is accepted only before 08:00 in America/Sao_Paulo (PIX-0758)."
          examples:
            - "2027-08-10"
          format: date
          type: string
        indefinite:
          description: "An open-ended series. This IS a termination criterion the payer chose -- supply exactly one of the three. Sending none is refused with PIX-0761 rather than read as open-ended: silence is a series nobody can say when to stop paying."
          examples:
            - false
          type: boolean
        paymentCount:
          description: "Termination by number of payments. NO ceiling is imposed: REG-Art.37-A forbids limiting the quantity of a user's transactions."
          examples:
            - 12
          format: int64
          minimum: 1
          type: integer
        periodicity:
          description: How often the series pays. QUARTERLY, SEMIANNUAL and ANNUALLY belong to Pix Automatico and are refused here by request validation (400 PIX-0003).
          enum:
            - WEEKLY
            - MONTHLY
          examples:
            - MONTHLY
          type: string
      required:
        - periodicity
        - firstPaymentDate
      type: object
    RecurrenceSpecView:
      additionalProperties: false
      properties:
        endDate:
          description: Termination by civil date, when that is the criterion. Null otherwise.
          examples:
            - "2028-07-10"
          format: date
          type:
            - string
            - "null"
        firstPaymentDate:
          description: Civil date of the first payment, exactly as the payer chose it.
          examples:
            - "2027-08-10"
          format: date
          type: string
        indefinite:
          description: True when the series is open-ended. Exactly one of the three criteria is set.
          examples:
            - false
          type: boolean
        paymentCount:
          description: Termination by number of payments, when that is the criterion. Null otherwise.
          examples:
            - 12
          format: int64
          type:
            - integer
            - "null"
        periodicity:
          description: How often the series pays.
          enum:
            - WEEKLY
            - MONTHLY
          examples:
            - MONTHLY
          type: string
        referenceDayOfMonth:
          description: Day of the month a MONTHLY series pays on, derived from firstPaymentDate and PRESERVED across occurrences. Null on a weekly series. When a month has no such day -- 29, 30, 31 -- IN BCB 513/2024 art. 13 moves that occurrence to the FIRST DAY OF THE FOLLOWING MONTH and the reference day returns afterwards, so a day-31 series pays on 1 March and again on 31 March.
          examples:
            - 10
          format: int64
          type:
            - integer
            - "null"
      required:
        - periodicity
        - firstPaymentDate
        - paymentCount
        - endDate
        - indefinite
        - referenceDayOfMonth
      type: object
    RecurrenceView:
      additionalProperties: false
      properties:
        accountId:
          description: Payer account.
          examples:
            - 0195948b-bf02-7e4f-9a1b-2c3d4e5f6a7b
          type: string
        amount:
          description: Amount of every occurrence, in BRL.
          examples:
            - "150.00"
          type: string
        createdAt:
          format: date-time
          type: string
        currency:
          description: Always BRL.
          examples:
            - BRL
          type: string
        description:
          description: The payer's memo, carried by every occurrence and returned exactly as stored.
          examples:
            - Aluguel
          type: string
        destination:
          $ref: "#/components/schemas/ParticipantView"
          description: The payee as photographed at creation. On a DICT series it is compared, before EVERY occurrence settles, against a fresh directory answer (REG-Art.9 section 6), which is why it is stored rather than re-resolved; the occurrences of a MANUAL series are sent to it as photographed, with no second lookup.
        id:
          description: Series identifier.
          examples:
            - 01a0d8fb-1a8b-7a10-b3c4-d5e6f7a8b9c0
          type: string
        initiationType:
          description: How the destination was resolved at creation.
          enum:
            - MANUAL
            - DICT
            - QR_CODE
          examples:
            - DICT
          type: string
        lastPaymentDate:
          description: Civil date of the series' final payment, when it has one. Null on an indefinite series, where reporting one would be a fabrication.
          examples:
            - "2028-07-10"
          format: date
          type:
            - string
            - "null"
        materializedThrough:
          description: Civil date up to which occurrences exist -- the edge of the materialized window. Occurrences beyond it do not exist yet. Null on a series that has never been materialized.
          examples:
            - "2027-10-10"
          format: date
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          description: The annotation the caller sent at creation, returned verbatim. Absent when none was sent -- this service never invents one.
          examples:
            - contractRef: A-4471
          type: object
        payeeKey:
          $ref: "#/components/schemas/PayeeKeyView"
          description: The directory key a DICT-initiated series resolved at creation. It is kept because the mandatory re-lookup needs the key that was used, and a key is not one of the payee's attributes -- it cannot be reconstructed from the photograph above.
        purpose:
          description: "Always IPAY: REG-Art.11-P prohibits scheduling any other purpose."
          enum:
            - IPAY
          examples:
            - IPAY
          type: string
        recurrence:
          $ref: "#/components/schemas/RecurrenceSpecView"
          description: The rule the occurrences are computed from.
        source:
          $ref: "#/components/schemas/ParticipantView"
          description: The payer as photographed at creation.
        status:
          description: "Situation of the SERIES, not of any one occurrence: a cancelled series still has settled occurrences behind it, and each occurrence carries its own status."
          enum:
            - ACTIVE
            - COMPLETED
            - CANCELLED
          examples:
            - ACTIVE
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - accountId
        - amount
        - currency
        - status
        - initiationType
        - purpose
        - recurrence
        - source
        - destination
        - materializedThrough
        - lastPaymentDate
        - createdAt
        - updatedAt
      type: object
    RecurrencesPage:
      additionalProperties: false
      properties:
        items:
          description: The page, newest first. Never null.
          items:
            $ref: "#/components/schemas/RecurrenceView"
          type: array
        nextCursor:
          description: Pass back as cursor for the following page. Absent on the last page -- its absence is how the listing ends, not an empty items array.
          type: string
      required:
        - items
      type: object
    CreateSettleResponse:
      additionalProperties: false
      properties:
        already_settled:
          examples:
            - "0.00"
          type: string
        initiated_at:
          examples:
            - "2026-10-27T14:05:12Z"
          format: date-time
          type: string
        lock_id:
          examples:
            - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          type: string
        original_amount:
          examples:
            - "150.75"
          type: string
        payment_type:
          examples:
            - PIX_MANUAL
          type: string
        requested_amount:
          examples:
            - "80.13"
          type: string
        settle_amount:
          examples:
            - "80.13"
          type: string
        status:
          examples:
            - SETTLING
          type: string
        surplus_amount:
          description: pixManual surplus (the lock's effective amount minus settle_amount) that the settle confirmation returns to the customer once the lock is SETTLED; nothing is returned by this call. Always 0 for pixRefund.
          examples:
            - "20.13"
          type: string
        surplus_midaz_tx_id:
          description: "Not filled: the surplus is returned by the settle confirmation, whose response carries the transaction id. Kept in the schema for compatibility."
          examples:
            - 01a17dae-b16e-7f28-9a03-6b1c4d8e2f75
          type: string
      required:
        - lock_id
        - payment_type
        - status
        - original_amount
        - requested_amount
        - already_settled
        - settle_amount
        - surplus_amount
        - initiated_at
      type: object
    CreateSettleBody:
      additionalProperties: false
      properties:
        original_amount:
          description: Original transaction face value (ceiling)
          examples:
            - "150.75"
          type: string
        pix_manual:
          $ref: "#/components/schemas/SettlePixManualInput"
        pix_refund:
          $ref: "#/components/schemas/SettlePixRefundInput"
        refund_ref:
          description: Idempotency key for this settle
          examples:
            - med-2026-000123-devolution
          type: string
      required:
        - refund_ref
        - original_amount
      type: object
    CreateBalanceLockBody:
      additionalProperties: false
      properties:
        amount:
          description: Requested hold amount
          examples:
            - "150.75"
          type: string
        asset:
          description: Asset code (only BRL supported)
          examples:
            - BRL
          type: string
        end_to_end_id:
          description: Related Pix transaction end-to-end id
          examples:
            - E12345678202610271032k7Qm2Xp9Ld4
          type: string
        external_ref:
          description: Grouping reference (not unique)
          examples:
            - med-2026-000123
          type: string
        origin_system:
          description: Calling system/flow discriminator
          examples:
            - med-infraction
          type: string
        request_ref:
          description: Idempotency key for this creation (unique per tenant)
          examples:
            - med-2026-000123-hold-1
          type: string
      required:
        - request_ref
        - external_ref
        - origin_system
        - end_to_end_id
        - amount
        - asset
      type: object
    CreateBalanceLockResponse:
      additionalProperties: false
      properties:
        created_at:
          examples:
            - "2026-10-27T10:41:07Z"
          format: date-time
          type: string
        effective_amount:
          examples:
            - "100.26"
          type: string
        lock_id:
          examples:
            - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          type: string
        midaz_tx_id:
          description: The ledger hold; empty while AWAITING_CREDIT
          examples:
            - 01a17cf3-133d-7a52-8e19-0c4b6d2f7a91
          type: string
        requested_amount:
          examples:
            - "150.75"
          type: string
        status:
          description: PENDING, or AWAITING_CREDIT while the Pix's ledger credit is parked and nothing is held yet
          examples:
            - PENDING
          type: string
      required:
        - lock_id
        - midaz_tx_id
        - status
        - requested_amount
        - effective_amount
        - created_at
      type: object
    ListBalanceLocksOutput:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: "#/components/schemas/BalanceLockListItem"
          type:
            - array
            - "null"
        next_cursor:
          type:
            - string
            - "null"
      required:
        - items
        - next_cursor
      type: object
    ReturnSurplusResponse:
      additionalProperties: false
      properties:
        lock_id:
          examples:
            - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          type: string
        returned_at:
          examples:
            - "2026-10-27T15:02:41Z"
          format: date-time
          type: string
        surplus_amount:
          examples:
            - "0.00"
          type: string
        surplus_midaz_tx_id:
          description: "Midaz transaction that moved the surplus: created by this call, or already recorded on the lock or, for a group settle, on another lock of the same group (then surplus_amount is 0). Absent when no surplus transfer exists."
          examples:
            - 01a17dae-b16e-7f28-9a03-6b1c4d8e2f75
          type: string
      required:
        - lock_id
        - surplus_amount
        - returned_at
      type: object
    SettleQuoteResponse:
      additionalProperties: false
      properties:
        already_settled:
          examples:
            - "100.26"
          type: string
        available_to_settle:
          examples:
            - "50.49"
          type: string
        original_amount:
          examples:
            - "150.75"
          type: string
      required:
        - original_amount
        - already_settled
        - available_to_settle
      type: object
    CreateGroupSettleResponse:
      additionalProperties: false
      properties:
        already_settled:
          examples:
            - "0.00"
          type: string
        initiated_at:
          examples:
            - "2026-10-27T14:05:12Z"
          format: date-time
          type: string
        lock_ids:
          items:
            type: string
          type:
            - array
            - "null"
        original_amount:
          examples:
            - "150.75"
          type: string
        payment_type:
          examples:
            - PIX_REFUND
          type: string
        refund_ref:
          examples:
            - med-2026-000123-group-devolution
          type: string
        settle_amount:
          examples:
            - "150.75"
          type: string
        status:
          examples:
            - SETTLING
          type: string
        surplus_amount:
          description: pixManual group surplus (soma_efetiva minus settle_amount) that the SUCCESS group confirm returns once every lock is SETTLED; nothing is returned by this call. Always 0 for pixRefund.
          examples:
            - "0.00"
          type: string
      required:
        - refund_ref
        - payment_type
        - status
        - original_amount
        - already_settled
        - settle_amount
        - surplus_amount
        - lock_ids
        - initiated_at
      type: object
    CreateGroupSettleBody:
      additionalProperties: false
      properties:
        lock_ids:
          description: Concrete block ids to settle together
          examples:
            -   - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          items:
            type: string
          type:
            - array
            - "null"
        original_amount:
          description: Contested transaction face value (ceiling)
          examples:
            - "150.75"
          type: string
        original_end_to_end_id:
          description: Contested transaction end-to-end id
          examples:
            - E12345678202610271032k7Qm2Xp9Ld4
          type: string
        pix_manual:
          $ref: "#/components/schemas/GroupSettlePixManualBody"
        pix_refund:
          $ref: "#/components/schemas/GroupSettlePixRefundBody"
        refund_ref:
          description: Group key shared by the N blocks
          examples:
            - med-2026-000123-group-devolution
          type: string
      required:
        - refund_ref
        - lock_ids
        - original_amount
        - original_end_to_end_id
      type: object
    UnlockBalanceResponse:
      additionalProperties: false
      properties:
        lock_id:
          examples:
            - 01a17d06-7910-7b35-9f4e-1c8a2d6e3b57
          type: string
        release_midaz_tx_id:
          description: Ledger transaction that moved the funds from the institution's blocking account back to the account holder, for a lock whose funds a rejected pixManual settle had already moved there. Absent when the release cancelled a pending hold.
          examples:
            - 01a17e12-4c3b-7d61-8b2f-3e9a5c7d1f48
          type: string
        released_at:
          examples:
            - "2026-10-27T11:15:30Z"
          format: date-time
          type: string
        status:
          examples:
            - RELEASED
          type: string
      required:
        - lock_id
        - status
        - released_at
      type: object
    CloseBalanceLockResponse:
      additionalProperties: false
      properties:
        closed_at:
          examples:
            - "2026-10-27T16:20:00Z"
          format: date-time
          type: string
        closed_manually:
          examples:
            - true
          type: boolean
        lock_id:
          examples:
            - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          type: string
        pix_end_to_end_id:
          examples:
            - D87654321202610271405r4Tn8Wq2Kx6
          type: string
        status:
          examples:
            - SETTLED
          type: string
      required:
        - lock_id
        - status
        - pix_end_to_end_id
        - closed_manually
        - closed_at
      type: object
    CloseBalanceLockBody:
      additionalProperties: false
      properties:
        end_to_end_id:
          description: Externally-executed devolution/transfer end-to-end id
          examples:
            - D87654321202610271405r4Tn8Wq2Kx6
          type: string
        notes:
          type: string
        payment_type:
          description: Required when closing from PENDING; preserved when SETTLING
          examples:
            - PIX_REFUND
          type: string
        settled_amount:
          description: Amount the manual devolution returned to the payer. Defaults to, and cannot exceed, the lock's effective_amount or, on a SETTLING lock, the amount its settle reserved; a SETTLING pixManual lock takes exactly that amount
          examples:
            - "100.26"
          type: string
      required:
        - end_to_end_id
      type: object
    ConfirmSettleResponse:
      additionalProperties: false
      properties:
        failure_reason:
          type: string
        lock_id:
          examples:
            - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          type: string
        payment_type:
          examples:
            - PIX_MANUAL
          type: string
        pix_end_to_end_id:
          examples:
            - E87654321202610271405m3Hs7Yc5Pv1
          type: string
        reset_at:
          examples:
            - "2026-10-27T14:06:03Z"
          format: date-time
          type: string
        settled_at:
          examples:
            - "2026-10-27T14:06:03Z"
          format: date-time
          type: string
        status:
          examples:
            - SETTLED
          type: string
        surplus_midaz_tx_id:
          description: "On SETTLED, the Midaz transaction that returned the pixManual surplus to the customer: made by this confirm once the lock is SETTLED, or already recorded (a replay, or a group member's). Absent when there is no surplus, or when the best-effort return failed -- recover it with POST /balance-locks/{lock_id}/return-surplus."
          examples:
            - 01a17dae-b16e-7f28-9a03-6b1c4d8e2f75
          type: string
      required:
        - lock_id
        - status
      type: object
    ListBalanceLockAuditResponse:
      additionalProperties: false
      properties:
        entries:
          items:
            $ref: "#/components/schemas/BalanceLockAuditEntryResponse"
          type:
            - array
            - "null"
      required:
        - entries
      type: object
    ConfirmGroupSettleResponse:
      additionalProperties: false
      properties:
        already_settled:
          examples:
            - "0.00"
          type: string
        failure_reason:
          examples:
            - aggregated group devolution reported FAILED by caller
          type: string
        original_amount:
          examples:
            - "150.75"
          type: string
        payment_type:
          examples:
            - PIX_REFUND
          type: string
        pix_end_to_end_id:
          examples:
            - D87654321202610271405g7Bv3Nc9Jw2
          type: string
        refund_ref:
          examples:
            - med-2026-000123-group-devolution
          type: string
        reset_at:
          examples:
            - "2026-10-27T14:06:03Z"
          format: date-time
          type: string
        settle_amount:
          examples:
            - "150.75"
          type: string
        settled_at:
          examples:
            - "2026-10-27T14:06:03Z"
          format: date-time
          type: string
        status:
          examples:
            - SETTLED
          type: string
        surplus_amount:
          examples:
            - "0.00"
          type: string
        surplus_midaz_tx_id:
          description: "On SETTLED, the Midaz transaction that returned the pixManual group surplus to the customer: made by this confirm once every lock is SETTLED, or already recorded on the group (a replay). Absent when there is no surplus, or when the best-effort return failed -- recover it with POST /balance-locks/{lock_id}/return-surplus on the lock that bears the surplus."
          examples:
            - 01a17dae-b16e-7f28-9a03-6b1c4d8e2f75
          type: string
      required:
        - refund_ref
        - status
      type: object
    ConfirmGroupSettleBody:
      additionalProperties: false
      properties:
        end_to_end_id:
          description: Aggregated devolution end-to-end id (required when result=SUCCESS)
          examples:
            - D87654321202610271405g7Bv3Nc9Jw2
          type: string
        refund_ref:
          description: Group key
          examples:
            - med-2026-000123-group-devolution
          type: string
        result:
          description: SUCCESS or FAILED; omit to poll current state
          examples:
            - SUCCESS
          type: string
      required:
        - refund_ref
      type: object
    BalanceLockListItem:
      additionalProperties: false
      properties:
        created_at:
          examples:
            - "2026-10-27T10:41:07Z"
          format: date-time
          type: string
        effective_amount:
          examples:
            - "100.26"
          type: string
        end_to_end_id:
          examples:
            - E12345678202610271032k7Qm2Xp9Ld4
          type: string
        external_ref:
          examples:
            - med-2026-000123
          type: string
        lock_id:
          examples:
            - 01a17cf3-128e-7c41-9b2e-5d7a3f8c1e60
          type: string
        origin_system:
          examples:
            - med-infraction
          type: string
        payment_type:
          type:
            - string
            - "null"
        pix_end_to_end_id:
          type:
            - string
            - "null"
        requested_amount:
          examples:
            - "150.75"
          type: string
        settled_amount:
          type:
            - string
            - "null"
        settling_at:
          format: date-time
          type:
            - string
            - "null"
        status:
          examples:
            - PENDING
          type: string
        surplus_midaz_tx_id:
          type:
            - string
            - "null"
        updated_at:
          examples:
            - "2026-10-27T10:41:07Z"
          format: date-time
          type: string
      required:
        - lock_id
        - origin_system
        - external_ref
        - end_to_end_id
        - status
        - requested_amount
        - effective_amount
        - created_at
        - updated_at
      type: object
    SettlePixRefundInput:
      additionalProperties: false
      properties:
        amount:
          examples:
            - "100.26"
          type: string
        asset:
          examples:
            - BRL
          type: string
        return_reason_code:
          examples:
            - FR01
          type: string
      required:
        - return_reason_code
        - amount
        - asset
      type: object
    GroupSettlePixManualBody:
      additionalProperties: false
      properties:
        account:
          examples:
            - "1234567"
          type: string
        account_type:
          examples:
            - CC
          type: string
        asset:
          examples:
            - BRL
          type: string
        branch:
          examples:
            - "0001"
          type: string
        description:
          description: U+0000 is refused (400 PIX-0010); U+FFFE, U+FFFF or U+0001-U+001F other than tab, line feed or carriage return is refused (400 PIX-0003).
          examples:
            - MED devolution to the payer
          type: string
        document:
          examples:
            - "12345678909"
          type: string
        ispb:
          examples:
            - "12345678"
          type: string
        transaction_type:
          examples:
            - INSTANT_PAYMENT_REFUND
          type: string
      required:
        - ispb
        - branch
        - account
        - account_type
        - document
        - asset
      type: object
    BalanceLockAuditEntryResponse:
      additionalProperties: false
      properties:
        action:
          examples:
            - CLOSE
          type: string
        actor:
          examples:
            - backoffice.ops@example.com
          type: string
        correlation_id:
          type: string
        created_at:
          format: date-time
          type: string
        id:
          examples:
            - 01a17e29-5544-7b96-8d2a-3f0e71c9a4b8
          type: string
        lock_id:
          type: string
        principal:
          description: Identity that the access token authenticated, a person or an application. Absent when authorization is off or when the record is older.
          examples:
            - example-org/0198f3a2-0000-7000-8000-000000000001
          type: string
        reason:
          examples:
            - manual devolution paid by Pix
          type: string
        refund_ref:
          type: string
        request_id:
          type: string
        ticket:
          examples:
            - MED-4821
          type: string
      required:
        - id
        - action
        - actor
        - reason
        - request_id
        - created_at
      type: object
    SettlePixManualInput:
      additionalProperties: false
      properties:
        account:
          examples:
            - "1234567"
          type: string
        account_type:
          examples:
            - CC
          type: string
        amount:
          examples:
            - "80.13"
          type: string
        asset:
          examples:
            - BRL
          type: string
        branch:
          examples:
            - "0001"
          type: string
        description:
          description: U+0000 is refused (400 PIX-0010); U+FFFE, U+FFFF or U+0001-U+001F other than tab, line feed or carriage return is refused (400 PIX-0003).
          examples:
            - MED devolution to the payer
          type: string
        document:
          examples:
            - "12345678909"
          type: string
        ispb:
          examples:
            - "12345678"
          type: string
      required:
        - ispb
        - branch
        - account
        - account_type
        - document
        - amount
        - asset
      type: object
    GroupSettlePixRefundBody:
      additionalProperties: false
      properties:
        asset:
          examples:
            - BRL
          type: string
        return_reason_code:
          examples:
            - FR01
          type: string
      required:
        - return_reason_code
        - asset
      type: object
    ApixAuthorizationRow:
      additionalProperties: false
      properties:
        activeAuthorizationCount:
          description: APIX001 layout QtdEstoqueAutorizacoes.
          examples:
            - 412
          format: int64
          type: integer
        authorizationCount:
          description: APIX001 layout QtdAutorizacoes.
          examples:
            - 57
          format: int64
          type: integer
        payerType:
          description: APIX001 layout TipoPagador.
          enum:
            - 1
            - 2
          examples:
            - 1
          format: int64
          type: integer
      required:
        - payerType
        - authorizationCount
        - activeAuthorizationCount
      type: object
    ApixAuthorizationTimesBlock:
      additionalProperties: false
      properties:
        p95AuthorizationTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
      required:
        - p95AuthorizationTime
      type: object
    ApixAuthorizationsBlock:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Whether the rows are data or fillers.
        rows:
          description: 'APIX001 layout Autorizacao: one row per payerType, zero rows included.'
          items:
            $ref: '#/components/schemas/ApixAuthorizationRow'
          type:
            - array
            - 'null'
      required:
        - rows
        - coverage
      type: object
    ApixAvailabilityBlock:
      additionalProperties: false
      properties:
        availabilityIndex:
          description: APIX001 layout IndiceDisponibilidade, a percentage with two decimal places.
          examples:
            - '99.98'
          type: string
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Whether availabilityIndex is data or a filler.
      required:
        - availabilityIndex
        - coverage
      type: object
    ApixBlocks:
      additionalProperties: false
      properties:
        authorizationTimes:
          $ref: '#/components/schemas/ApixAuthorizationTimesBlock'
        authorizations:
          $ref: '#/components/schemas/ApixAuthorizationsBlock'
        availability:
          $ref: '#/components/schemas/ApixAvailabilityBlock'
        cautionaryBlocks:
          $ref: '#/components/schemas/ApixCautionaryBlocksBlock'
        dictLookups:
          $ref: '#/components/schemas/ApixDICTLookupsBlock'
        dictTimes:
          $ref: '#/components/schemas/ApixDICTTimesBlock'
        refunds:
          $ref: '#/components/schemas/ApixRefundsBlock'
        revenues:
          $ref: '#/components/schemas/ApixRevenuesBlock'
        transactionTimes:
          $ref: '#/components/schemas/ApixTransactionTimesBlock'
        transactions:
          $ref: '#/components/schemas/ApixTransactionsBlock'
      required:
        - transactions
        - refunds
        - cautionaryBlocks
        - revenues
        - transactionTimes
        - dictTimes
        - dictLookups
        - availability
        - authorizationTimes
        - authorizations
      type: object
    ApixCautionaryBlockRow:
      additionalProperties: false
      properties:
        cautionaryBlockAmount:
          description: APIX001 layout ValorBloqCaut, two decimal places.
          examples:
            - '1250.00'
          type: string
        cautionaryBlockCount:
          description: APIX001 layout QtdeBloqCaut.
          examples:
            - 3
          format: int64
          type: integer
        cautionaryBlockDetail:
          description: APIX001 layout DetalhamentoTransacoesBloqCaut.
          enum:
            - 1
            - 2
            - 3
            - 4
          examples:
            - 1
          format: int64
          type: integer
      required:
        - cautionaryBlockDetail
        - cautionaryBlockCount
        - cautionaryBlockAmount
      type: object
    ApixCautionaryBlocksBlock:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Whether the rows are data or fillers.
        rows:
          description: 'APIX001 layout cautionary blocks: one row per cautionaryBlockDetail, zero rows included.'
          items:
            $ref: '#/components/schemas/ApixCautionaryBlockRow'
          type:
            - array
            - 'null'
      required:
        - rows
        - coverage
      type: object
    ApixClientFact:
      additionalProperties: false
      properties:
        clientRequestId:
          description: The participant's key of the fact, unique per tenant and fact type.
          examples:
            - cb-2026-10-000017
          type: string
        factId:
          description: Identifier of this version of the fact.
          examples:
            - 0193a7c2-5d4e-7f10-a2b3-c4d5e6f7a8b9
          format: uuid
          type: string
        factType:
          description: Fact type, as in the path.
          examples:
            - OUTSIDE_SPI_REFUND
          type: string
        payload:
          description: The fact body as recorded.
        period:
          description: Reference month the fact counts in, YYYY-MM.
          examples:
            - 2026-10
          type: string
        version:
          description: 'Version of the fact: 1 when recorded, one more per correction.'
          examples:
            - 1
          format: int64
          type: integer
      required:
        - factId
        - factType
        - clientRequestId
        - version
        - period
        - payload
      type: object
    ApixClientFactInput:
      description: Fact body, one schema per fact type chosen by `factType`.
      discriminator:
        mapping:
          DICT_SCREEN_STEP: '#/components/schemas/ApixDictScreenStepInput'
          OUTBOUND_FRAUD_REFUSAL: '#/components/schemas/ApixOutboundFraudRefusalInput'
          OUTSIDE_SPI_REFUND: '#/components/schemas/ApixOutsideSpiRefundInput'
          OUTSIDE_SPI_SETTLEMENT: '#/components/schemas/ApixOutsideSpiSettlementInput'
        propertyName: factType
      oneOf:
        - $ref: '#/components/schemas/ApixOutsideSpiSettlementInput'
        - $ref: '#/components/schemas/ApixOutboundFraudRefusalInput'
        - $ref: '#/components/schemas/ApixOutsideSpiRefundInput'
        - $ref: '#/components/schemas/ApixDictScreenStepInput'
    ApixCoverage:
      additionalProperties: false
      properties:
        reason:
          description: Why the value is not COMPLETE. Absent when status is COMPLETE.
          examples:
            - not computed by Pix Lerian
          type: string
        status:
          description: 'COMPLETE: the value is data; PARTIAL: data with a known gap; UNAVAILABLE: the value is a filler, never a measured zero; NOT_APPLICABLE: the value does not apply to the tenant in the month and is a zero filler, as transactionDetail 5 with no settled-participant declaration in force in the month.'
          enum:
            - COMPLETE
            - PARTIAL
            - UNAVAILABLE
            - NOT_APPLICABLE
          examples:
            - COMPLETE
          type: string
      required:
        - status
      type: object
    ApixDICTLookupsBlock:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Whether lookupCount is data or a filler. PARTIAL whenever a lookup was measured, because a key lookup the client makes before the initiate is not seen; the reason also says negative answers are not measured and the Pix Agendado key lookups are not measured, plus the count of lookups without measurement. A month with lookups and none measured is UNAVAILABLE; a month with no lookup is 0 PARTIAL, never COMPLETE while the Pix Agendado lookups are not measured.
        lookupCount:
          description: 'APIX001 layout QtdConsultas. DICT key lookups Pix Lerian makes to start a Pix by key or by QR code in the month (America/Sao_Paulo) answered by the participant''s own DICT copy: origins CACHE and LOCAL_COPY count, DICT does not. The population is the key and QR code initiations, whether or not the payment settled; a negative answer and a technical failure are not recorded and do not count.'
          examples:
            - 48210
          format: int64
          type: integer
      required:
        - lookupCount
        - coverage
      type: object
    ApixDICTTimesBlock:
      additionalProperties: false
      properties:
        p95KeyDeletionUserExperienceTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p95KeyRegistrationCodeSendTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p95KeyRegistrationUserExperienceTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p95MedOpeningTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p95PortabilityNotificationTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p95PortabilitySendTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p99KeyLookupTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
          description: 'APIX001 layout Perc99TempoUsuarioConsulta. P99 of the DICT key lookups Pix Lerian makes to start a Pix by key or by QR code in the month (America/Sao_Paulo), whatever answered them (CACHE, LOCAL_COPY or DICT), in seconds rounded up to 2 places (nearest rank). The population is the key and QR code initiations. A lookup with a negative answer (key not found, refused by DICT) and a lookup that failed technically (timeout, connection, 5xx) start no initiation and are left out. The duration runs from the lookup request to the DICT hub to the decoded answer, retries included, so the value is a LOWER BOUND of the layout indicator: the participant''s channel steps and the rest of the initiate are not in it. Whether to report it is the client''s decision. Coverage is PARTIAL whenever a lookup was measured; the reason names the lower bound, a key lookup the client makes before the initiate, technical failures, negative answers and the Pix Agendado key lookups, which Pix Lerian does not measure, plus the count of lookups without measurement. A month with lookups and none measured is UNAVAILABLE; a month with no lookup is 0.00 PARTIAL, never COMPLETE.'
      required:
        - p99KeyLookupTime
        - p95KeyRegistrationCodeSendTime
        - p95KeyRegistrationUserExperienceTime
        - p95KeyDeletionUserExperienceTime
        - p95PortabilityNotificationTime
        - p95PortabilitySendTime
        - p95MedOpeningTime
      type: object
    ApixDetailCoverage:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Coverage of every row with this transactionDetail.
        transactionDetail:
          description: APIX001 layout DetalhamentoTransacoes the coverage applies to.
          enum:
            - 5
            - 6
            - 7
          examples:
            - 5
          format: int64
          type: integer
      required:
        - transactionDetail
        - coverage
      type: object
    ApixDictScreenStepInput:
      additionalProperties: false
      description: "DICT_SCREEN_STEP: a numbered step of a DICT Operational Manual flow (key registration or deletion, portability, claim, MED opening) that happens in the channel of the participant, which Pix Lerian does not see. It is kept for the P95 indicators of the APIX001 `TemposDict` block (`dictTimes`) measured between flow steps. `dictTimes` is UNAVAILABLE."
      properties:
        clientRequestId:
          description: Client key of the fact, unique per fact type and tenant.
          examples:
            - dss-2026-10-key-reg-0042-s6
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9._:-]+$
          type: string
        factType:
          description: Fact type; must equal the path fact_type (422 PIX-0723).
          enum:
            - DICT_SCREEN_STEP
          examples:
            - DICT_SCREEN_STEP
          type: string
        occurredAt:
          description: Instant the step happened in the participant's channel, RFC 3339; its month in America/Sao_Paulo is the reference month, from 2020-11 through the current month (400 PIX-0003).
          examples:
            - '2026-10-12T11:20:31.507Z'
          format: date-time
          type: string
        operation:
          description: DICT operation the step belongs to.
          enum:
            - KEY_REGISTRATION
            - KEY_DELETION
            - PORTABILITY
            - CLAIM
            - MED_OPENING
          examples:
            - KEY_REGISTRATION
          type: string
        operationRef:
          description: Pix Lerian id of the key entry, claim or funds recovery in the DICT hub, in lowercase hyphenated form. Not checked by the SPI. One current fact per operation, operationRef and step (409 PIX-0725).
          examples:
            - 0193a5c1-9e8f-7a6b-8c5d-4e3f2a1b0c9d
          format: uuid
          pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
          type: string
        step:
          description: Step number of the DICT Operational Manual flow; every step from 1 to 30 is accepted.
          examples:
            - 6
          format: int64
          maximum: 30
          minimum: 1
          type: integer
      required:
        - factType
        - clientRequestId
        - operation
        - operationRef
        - step
        - occurredAt
      type: object
    ApixEndSettledParticipantInput:
      additionalProperties: false
      properties:
        validTo:
          description: Last day the declaration is in force, inclusive, YYYY-MM-DD; required and never null.
          examples:
            - '2027-01-31'
          format: date
          type: string
        version:
          description: Current version of the declaration, as its last response gave it; another version is 409 PIX-0728.
          examples:
            - 1
          format: int64
          minimum: 1
          type: integer
      required:
        - validTo
        - version
      type: object
    ApixOutboundFraudRefusalInput:
      additionalProperties: false
      description: "OUTBOUND_FRAUD_REFUSAL: an outbound Pix that the participant refused for fraud suspicion, before or instead of sending it, so it can have no end-to-end id. It feeds the APIX001 `Transacoes` block (`transactions`, `transactionDetail` 7, on the row of its `purpose`)."
      properties:
        amount:
          description: Amount in BRL, greater than 0.00, up to 13 integer digits and exactly two decimal places.
          examples:
            - '4800.00'
          pattern: ^[0-9]{1,13}\.[0-9]{2}$
          type: string
        cashAmount:
          description: Cash part of the amount, absent as 0.00, under the purpose's rule as on OUTSIDE_SPI_SETTLEMENT.
          examples:
            - '0.00'
          pattern: ^[0-9]{1,13}\.[0-9]{2}$
          type: string
        clientRequestId:
          description: Client key of the fact, unique per fact type and tenant.
          examples:
            - ofr-2026-10-000233
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9._:-]+$
          type: string
        endToEndId:
          description: End-to-end id of the refused Pix, E prefix; absent or null when the Pix got none. With one, one current fact per end-to-end id (409 PIX-0725).
          examples:
            - E12345678202610212247a1b2c3d4e5f
          pattern: ^E[0-9A-Z]{8}[0-9]{12}[A-Za-z0-9]{11}$
          type:
            - string
            - 'null'
        factType:
          description: Fact type; must equal the path fact_type (422 PIX-0723).
          enum:
            - OUTBOUND_FRAUD_REFUSAL
          examples:
            - OUTBOUND_FRAUD_REFUSAL
          type: string
        purpose:
          description: Transaction purpose, the layout's FinalidadeTransacoes.
          enum:
            - IPAY
            - OTHR
            - GSCB
            - AUTOMATIC
          examples:
            - IPAY
          type: string
        refusedAt:
          description: Refusal instant, RFC 3339; its month in America/Sao_Paulo is the reference month, from 2020-11 through the current month (400 PIX-0003).
          examples:
            - '2026-10-21T22:47:13.880Z'
          format: date-time
          type: string
      required:
        - factType
        - clientRequestId
        - amount
        - purpose
        - refusedAt
      type: object
    ApixOutsideSpiRefundInput:
      additionalProperties: false
      description: "OUTSIDE_SPI_REFUND: a refund that the participant settled outside the SPI in its own systems. It feeds the APIX001 `Devolucoes` block (`refunds`): `refundDetail` 1 for `reasonCode` FR01 (fraud), 2 for the others. A refund settled in the SPI never counts there and is not sent as a fact."
      properties:
        amount:
          description: Refunded amount in BRL, greater than 0.00, up to 13 integer digits and exactly two decimal places.
          examples:
            - '89.90'
          pattern: ^[0-9]{1,13}\.[0-9]{2}$
          type: string
        clientRequestId:
          description: Client key of the fact, unique per fact type and tenant.
          examples:
            - osr-2026-10-000071
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9._:-]+$
          type: string
        endToEndId:
          description: End-to-end id of the refund itself, D prefix; one current fact per end-to-end id (409 PIX-0725).
          examples:
            - D12345678202610311702a9b8c7d6e5f
          pattern: ^D[0-9A-Z]{8}[0-9]{12}[A-Za-z0-9]{11}$
          type: string
        factType:
          description: Fact type; must equal the path fact_type (422 PIX-0723).
          enum:
            - OUTSIDE_SPI_REFUND
          examples:
            - OUTSIDE_SPI_REFUND
          type: string
        originalEndToEndId:
          description: End-to-end id of the refunded transaction, E prefix.
          examples:
            - E12345678202610311545f6e5d4c3b2a
          pattern: ^E[0-9A-Z]{8}[0-9]{12}[A-Za-z0-9]{11}$
          type: string
        reasonCode:
          description: 'Refund reason from the APIX catalog: FR01 counts as fraud (refundDetail 1), the others as other refunds (refundDetail 2). Four uppercase letters or digits outside the catalog is 422 PIX-0726; any other value is 400 PIX-0003.'
          enum:
            - FR01
            - MD06
            - SL02
            - BE08
          examples:
            - MD06
          type: string
        settledAt:
          description: Refund settlement instant, RFC 3339; its month in America/Sao_Paulo is the reference month, from 2020-11 through the current month (400 PIX-0003).
          examples:
            - '2026-10-31T17:02:44.019Z'
          format: date-time
          type: string
      required:
        - factType
        - clientRequestId
        - endToEndId
        - originalEndToEndId
        - amount
        - reasonCode
        - settledAt
      type: object
    ApixOutsideSpiSettlementInput:
      additionalProperties: false
      description: "OUTSIDE_SPI_SETTLEMENT: a transaction that the participant settled outside the SPI in its own systems, between its own customers (on-us) or with an indirect participant that it settles. It registers a new transaction, not one that Pix Lerian processed. It feeds the APIX001 `Transacoes` block (`transactions`, `transactionDetail` 5 or 6, by the settled-participant declarations) and, when `payerIspb` is the tenant, the outside-SPI pair of `TemposTransacoes` (`p50OutsideSpiUserExperienceTime`, `p99OutsideSpiUserExperienceTime`)."
      properties:
        acceptedAt:
          description: Instant the payer's participant accepted the order. Required, and never null, when payerIspb is the tenant's ISPB; may be absent otherwise.
          examples:
            - '2026-10-31T15:45:10.412Z'
          format: date-time
          type: string
        amount:
          description: Amount in BRL, greater than 0.00, up to 13 integer digits and exactly two decimal places.
          examples:
            - '89.90'
          pattern: ^[0-9]{1,13}\.[0-9]{2}$
          type: string
        cashAmount:
          description: 'Cash part of the amount, absent as 0.00: zero for IPAY and AUTOMATIC, the whole amount for OTHR, more than zero and less than the amount for GSCB; otherwise 400 PIX-0003.'
          examples:
            - '0.00'
          pattern: ^[0-9]{1,13}\.[0-9]{2}$
          type: string
        clientRequestId:
          description: Client key of the fact, unique per fact type and tenant.
          examples:
            - osp-2026-10-004512
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9._:-]+$
          type: string
        endToEndId:
          description: End-to-end id of the transaction, E prefix; one current fact per end-to-end id (409 PIX-0725).
          examples:
            - E12345678202610311545f6e5d4c3b2a
          pattern: ^E[0-9A-Z]{8}[0-9]{12}[A-Za-z0-9]{11}$
          type: string
        factType:
          description: Fact type; must equal the path fact_type (422 PIX-0723).
          enum:
            - OUTSIDE_SPI_SETTLEMENT
          examples:
            - OUTSIDE_SPI_SETTLEMENT
          type: string
        fraudSuspected:
          description: Whether fraud was suspected (APIX002); absent is false. When true, the settlement stays out of the outside-SPI times.
          examples:
            - false
          type: boolean
        highPriority:
          description: Neither scheduled, AUTOMATIC nor fraudSuspected. Absent is derived from those three; true with any of them is 400 PIX-0003.
          examples:
            - true
          type: boolean
        initiationChannel:
          description: Channel the payer used (APIX002).
          enum:
            - APP
            - INTERNET_BANKING
            - CALL_CENTER
            - ATM
            - BRANCH
          examples:
            - APP
          type: string
        initiationMechanism:
          description: How the payment was initiated (APIX002).
          enum:
            - KEY
            - DYNAMIC_QR
            - STATIC_QR
            - PAYMENT_INITIATOR
            - MANUAL
          examples:
            - KEY
          type: string
        initiationProcedure:
          description: How the payment data was entered (APIX002).
          enum:
            - MANUAL
            - PRE_STORED
          examples:
            - MANUAL
          type: string
        payerIspb:
          description: ISPB of the payer's participant. When it is the tenant's own ISPB, acceptedAt and payerNotifiedAt are required.
          examples:
            - '12345678'
          pattern: ^[0-9A-Z]{8}$
          type: string
        payerNotifiedAt:
          description: Instant the payer was notified of the result. Required and not null when payerIspb is the tenant's ISPB, not before acceptedAt and at most 999999.99 s after it (400 PIX-0003); may be absent or null otherwise.
          examples:
            - '2026-10-31T15:45:11.204Z'
          format: date-time
          type:
            - string
            - 'null'
        payerPersonType:
          description: Payer's person type (APIX002).
          enum:
            - NATURAL_PERSON
            - LEGAL_PERSON
          examples:
            - NATURAL_PERSON
          type: string
        paymentInitiatorIspb:
          description: ISPB of the payment initiator; only with initiationMechanism PAYMENT_INITIATOR, otherwise 400 PIX-0003.
          examples:
            - '87654321'
          pattern: ^[0-9A-Z]{8}$
          type: string
        purpose:
          description: Transaction purpose, the layout's FinalidadeTransacoes.
          enum:
            - IPAY
            - OTHR
            - GSCB
            - AUTOMATIC
          examples:
            - IPAY
          type: string
        receiverIspb:
          description: ISPB of the receiver's participant.
          examples:
            - '12345678'
          pattern: ^[0-9A-Z]{8}$
          type: string
        receiverPersonType:
          description: Receiver's person type (APIX002).
          enum:
            - NATURAL_PERSON
            - LEGAL_PERSON
          examples:
            - LEGAL_PERSON
          type: string
        scheduled:
          description: Whether the payment was scheduled; absent is false.
          examples:
            - false
          type: boolean
        settledAt:
          description: Settlement instant, RFC 3339; its month in America/Sao_Paulo is the reference month, from 2020-11 through the current month (400 PIX-0003).
          examples:
            - '2026-10-31T15:45:10.958Z'
          format: date-time
          type: string
      required:
        - factType
        - clientRequestId
        - endToEndId
        - amount
        - purpose
        - payerIspb
        - receiverIspb
        - settledAt
      type: object
    ApixPeriod:
      additionalProperties: false
      properties:
        period:
          description: Reference month, YYYY-MM.
          examples:
            - 2026-10
          type: string
        status:
          description: OPEN until a close freezes the month; CLOSED while a report is in force.
          enum:
            - OPEN
            - CLOSED
          examples:
            - OPEN
          type: string
      required:
        - period
        - status
      type: object
    ApixPeriodBody:
      additionalProperties: false
      properties:
        period:
          description: Reference month, YYYY-MM. Absent is 400 PIX-0002; not YYYY-MM, or a month before 2020-11, when Pix started, is 400 PIX-0003.
          examples:
            - 2026-10
          pattern: ^[0-9]{4}-(0[1-9]|1[0-2])$
          type: string
      required:
        - period
      type: object
    ApixRefundRow:
      additionalProperties: false
      properties:
        refundAmount:
          description: 'APIX001 layout ValorDevolucoes, two decimal places. At most 9999999999999.99, the layout ceiling: a larger sum is reported as 9999999999999.99 and the coverage is PARTIAL with the count of rows above it.'
          examples:
            - '310.00'
          type: string
        refundCount:
          description: APIX001 layout QtdDevolucoes.
          examples:
            - 12
          format: int64
          type: integer
        refundDetail:
          description: 'APIX001 layout DetalhamentoDevolucoes: 1 fraud (reasonCode FR01), 2 other (MD06, SL02, BE08).'
          enum:
            - 1
            - 2
          examples:
            - 1
          format: int64
          type: integer
      required:
        - refundDetail
        - refundCount
        - refundAmount
      type: object
    ApixRefundsBlock:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: 'Whether the rows are data or fillers: UNAVAILABLE, never COMPLETE, when no refund outside SPI was informed for the month.'
        rows:
          description: 'APIX001 layout Devolucao: one row per refundDetail, zero rows included. Only the OUTSIDE_SPI_REFUND facts current at the cutoff count, in the month of their settledAt; refunds settled in the SPI never do.'
          items:
            $ref: '#/components/schemas/ApixRefundRow'
          type:
            - array
            - 'null'
      required:
        - rows
        - coverage
      type: object
    ApixReport:
      additionalProperties: false
      properties:
        blocks:
          $ref: '#/components/schemas/ApixBlocks'
          description: The ten APIX001 blocks in layout order, each with explicit coverage.
        ispb:
          description: ISPB of the participant the report is for.
          examples:
            - '12345678'
          type: string
        layoutVersion:
          description: APIX001 layout version the blocks follow.
          examples:
            - '2.7'
          type: string
        period:
          description: Reference month, YYYY-MM.
          examples:
            - 2026-10
          type: string
        reportId:
          description: Immutable identifier of this report; a reopen and a new close produce another.
          examples:
            - 0193a6f0-7c1e-7b4a-9d2e-5f6a7b8c9d0e
          type: string
      required:
        - reportId
        - period
        - ispb
        - layoutVersion
        - blocks
      type: object
    ApixRevenueRow:
      additionalProperties: false
      properties:
        revenueAmount:
          description: APIX001 layout ValorReceita, two decimal places.
          examples:
            - '980.40'
          type: string
        revenueSource:
          description: APIX001 layout FonteReceita.
          enum:
            - 1
            - 2
            - 3
            - 4
          examples:
            - 1
          format: int64
          type: integer
      required:
        - revenueSource
        - revenueAmount
      type: object
    ApixRevenuesBlock:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Whether the rows are data or fillers.
        rows:
          description: 'APIX001 layout Receita: one row per revenueSource, zero rows included.'
          items:
            $ref: '#/components/schemas/ApixRevenueRow'
          type:
            - array
            - 'null'
      required:
        - rows
        - coverage
      type: object
    ApixSettledParticipant:
      additionalProperties: false
      properties:
        id:
          description: Declaration id, stable across versions.
          examples:
            - 0193a7d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f
          format: uuid
          type: string
        ispb:
          description: ISPB of the indirect participant the tenant settles for.
          examples:
            - '23456789'
          pattern: ^[0-9A-Z]{8}$
          type: string
        name:
          description: Name of the indirect participant, when declared.
          examples:
            - Exemplo Pagamentos IP S.A.
          type:
            - string
            - 'null'
        validFrom:
          description: First day the declaration is in force.
          examples:
            - '2026-11-01'
          format: date
          type: string
        validTo:
          description: Last day the declaration is in force, inclusive; null while it has no end.
          examples:
            - '2027-01-31'
          format: date
          type:
            - string
            - 'null'
        version:
          description: 'Version of the declaration: 1 when declared, one more when it is ended.'
          examples:
            - 1
          format: int64
          minimum: 1
          type: integer
      required:
        - id
        - version
        - ispb
        - validFrom
        - validTo
      type: object
    ApixSettledParticipantInput:
      additionalProperties: false
      properties:
        clientRequestId:
          description: 'Client key of the declaration, unique per tenant: a resend with the same body answers the declaration it made, another body is 409 PIX-0717. Not returned in the response.'
          examples:
            - sp-2026-11-23456789
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9._:-]+$
          type: string
        ispb:
          description: ISPB of the indirect participant the tenant settles for, eight digits or uppercase letters; the tenant's own ISPB is 422 PIX-0719.
          examples:
            - '23456789'
          pattern: ^[0-9A-Z]{8}$
          type: string
        name:
          description: Name of the indirect participant, at most 140 characters.
          examples:
            - Exemplo Pagamentos IP S.A.
          maxLength: 140
          type: string
        validFrom:
          description: First day the declaration is in force, YYYY-MM-DD.
          examples:
            - '2026-11-01'
          format: date
          type: string
      required:
        - ispb
        - validFrom
      type: object
    ApixTimeIndicator:
      additionalProperties: false
      properties:
        coverage:
          $ref: '#/components/schemas/ApixCoverage'
          description: Whether value is data or a filler.
        value:
          description: 'Time with two decimal places, in seconds (in hours for maxCautionaryBlockTime); 0.00 when coverage is UNAVAILABLE. At most 999999.99, the APIX001 layout tipoValorTempo ceiling: a longer time is reported as 999999.99 and the coverage is PARTIAL with the count of journeys above it.'
          examples:
            - '2.84'
          type: string
      required:
        - value
        - coverage
      type: object
    ApixTransactionRow:
      additionalProperties: false
      properties:
        cashAmount:
          description: 'APIX001 layout ValorEspecie, two decimal places. At most 9999999999999.99, the layout ceiling: a larger sum is reported as 9999999999999.99 and the coverage is PARTIAL with the count of rows above it.'
          examples:
            - '0.00'
          type: string
        transactionAmount:
          description: 'APIX001 layout ValorTransacoes, two decimal places. At most 9999999999999.99, the layout ceiling: a larger sum is reported as 9999999999999.99 and the coverage is PARTIAL with the count of rows above it.'
          examples:
            - '38450.75'
          type: string
        transactionCount:
          description: APIX001 layout QtdTransacoes.
          examples:
            - 1520
          format: int64
          type: integer
        transactionDetail:
          description: APIX001 layout DetalhamentoTransacoes.
          enum:
            - 5
            - 6
            - 7
          examples:
            - 5
          format: int64
          type: integer
        transactionPurpose:
          description: APIX001 layout FinalidadeTransacoes.
          enum:
            - 1
            - 2
            - 3
            - 4
          examples:
            - 1
          format: int64
          type: integer
      required:
        - transactionDetail
        - transactionPurpose
        - transactionCount
        - transactionAmount
        - cashAmount
      type: object
    ApixTransactionTimesBlock:
      additionalProperties: false
      properties:
        maxCautionaryBlockTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p50OutsideSpiUserExperienceTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p50SpiUserExperienceTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p99OutsideSpiUserExperienceTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
        p99SpiUserExperienceTime:
          $ref: '#/components/schemas/ApixTimeIndicator'
      required:
        - p50SpiUserExperienceTime
        - p99SpiUserExperienceTime
        - p50OutsideSpiUserExperienceTime
        - p99OutsideSpiUserExperienceTime
        - maxCautionaryBlockTime
      type: object
    ApixTransactionsBlock:
      additionalProperties: false
      properties:
        detailCoverage:
          description: Coverage per transactionDetail; the block has none of its own.
          items:
            $ref: '#/components/schemas/ApixDetailCoverage'
          type:
            - array
            - 'null'
        rows:
          description: 'APIX001 layout Transacao: one row per transactionDetail and transactionPurpose, zero rows included.'
          items:
            $ref: '#/components/schemas/ApixTransactionRow'
          type:
            - array
            - 'null'
      required:
        - rows
        - detailCoverage
      type: object
    FraudCheckReasonResponse:
      additionalProperties: false
      properties:
        code:
          description: The partner's reason code.
          examples:
            - R01
          type: string
        description:
          description: The partner's free-text description of the reason, as received.
          examples:
            - Known payer
          type: string
      required:
        - code
      type: object
    FraudCheckResponse:
      additionalProperties: false
      properties:
        analysisId:
          description: The partner's identifier of the analysis.
          examples:
            - an-7f3a
          type: string
        cause:
          description: Why the partner did not decide, such as TIMEOUT or UNAVAILABLE. Absent when origin is PROVIDER.
          examples:
            - TIMEOUT
          type: string
        decideBy:
          description: Deadline of an analysis that the partner left open on a sent Pix, RFC 3339. Present only while or after Pix Lerian held the Pix for review.
          examples:
            - '2026-11-18T14:30:00Z'
          format: date-time
          type: string
        decision:
          description: 'Outcome of the check. On a received Pix that exists as a transfer it is ALLOW, or REVIEW when Pix Lerian credited it for review. Pix Lerian holds it in a cautelar block unless nothing was available to hold. A refusal leaves no transfer.'
          enum:
            - ALLOW
            - REVIEW
            - DENY
          examples:
            - ALLOW
          type: string
        origin:
          description: 'PROVIDER when the partner decided. FALLBACK when the partner did not decide and the posture of the route answered: an open posture allows, and a closed one denies.'
          enum:
            - PROVIDER
            - FALLBACK
          examples:
            - PROVIDER
          type: string
        reasons:
          description: Reasons the partner returned, as received.
          items:
            $ref: '#/components/schemas/FraudCheckReasonResponse'
          type:
            - array
            - 'null'
        releasedAt:
          description: When that person released the block, RFC 3339. Absent otherwise.
          examples:
            - '2026-11-18T14:30:00Z'
          format: date-time
          type: string
        releasedBy:
          description: 'The subject of the token of the person who released the cautelar block of a received Pix after the partner''s DENY: the resolution stays DENY. Absent otherwise.'
          examples:
            - user-1
          type: string
        resolution:
          description: 'How an analysis held for review ended: ALLOW or DENY by the decision of the antifraud partner or of the client''s operator, CANCELLED by the payer, EXPIRED at the deadline. On a received Pix, the decision on its cautelar block: DENY is recorded while the block still holds the funds, and a person''s release after it keeps DENY; EXPIRED when the block ended by its deadline with no decision. Absent while the Pix is held and when it was never held.'
          enum:
            - ALLOW
            - DENY
            - CANCELLED
            - EXPIRED
          examples:
            - CANCELLED
          type: string
        resolutionOrigin:
          description: 'Who decided an ALLOW or DENY: PARTNER when the antifraud partner''s application did, OPERATOR when a person of the client did. Absent for CANCELLED, EXPIRED and a Pix never held.'
          enum:
            - PARTNER
            - OPERATOR
          examples:
            - PARTNER
          type: string
        resolvedBy:
          description: The subject of the token that decided an ALLOW or DENY. Absent for CANCELLED, EXPIRED and a Pix never held.
          examples:
            - user-1
          type: string
        score:
          description: The partner's score, as text exactly as the partner sent it. Opaque to the SPI.
          examples:
            - '0.12'
          type: string
      required:
        - decision
        - origin
      type: object
    FraudDecisionBody:
      additionalProperties: false
      properties:
        analysisId:
          description: 'The partner''s identifier of the analysis held: the fraudCheck.analysisId of the outbound_transfer.fraud_analysis event, or of the inbound_transfer.blocked event of a received Pix.'
          examples:
            - an-7f3a
          maxLength: 64
          minLength: 1
          type: string
        decision:
          description: On a sent Pix held in fraud analysis, ALLOW sends the Pix, and DENY reverses the debit and closes the transfer REJECTED. On a received Pix held in a cautelar block, ALLOW frees the funds, and DENY is recorded and published while the funds stay held. REVIEW is never a decision.
          enum:
            - ALLOW
            - DENY
          examples:
            - ALLOW
          type: string
        justification:
          description: Required from a person of the client (10 to 500 characters after trimming), ignored for the application of the partner. Pix Lerian keeps it for audit and never publishes it in an event.
          examples:
            - Payee confirmed by phone with the payer.
          maxLength: 500
          minLength: 10
          type: string
        reasons:
          description: 'The partner''s most recent reasons: when present they replace the reasons of the REVIEW. Read from a partner''s application only; a person never changes them.'
          items:
            $ref: '#/components/schemas/FraudCheckReasonResponse'
          type:
            - array
            - 'null'
      required:
        - analysisId
        - decision
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http
