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

# Start a MED value recovery refund stage

> Starts the refund stage of a value recovery (JDPI recuperacao-valores/{id}/devolver, contract 2.22). It MOVES NO MONEY — it transitions stRecValores->4 and makes DICT emit refund requests. An unknown id returns a coded 404.



## OpenAPI

````yaml /en/openapi/v3-current/pix.yaml post /v1/med/recoveries/{idRecValores}/devolver
openapi: 3.1.0
info:
  description: Brazilian PIX Direct (DICT + SPI) plugin API.
  title: plugin-br-pix-jd
  version: 1.0.0
servers: []
security:
  - BearerAuth: []
paths:
  /v1/med/recoveries/{idRecValores}/devolver:
    post:
      tags:
        - MED Recoveries
      summary: Start a MED value recovery refund stage
      description: >-
        Starts the refund stage of a value recovery (JDPI
        recuperacao-valores/{id}/devolver, contract 2.22). It MOVES NO MONEY —
        it transitions stRecValores->4 and makes DICT emit refund requests. An
        unknown id returns a coded 404.
      operationId: devolverMedRecovery
      parameters:
        - description: The value-recovery GUID.
          in: path
          name: idRecValores
          required: true
          schema:
            description: The value-recovery GUID.
            examples:
              - b2c3d4e5-f6a7-8901-bcde-f23456789012
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DevolverRecoveryRequestBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecoveryView'
          description: OK
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '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
components:
  schemas:
    DevolverRecoveryRequestBody:
      additionalProperties: false
      properties:
        idempotencyKey:
          description: >-
            Client-supplied idempotency key: any stable business string. The
            plugin projects it deterministically into the GUID form JDPI
            requires (contract 6), so the same value always dedups against the
            same JDPI request and the raw value is never sent verbatim.
          examples:
            - med-devolver-2024-0001
          type: string
      required:
        - idempotencyKey
      type: object
    RecoveryView:
      additionalProperties: false
      properties:
        breached:
          description: >-
            True when the devolver deadline has been reached or passed (computed
            at read time); false when no deadline is set.
          examples:
            - false
          type: boolean
        contatoEmail:
          description: Creator-contact email.
          examples:
            - ops@example.com
          type: string
        contatoTelefone:
          description: Creator-contact phone.
          examples:
            - '+5511999999999'
          type: string
        detalhes:
          description: Free-text detail (required when tpSituacao=4 Outros).
          examples:
            - Suspected scam.
          type: string
        devolverDeadline:
          description: >-
            Creator-side 72h devolver deadline (RFC 3339 UTC; contract
            §2.22/§5), from the Analise stage close; null unless this
            institution is the pspCriador on an Analisada recovery.
          examples:
            - '2024-01-04T12:00:00.000Z'
          type: string
        dictCorrelationId:
          description: >-
            idCorrelacao — the DICT support identifier for this consultar call;
            quote it to JD when disputing whether the read happened.
          examples:
            - a9f13566e19f5ca51329479a5bae60c5
          type: string
        dictReturnedAt:
          description: dtHrRetornoDict — when DICT answered this consultar (contract 2.21).
          examples:
            - '2025-08-27T10:30:05.025Z'
          type: string
        dtHrCriacao:
          description: JDPI creation timestamp (RFC 3339 UTC).
          examples:
            - '2024-01-01T12:00:00.000Z'
          type: string
        dtHrUltModificacao:
          description: JDPI last-modification timestamp (RFC 3339 UTC) — the watermark.
          examples:
            - '2024-01-01T12:05:00.000Z'
          type: string
        idRecValores:
          description: Value-recovery GUID (the natural key).
          examples:
            - b2c3d4e5-f6a7-8901-bcde-f23456789012
          type: string
        idTransacaoRaiz:
          description: EndToEndId of the root transaction being recovered.
          examples:
            - E1234567820240101000000000000001
          type: string
        pspCriador:
          description: ISPB of the recovery creator.
          examples:
            - '12345678'
          type: string
        status:
          description: stRecValores lifecycle code (0=Criada .. 6=Cancelada).
          examples:
            - 0
          format: int64
          type: integer
        statusDescription:
          description: Human-readable stRecValores label.
          examples:
            - Criada
          type: string
        tpSituacao:
          description: Situation code (0..5).
          examples:
            - 0
          format: int64
          type: integer
        tpSituacaoDescription:
          description: Human-readable tpSituacao label.
          examples:
            - Golpe/Estelionato
          type: string
      required:
        - idRecValores
        - idTransacaoRaiz
        - tpSituacao
        - tpSituacaoDescription
        - contatoEmail
        - contatoTelefone
        - pspCriador
        - status
        - statusDescription
        - 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).
          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
    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
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````