Quotes & Swaps Overview

Choose a locked quote or a live rate, execute a balance swap, and reconcile the transaction.

A swap moves funds between two balances on your HoneyCoin account. For example, you can convert USD to KES, swap USDC for USDT, or move XOF between your Benin and Senegal ledgers. The debit and credit settle together.

When you need to…UseAPI calls
Show the receiver amount before committingA quoted swapCreate a quote, then create a swap
Convert immediately at the current rateA direct swapCreate a swap

Before you start

Use the bearer token for your environment and send Content-Type: application/json with POST requests.

EnvironmentBase URL
Productionhttps://api-v2.honeycoin.app/api/b2b
Sandboxhttps://api-v2.honeycoin.app/api/sandbox/b2b

In production, enable Swaps on an onboarded, approved account and fund the source balance. The account’s active IP allowlist applies to quotes, swaps, transaction history, and balances. In sandbox, you can start with an unfunded account. Authentication · IP allowlisting

Execute a quoted swap

1. Get the rate and receiver amount

Send this body to POST /quotes to price a 100 USD debit in KES. Creating the quote leaves both balances unchanged.

{
  "type": "swap",
  "senderAmount": 100,
  "senderCurrency": "USD",
  "receiverCurrency": "KES"
}

From the 201 Created response, save data.id as the quote ID. Show the customer data.exchangeRate, data.receiverAmount, and data.receiverCurrency. The rate is valid through data.expiresAt, a Unix timestamp in milliseconds. Use the returned deadline for each quote.

2. Submit the confirmed quote

Send the saved ID to POST /swaps. Include an X-Idempotency-Key header and a unique externalReference for this swap. The quote supplies the amount, currencies, and countries. Sending those fields again returns 400 VALIDATION_ERROR.

{
  "quoteId": "qt_01JXYZ123456",
  "externalReference": "kes-top-up-001",
  "note": "KES treasury top-up"
}

Execute a direct swap

For an immediate conversion, send the amount and both currencies to POST /swaps. Include a fresh X-Idempotency-Key header for this new swap. This example buys USDC with 100 USD.

{
  "senderAmount": 100,
  "senderCurrency": "USD",
  "receiverCurrency": "USDC",
  "externalReference": "usdc-top-up-001"
}

Use senderCountry or receiverCountry to select a country-specific fiat balance. XOF requires an explicit country. USD defaults to US and XAF to CM. Omit the country for USDC and USDT. Both legs must resolve to different ledgers. Supported currencies and country codes

Confirm settlement

For either mode, 201 Created with data.status set to successful confirms that both balances have been updated. The response includes the transaction ID, exchange rate, and before-and-after balances for each leg. Direct swaps return data.quoteId: null.

To verifyRead
The recorded swapGET /transactions/{id} using the swap’s data.id. Match type: "swap" and your externalReference.
Which transaction used a quoteGET /quotes/{quoteId}. A consumed quote’s data.consumedById is the swap transaction ID.
Current balancesGET /users/balances. Match the currency and country for each leg.

Recover after a timeout or conflict

⚠️

A consumed quote already has a settled swap

If the response was lost, check the quote and its linked transaction before starting another conversion. A fresh quote and external reference can move the funds a second time.

Keep the original request body, external reference, and idempotency key together. Replay the same request after a timeout or 5xx. The keyed replay window is one hour. For 409 IDEMPOTENCY_IN_PROGRESS, wait for Retry-After before replaying.

What you findWhat to do
The quote is consumedFetch the transaction identified by consumedById. The conversion has already settled.
The external reference is already in useLook up GET /transactions?externalReference=… and match the transaction to the intended swap. This also works for a direct swap.
The quote is expired and consumedById is nullCreate a fresh quote, confirm the new amounts, and use a new idempotency key for the updated request.

Try the sandbox walkthrough · Idempotency and retries