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

# Open a MED refund request

> Opens a refund request as the solicitante PSP. The requesting ISPB is derived from configuration. Persists the upstream response entity and returns it.



## OpenAPI

````yaml en/openapi/v3-current/pix.yaml POST /v1/med/refunds
openapi: 3.0.3
info:
  title: Plugin BR Pix Direct - Complete API
  description: |
    Complete API for Brazilian Pix instant payment system including
    Pix key dictionary operations, QR code generation/decoding, transactions and
    transaction limits.
  version: 1.0.0
servers:
  - url: https://plugin-pix-direct.api.lerian.net
  - url: https://plugin-pix-direct-qrcode.api.lerian.net
security:
  - bearerAuth: []
paths:
  /v1/med/refunds:
    post:
      tags:
        - MED API
      summary: Open a MED refund request
      description: >-
        Opens a refund request as the solicitante PSP. The requesting ISPB is
        derived from configuration. Persists the upstream response entity and
        returns it.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SolicitRefundRequestBody'
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundRequestView'
          description: Accepted
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
components:
  schemas:
    SolicitRefundRequestBody:
      additionalProperties: false
      properties:
        detalhes:
          description: Free-text detail; required when motivo=0 (Falha Operacional).
          type: string
        endToEndId:
          description: >-
            EndToEndId of the contested payment (or pacs.004 id for a
            cancellation motivo).
          type: string
        idempotencyKey:
          description: Business-derived idempotency key (Chave-Idempotencia).
          type: string
        motivo:
          description: Refund motivo (0=Falha Operacional, 1=Fraude, 3=Pix Automático).
          format: int64
          type: integer
        valorDevolucaoCents:
          description: Requested refund amount, in centavos.
          format: int64
          type: integer
      required:
        - endToEndId
        - motivo
        - valorDevolucaoCents
        - idempotencyKey
      type: object
    RefundRequestView:
      additionalProperties: false
      properties:
        analysisDeadline:
          description: >-
            Contestado-side analysis deadline; null for filer-side and terminal
            requests.
          type: string
        breached:
          description: >-
            True when the analysis deadline has been reached or passed (computed
            at read time); false when no deadline is set.
          type: boolean
        detalhes:
          description: Free-text detail.
          type: string
        detalhesAnalise:
          description: Analysis detail.
          type: string
        dtHrCriacao:
          description: Upstream creation timestamp (RFC 3339 UTC).
          type: string
        dtHrUltModificacao:
          description: >-
            Upstream last-modification timestamp (RFC 3339 UTC) — the poll
            watermark.
          type: string
        endToEndId:
          description: EndToEndId of the contested payment or devolucao.
          type: string
        endToEndIdDevolucao:
          description: pacs.004/pacs.008 devolucao reference, recorded at analysis.
          type: string
        idRecValores:
          description: Value-recovery GUID, when from a recovery.
          type: string
        idRelatoInfracao:
          description: Linked infraction GUID, when fraud.
          type: string
        idSolDevolucao:
          description: Refund-request GUID (the natural key).
          type: string
        ispbContestado:
          description: ISPB of the contested PSP.
          type: string
        ispbSolicitante:
          description: ISPB of the requesting PSP.
          type: string
        motivo:
          description: >-
            Refund motivo code (0=Falha Operacional, 1=Fraude, 3=Pix
            Automático).
          format: int64
          type: integer
        motivoDescription:
          description: Human-readable refund motivo label.
          type: string
        motivoRejeicao:
          description: >-
            Rejection reason (0,1,3,4); present only when the analysis rejected
            the request.
          format: int64
          type: integer
        motivoRejeicaoDescription:
          description: Human-readable rejection-reason label.
          type: string
        resultadoAnalise:
          description: >-
            Refund analysis result (0=Aceita Totalmente, 1=Aceita Parcialmente,
            2=Rejeitada); null until analysed.
          format: int64
          type: integer
        resultadoAnaliseDescription:
          description: Human-readable refund analysis-result label.
          type: string
        status:
          description: stSolDevolucao lifecycle code (0=Aberta, 1=Cancelada, 2=Analisada).
          format: int64
          type: integer
        statusDescription:
          description: Human-readable stSolDevolucao label.
          type: string
        valorDevolucaoCents:
          description: Requested refund amount, in centavos.
          format: int64
          type: integer
        valorDevolvidoCents:
          description: Amount actually refunded, in centavos; null when absent.
          format: int64
          type: integer
      required:
        - idSolDevolucao
        - endToEndId
        - motivo
        - motivoDescription
        - valorDevolucaoCents
        - status
        - statusDescription
        - ispbSolicitante
        - ispbContestado
        - dtHrCriacao
        - dtHrUltModificacao
        - breached
      type: object
    Detail:
      additionalProperties: false
      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.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          nullable: true
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          format: uri
          type: string
        status:
          description: HTTP status code
          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.
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          format: uri
          type: string
      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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        JWT Bearer token authentication. Obtain token from
        `/v1/login/oauth/access_token` endpoint

        using client credentials (clientId and clientSecret).


        Include token in Authorization header:

        `Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...`


        Token expires after 3600 seconds (1 hour).

````