Create Swap

Initiate a transfer without rate locking before your funds have arrived on Wyre

Create Swap Response

Response FieldMeaning
idThe swap object id.
ownerThe owner of this swap. It will be a user srn.
statusPossible statuses are CREATED, PROCESSING, COMPLETED, EXPIRED, PROCESSING_REFUND, REFUNDED
sourceCurrencyThe funding currency of this swap.
destCurrencyThe exchange currency of this swap.
dest
refundTo
fundingAddressThe address generated for this swap. This is where funds should be sent to execute the swap.
createdAt
updatedAt
expiresAtA milliseconds epoch timestamp when the transfer will expire which will be 72 hours from its creation time
swapTransfersAn array of transfer history for this swap.

Swaps Overview

The swap API is used to generate a funding address for the swap without specifying the source amount and without the rate locking limitation of a transfer. Normally, transfers have their totals and rates locked upfront; however, the swap API can create defer calculating the total amount until the fund arrives.

Swap Lifecycle

A newly created swap will be in CREATED status.

When fund arrives on the fundingAddress, 2 things could happen.

For the success path, the swap status will be changed to PROCESSING when a transfer is created. When the fund is confirmed on the network, the status will be changed to COMPLETED.

In case of the deposit fund is too small and no amount is left for sending the the dest after subtracting all the fees. We will try to refund the deposit amount specify in the refundTo parameter.
If the refundTo is a wallet srn, account srn, or user srn. It is not likely to have any refund issue. However, if the refundTo value is a wallet address and in case the error is amount to small, we will refund the funding amount to the swap owner which is the user srn. The status will be changed from CREATED to PROCESSING_REFUND to REFUND.

Once in PROCESSING state, the exchange rate are defined and locked. You could retrieved the swap transfer by calling the get swap endpoint.

Expiration

After a swap has expired, it will cease to function. Funds sent to it will be sent to the refundTo parameter. In case of any error, it will refund to the swap owner which is user srn.

🚧

Use Masquerading

The endpoint only accept a valid user session. If you are creating a swap on behalf of the user, you will need to use the masqueradeAs URL parameter.

You will encounter AccessDeniedException responses if you attempt to create a swap without this.

Language
Authorization
Header
Click Try It! to start a request and see the response here!