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

# Close refund blocks after a manual devolution

> Closes the refund’s pending infraction blocks after the requesting participant completes the devolution outside the automatic flow. The operation requires the external payment End-to-End ID and verifies its amount before marking the blocks as settled. The refund remains OPEN until the infraction report is concluded.



## OpenAPI

````yaml /es/openapi/v3-current/pix-lerian-dict.yaml post /dict/refunds/{id}/blocks/close
openapi: 3.1.0
info:
  contact:
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    Public API for Pix keys, claims, fraud markers, infraction reports, and MED
    funds recovery. This release provides a mock-provider integration for
    testing; live BACEN connectivity is not included.
  license:
    name: Lerian Studio General License
  title: Pix Lerian — DICT
  version: 1.0.0
servers:
  - url: https://api.example.com/dict-hub/v1
    description: >-
      Replace the example host with the URL provided during environment
      onboarding.
security:
  - BearerAuth: []
tags:
  - description: Manage ownership and portability claims for Pix keys.
    name: Claims
  - description: Register, retrieve, list, update, and remove Pix keys.
    name: Entries
  - description: Create, query, list, and cancel DICT fraud markers.
    name: Fraud Markers
  - description: Manage participant-scoped MED 2.0 funds recoveries.
    name: Funds Recoveries
  - description: Manage MED 2.0 infraction reports for the authenticated organization.
    name: Infraction Reports
  - description: Look up Pix keys and check whether keys exist in the DICT directory.
    name: Keys
  - description: Create, query, cancel, and settle MED 2.0 refunds.
    name: Refunds
paths:
  /dict/refunds/{id}/blocks/close:
    post:
      tags:
        - Refunds
      summary: Close refund blocks after a manual devolution
      description: >-
        Closes the refund’s pending infraction blocks after the requesting
        participant completes the devolution outside the automatic flow. The
        operation requires the external payment End-to-End ID and verifies its
        amount before marking the blocks as settled. The refund remains OPEN
        until the infraction report is concluded.
      operationId: blocksCloseRefund
      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.
            Replaying the same 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 internal ID (UUID format)
          in: path
          name: id
          required: true
          schema:
            description: Refund internal ID (UUID format)
            examples:
              - 018f8c1d-1234-7abc-9def-000000000010
            type: string
        - description: >-
            Best-effort business correlation id (observability only; never
            fabricated).
          in: header
          name: X-Correlation-Id
          schema:
            description: >-
              Best-effort business correlation id (observability only; never
              fabricated).
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlocksCloseRefundBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlocksCloseRefundView'
          description: OK
        '400':
          content:
            application/json:
              example:
                code: PIX-0030
                title: Idempotency Key Required
                message: >-
                  The Idempotency-Key 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: >-
            Bad Request (PIX-0001, PIX-0002, PIX-0003, PIX-0017, PIX-0015,
            PIX-0020). X-Idempotency absent or longer than 64 bytes (PIX-0030).
            Legacy {code,title,message} envelope, NOT problem+json.
        '403':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0005
                title: Forbidden
                status: 403
                detail: You do not have permission to perform this operation.
                code: PIX-0005
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden (PIX-0005).
        '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: Not Found (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: Conflict (PIX-0012, PIX-0033).
        '412':
          content:
            application/json:
              example:
                code: PIX-0031
                title: Idempotency Key Conflict
                message: The Idempotency-Key was already used with a different request.
              schema:
                $ref: '#/components/schemas/LegacyErrorEnvelope'
          description: >-
            X-Idempotency replayed with a divergent request -- a different
            method, URL (including the path parameter), body, or identity header
            among X-Account-Id / X-Reason / X-End-To-End-Id (PIX-0031). Legacy
            {code,title,message} envelope, 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: Unprocessable Entity (PIX-0013).
        '500':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0000
                title: Internal Server Error
                status: 500
                detail: internal error
                code: PIX-0000
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error (PIX-0000).
        '502':
          content:
            application/problem+json:
              example:
                type: https://errors.lerian.studio/v1/PIX-0141
                title: Bad Gateway
                status: 502
                detail: internal error
                code: PIX-0141
              schema:
                $ref: '#/components/schemas/Detail'
          description: Bad Gateway (PIX-0141).
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
components:
  schemas:
    BlocksCloseRefundBody:
      additionalProperties: false
      properties:
        endToEndId:
          examples:
            - D12345678202601011210abcdef01234
          type: string
        explanation:
          examples:
            - devolucao conciliada manualmente apos falha do settle
          type: string
      required:
        - endToEndId
        - explanation
      type: object
    BlocksCloseRefundView:
      additionalProperties: false
      properties:
        alreadySettled:
          examples:
            - '200.00'
          type: string
        blocks:
          items:
            $ref: '#/components/schemas/BlocksCloseBlockView'
          type:
            - array
            - 'null'
        blocksStatus:
          enum:
            - SETTLED
          examples:
            - SETTLED
          type: string
        endToEndId:
          examples:
            - D12345678202601011210abcdef01234
          type: string
        originalAmount:
          examples:
            - '1000.00'
          type: string
        refundId:
          examples:
            - 018f8c1d-1234-7abc-9def-000000000010
          type: string
        settledAmount:
          examples:
            - '800.00'
          type: string
        surplusAmount:
          examples:
            - '200.00'
          type: string
      required:
        - refundId
        - blocksStatus
        - endToEndId
        - originalAmount
        - alreadySettled
        - settledAmount
        - surplusAmount
        - blocks
      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
      required:
        - code
        - title
        - message
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          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
    BlocksCloseBlockView:
      additionalProperties: false
      properties:
        amount:
          examples:
            - '600.00'
          type: string
        failureReason:
          $ref: '#/components/schemas/SettleFailureView'
        lockId:
          examples:
            - b0f5c2a1-9e3d-4c7a-8f21-1a2b3c4d5e6f
          type: string
        settledAmount:
          examples:
            - '600.00'
          type: string
        spiBlockId:
          examples:
            - 7c9a1b2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
          type: string
        status:
          enum:
            - SETTLED
          examples:
            - SETTLED
          type: string
      required:
        - lockId
        - spiBlockId
        - amount
        - settledAmount
        - status
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: 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
    SettleFailureView:
      additionalProperties: false
      properties:
        code:
          examples:
            - PIX-0652
          type: string
        lockId:
          examples:
            - c1a6d3b2-0f4e-5d8b-9032-2b3c4d5e6f70
          type: string
        message:
          examples:
            - falha no Midaz ao liberar o bloqueio
          type: string
      required:
        - lockId
        - code
        - message
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````