Preview a Swap

What does this endpoint do?

The purpose of this endpoint is to simulate a ramp process and generate a quote. It validates your payload, calculates the exchange rate, and estimates the blockchain fees.

Flow Configuration: The flow is determined by the properties you include in the request:

  • On-ramp: Include cryptoWithdrawalInformation to ensure the cryptocurrency is sent to the correct wallet.
  • Off-ramp: Include fiatWithdrawalInformation to ensure the funds are sent to the correct PIX key.

Refund Configuration & Auto-Refunds

To enable automatic refunds in case of an error during the flow, you must provide the refundCryptoAddress property in this request.

Refund Constraints

The eligibility for an automatic refund depends on when the error occurs:

  • Before Trade: If the error happens before the exchange takes place, the refund can be processed for any currency pair.
  • After Trade: If the error happens after the exchange, the automatic refund is supported only for equivalent currency pairs (e.g., BRL-BRZ).

Quote Information

To generate a valid preview, you must provide the quoteRequest object containing the specific trade details (such as amount, side, and currencies).

Note: Unlike the v1 endpoint, passing a pre-existing quoteId is not supported here, as this endpoint is responsible for calculating the quote.

Response Data

The response will include a previewId and a blockchainFee.

  • previewId: Required to call the Create Swap Order (Accept) endpoint.
  • blockchainFee: specifically refers to the fee charged by the blockchain network to process the transaction, unrelated to service fees.
Language
Click Try It! to start a request and see the response here!