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

# Refund a Received Pix Transfer

> Use this endpoint to initiate a refund for a previously received Pix transfer. Optionally provide an operations array for distributed partial refunds from multiple accounts. Only received Pix transfers (cash-in) can be refunded; the sum of all refunds cannot exceed the original amount.



## OpenAPI

````yaml /pt/openapi/v3-current/indirect-pix.yaml post /v1/transfers/{transfer_id}/refunds
openapi: 3.1.0
info:
  description: >-
    API for Pix Indirect via BTG. It covers DICT keys and claims; MED infraction
    reports, fraud markers, refund requests, and funds recoveries; DICT
    statistics and reconciliation; Pix transfers, refunds, and schedules; static
    QR codes and QR code decoding; immediate and due-date collections; Pix
    Automático for the payer; transaction reports and TemposTransacoes
    statistics; and inbound and outbound webhook records.
  title: Pix BTG API
  version: 1.12.0
servers:
  - url: https://api.example.com
    description: >-
      Replace the example host with the URL provided during environment
      onboarding.
security:
  - BearerAuth: []
paths:
  /v1/transfers/{transfer_id}/refunds:
    post:
      tags:
        - Refunds
      summary: Refund a Received Pix Transfer
      description: >-
        Use this endpoint to initiate a refund for a previously received Pix
        transfer. Optionally provide an operations array for distributed partial
        refunds from multiple accounts. Only received Pix transfers (cash-in)
        can be refunded; the sum of all refunds cannot exceed the original
        amount.
      operationId: payment-create-refund
      parameters:
        - description: Database UUID of the original Pix transfer (cashin)
          in: path
          name: transfer_id
          required: true
          schema:
            description: Database UUID of the original Pix transfer (cashin)
            format: uuid
            type: string
        - description: Account ID that received the original transfer (UUID format)
          in: header
          name: X-Account-Id
          required: true
          schema:
            description: Account ID that received the original transfer (UUID format)
            format: uuid
            type: string
        - description: Refund reason code
          in: header
          name: X-Reason
          required: true
          schema:
            description: Refund reason code
            enum:
              - BE08
              - FR01
              - MD06
              - SL02
            type: string
        - description: Optional custom return end-to-end ID (32 chars, D prefix)
          in: header
          name: X-Return-End-To-End
          schema:
            description: Optional custom return end-to-end ID (32 chars, D prefix)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRefundCashoutInput'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundCashoutOutput'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorBody'
          description: Bad Request
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorBody'
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorBody'
          description: Error
components:
  schemas:
    CreateRefundCashoutInput:
      additionalProperties: false
      properties:
        amount:
          examples:
            - '100.50'
          minLength: 1
          type: string
        description:
          examples:
            - Customer reported unauthorized transaction
          maxLength: 140
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operations:
          items:
            $ref: '#/components/schemas/RefundOperation'
          maxItems: 50
          minItems: 1
          type: array
      required:
        - amount
      type: object
    RefundCashoutOutput:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 01989f9e-6508-79f8-9540-835be49fbd0d
          type: string
        amount:
          examples:
            - '100.50'
          type: string
        createdAt:
          examples:
            - '2024-01-15T10:30:00Z'
          type: string
        deletedAt:
          type: string
        description:
          examples:
            - Customer reported unauthorized transaction
          type: string
        id:
          examples:
            - 550e8400-e29b-41d4-a716-446655440001
          type: string
        ledger:
          $ref: '#/components/schemas/LedgerInfo'
        metadata:
          additionalProperties: {}
          type: object
        originalEndToEndId:
          examples:
            - E12345678202411241430ABCDEFGHIJK
          type: string
        returnEndToEndId:
          examples:
            - D3030629420200808185300887639654
          type: string
        status:
          enum:
            - PENDING
            - PROCESSING
            - COMPLETED
            - FAILED
            - CANCELLED
          examples:
            - PENDING
          type: string
        type:
          enum:
            - CASHOUT
            - CASHIN
          examples:
            - CASHOUT
          type: string
        updatedAt:
          examples:
            - '2024-01-15T10:30:00Z'
          type: string
      required:
        - id
        - originalEndToEndId
        - returnEndToEndId
        - amount
        - status
        - type
        - accountId
        - createdAt
        - updatedAt
      type: object
    LegacyErrorBody:
      additionalProperties: false
      properties:
        fields:
          additionalProperties:
            type: string
          type: object
        headers:
          additionalProperties:
            type: string
          type: object
        message:
          type: string
        paths:
          additionalProperties:
            type: string
          type: object
        queryParams:
          additionalProperties:
            type: string
          type: object
        raw:
          type: string
        code:
          type: string
        title:
          type: string
      required:
        - code
        - title
        - message
      type: object
    RefundOperation:
      additionalProperties: true
      properties:
        accountAlias:
          examples:
            - '@account/alias-conta-cliente'
          maxLength: 255
          minLength: 1
          type: string
        amount:
          examples:
            - '100.50'
          minLength: 1
          type: string
      required:
        - accountAlias
        - amount
      type: object
    LedgerInfo:
      additionalProperties: false
      properties:
        destinationOperationId:
          examples:
            - 550e8400-e29b-41d4-a716-446655440013
          type: string
        revert:
          $ref: '#/components/schemas/LedgerRevertInfo'
        sourceOperationId:
          examples:
            - 550e8400-e29b-41d4-a716-446655440012
          type: string
        transactionId:
          examples:
            - 550e8400-e29b-41d4-a716-446655440011
          type: string
      type: object
    LedgerRevertInfo:
      additionalProperties: false
      properties:
        destinationOperationId:
          examples:
            - 550e8400-e29b-41d4-a716-446655440016
          type: string
        sourceOperationId:
          examples:
            - 550e8400-e29b-41d4-a716-446655440015
          type: string
        transactionId:
          examples:
            - 550e8400-e29b-41d4-a716-446655440014
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````

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