Skip to main content

Overview

Swaps funds between two wallets that belong to the authenticated business. There is no beneficiary and no payout fee.
  • Debit the source wallet and credit the destination wallet in one request
  • The currency pair must already be enabled for your business (GET /pairs)
  • amountToBeSent must match the current rate for swapAmount
  • A new swap returns partner status PROCESSING
Wallet ids come from Get Wallet Balances (walletId). The business is taken from your API key. Do not send businessId in the body.

Required Headers

Idempotency-Key is required. A missing header returns 400 Bad Request.

Request

Request Body

amountToBeSent in the example is illustrative. Send the destination amount that matches the live rate, or the API returns 400 with message Invalid payout amount.

Request Fields

Response

201 Created

Response Fields

Save id. Load it later with Get Payout or Swap by ID. That is the same route used for payouts. List only swaps with List Payouts and Swaps and view=swaps.A swap is settled between your wallets immediately, and status stays PROCESSING until Yala ops marks it SUCCESSFUL or reverses it (REJECTED).

Idempotency

Same behavior as initiate:
  • Same key + same body: returns the original swap
  • Same key + different body: 409 Conflict
  • Missing key: 400 Bad Request
Retry a network failure with the same key and the same body.

Error Responses

400 Bad Request - Missing Idempotency Key

400 Bad Request - Pair not enabled

Enable the pair in the dashboard, or with PATCH /v1/payout-api/payouts/currency-pairs/{currencyPairId}/toggle, then retry.

400 Bad Request - Amount does not match the rate

Read the current rate from GET /pairs, recompute amountToBeSent, and send a new idempotency key.

400 Bad Request - Same wallet or currency mismatch

404 Not Found - Wallet

409 Conflict - Idempotency key reused

Usage Example

Webhooks

Creating a swap emits payout.status.changed. newStatus is PROCESSING. Later confirmation or reversal uses the same webhook with SUCCESSFUL or REJECTED. The same subscription URL also receives wallet.debited and wallet.credited for the two wallet movements. See the Webhooks guide.

Notes

  • Funds move at creation. There is no separate approval step before the wallets are updated.
  • No supporting document is required.
  • Track the swap with GET /v1/payout-api/payouts/swaps/{id}. method is SWAP.