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

# Refund a Deposit

> Requests the return of a fiat deposit that was received but never matched to an on-ramp order — the ones listed by `GET /customers/{customerId}/refundableDeposits/`.

Whether the request must name a destination account is given by `refundDestinationRequired` on the listed deposit: `true` means `fiatAccountId` is required (Colombia), `false` means the money returns to the account the customer paid from and `fiatAccountId` is rejected.

The request is idempotent: `202` when the refund is registered, `200` when one already exists for the deposit. Once the refund settles you also receive the `ON-RAMP.DEPOSIT.REFUNDED` webhook event.

Deposits whose order was cancelled are refunded through the order instead, with `POST /customers/{customerId}/transactions/onramp/{orderId}/refund/`.



## OpenAPI

````yaml ramps-api/openapi.json POST /api/v1/customers/{customerId}/refundableDeposits/{depositUuid}/refund/
openapi: 3.1.0
info:
  title: Ripio Ramp API
  version: v1
  description: >-
    API for Ripio ramp services, enabling partners to integrate On-Ramp,
    Off-Ramp, customer management, KYC processes, and other financial
    functionalities. This API is RESTful, uses JSON for requests and responses,
    and standard HTTP status codes. This document is based on the
    'onramp-api.pdf' provided and aims to be compliant with OpenAPI
    Specification v3.1.0. The PDF indicates that the API documentation is a
    draft and subject to change.
servers:
  - url: https://skala-sandbox.ripio.com
    description: Sandbox environment
  - url: https://skala.ripio.com
    description: Production environment
security:
  - BearerToken: []
tags:
  - name: Authentication
    description: Operations related to API authentication and authorization.
  - name: Support Tickets
    description: >-
      Operations for raising and tracking customer support tickets with Ripio's
      support team. This feature must be enabled for your account by the Ripio
      team.
  - name: Customers
    description: Operations related to customer management.
  - name: KYC
    description: Operations related to Know Your Customer processes.
  - name: Fiat Accounts
    description: Operations related to managing fiat accounts and their requirements.
  - name: Quotes
    description: Operations related to obtaining and managing conversion quotes.
  - name: On-Ramp
    description: Operations related to fiat-to-crypto (on-ramp) processes.
  - name: Off-Ramp
    description: Operations related to crypto-to-fiat (off-ramp) processes.
  - name: Refunds
    description: >-
      Operations for returning the money of an on-ramp or off-ramp operation
      that could not be completed. Each ramp must be enabled for your account by
      the Ripio team.
  - name: Transactions
    description: Operations related to listing and managing all transaction types.
  - name: Networks
    description: >-
      Operations related to retrieving available deposit and withdrawal
      networks.
  - name: Rates
    description: Operations related to retrieving market rates.
  - name: Transaction Limits
    description: >-
      Operations related to retrieving per-transaction limits by currency and
      ramp operation.
  - name: Sandbox
    description: Operations specific to the sandbox environment for testing purposes.
  - name: Webhooks
    description: Webhook event notifications from Ripio Ramp API.
  - name: Sell and Pay
    description: >-
      Endpoints for managing Sell and Pay transactions, which allow customers to
      convert cryptocurrency to fiat currency and pay merchants via QR codes
paths:
  /api/v1/customers/{customerId}/refundableDeposits/{depositUuid}/refund/:
    post:
      tags:
        - Refunds
      summary: Refund a Deposit
      description: >-
        Requests the return of a fiat deposit that was received but never
        matched to an on-ramp order — the ones listed by `GET
        /customers/{customerId}/refundableDeposits/`.


        Whether the request must name a destination account is given by
        `refundDestinationRequired` on the listed deposit: `true` means
        `fiatAccountId` is required (Colombia), `false` means the money returns
        to the account the customer paid from and `fiatAccountId` is rejected.


        The request is idempotent: `202` when the refund is registered, `200`
        when one already exists for the deposit. Once the refund settles you
        also receive the `ON-RAMP.DEPOSIT.REFUNDED` webhook event.


        Deposits whose order was cancelled are refunded through the order
        instead, with `POST
        /customers/{customerId}/transactions/onramp/{orderId}/refund/`.
      operationId: refundDeposit
      parameters:
        - $ref: '#/components/parameters/CustomerId'
        - $ref: '#/components/parameters/DepositUuid'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FiatRefundRequest'
      responses:
        '200':
          description: A refund already exists for this deposit; nothing new was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FiatRefundResponse'
        '202':
          description: Refund requested.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FiatRefundResponse'
        '400':
          description: >-
            Bad Request - `fiatAccountId` is required for this provider and was
            not supplied, was supplied for a provider that refunds to origin
            (`20068`), the deposit has no origin account to refund to (`20069`),
            or the provider does not support partner-initiated refunds
            (`20070`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 20067
                type: FiatAccountRequiredForRefundException
                detail:
                  message: >-
                    fiatAccountId is required to refund a deposit for this
                    provider.
                status: 400
        '401':
          description: Unauthorized - Invalid or missing access token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 40001
                type: NotAuthenticated
                detail:
                  message: Authentication credentials were not provided.
                  code: not_authenticated
                status: 401
        '403':
          description: >-
            Forbidden - fiat refunds are not enabled for your account. Contact
            the Ripio team to enable this feature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 20056
                type: FiatRefundNotEnabledException
                detail:
                  message: Fiat refunds are not enabled for this account.
                status: 403
        '404':
          description: >-
            Not Found - the resource does not exist or does not belong to your
            account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 40004
                type: NotFound
                detail:
                  message: Not found.
                  code: not_found
                status: 404
        '409':
          description: >-
            Conflict - a refund is already in progress or completed for this
            deposit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 20057
                type: FiatRefundAlreadyExistsException
                detail:
                  message: A refund already exists for this deposit.
                status: 409
components:
  parameters:
    CustomerId:
      name: customerId
      in: path
      required: true
      description: Unique identifier for the customer.
      schema:
        type: string
        format: uuid
      example: 8142b065-79c4-4f48-9e33-11b17bc658d4
    DepositUuid:
      name: depositUuid
      in: path
      required: true
      description: Unique identifier for the deposit.
      schema:
        type: string
        format: uuid
      example: 7a1f4c2e-9d3b-4e5a-8c6f-1b2d3e4f5a6b
  schemas:
    FiatRefundRequest:
      type: object
      description: >-
        Body of a fiat refund request. Send `fiatAccountId` only when
        `refundDestinationRequired` is `true`.
      properties:
        fiatAccountId:
          type: string
          format: uuid
          description: >-
            Identifier of an `ENABLED` fiat account of the same customer, where
            the money is returned. Rejected by providers that refund to the
            account the customer paid from.
          example: 3c9f1f0e-6a2d-4a7c-9f1e-2b8d4c5a6e7f
    FiatRefundResponse:
      type: object
      description: Acknowledgement of a fiat refund request.
      properties:
        refundId:
          type: string
          format: uuid
          description: Unique identifier of the refund.
        status:
          type: string
          enum:
            - PENDING
            - PROCESSING
            - COMPLETED
            - REJECTED
            - FAILED
            - CANCELLED
          description: >-
            Current state of the refund: `PENDING` (registered, not yet sent to
            the provider), `PROCESSING` (sent, awaiting confirmation),
            `COMPLETED` (the money reached its destination), `REJECTED` (the
            request was declined — see `rejectionReason` — and nothing was sent)
            or `FAILED` / `CANCELLED` (the attempt did not go through; contact
            Ripio support).
        depositUuid:
          type: string
          format: uuid
          description: Identifier of the deposit being refunded.
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          description: Application-specific error code.
        type:
          type: string
          description: Type of error or exception.
        detail:
          type:
            - object
            - array
          description: >-
            Error details. The shape depends on the error:


            - Most business errors return an object with a `message` key.

            - Field validation errors return an object keyed by field name, each
            holding an array of `{ message, code }`.

            - Request-level validation errors (e.g. a missing query parameter)
            return a bare array of `{ message, code }`.
          properties:
            message:
              type: string
              description: Detailed error message.
          additionalProperties: true
        status:
          type: integer
          description: HTTP status code.
      required:
        - code
        - type
        - detail
        - status
  securitySchemes:
    BearerToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Access token obtained via
        [/oauth2/token/](/ramps-api/authentication/acquire-access-token). Use as
        `Authorization: Bearer <access_token>`.

````