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

# Unblock a Pix refund stuck in PROCESSING

> 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 refunds permission with the post action, the same permission that creates a refund.

The response is the refund as [Get refund](/pt/reference/interfaces/pix-lerian/spi/get-refund) returns it.



## OpenAPI

````yaml /pt/openapi/v3-current/pix-lerian-spi.yaml post /refunds/{id}/unblock
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.2.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.
    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 cautionary block (MED 2.0), return
      them to the payer, or give them back to the account holder.
    name: Balance Locks
paths:
  /refunds/{id}/unblock:
    post:
      tags:
        - Refunds
      summary: Unblock a Pix refund stuck in PROCESSING
      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 refunds permission with the post action, the same
        permission that creates a refund.


        The response is the refund as [Get
        refund](/pt/reference/interfaces/pix-lerian/spi/get-refund) returns it.
      operationId: unblockRefund
      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
components:
  schemas:
    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
    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
    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
    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
    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
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
    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
    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
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````

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