Skip to main content
The Swap API converts one token into another — same-chain (e.g. USDC → USDT on Polygon, via Rach’s on-chain FiatSwapV2 proxy) or cross-chain (e.g. Polygon → BSC, via a bridge). Quote first, then execute. Authenticate with your Payments API key (X-API-Key).
Base URL: https://api.rach.finance/api/v1/ · Auth: X-API-Key (quote is public)

Amounts are in base units

amount_in and every amount in the response are in base units, not whole tokens. amount_in=100 on USDC means 100 base units = 0.0001 USDC, not 100 USDC.Use amount to pass a human figure instead — amount=100 means 100 USDC. Pass one or the other, never both.Responses are always base units. Divide by the token’s decimals to display them: USDC/USDT are 6 on most chains but 18 on BSC; native coins (ETH, BNB, POL, AVAX, CELO) are 18.

1. Get a quote

GET /swap/quote is public — no key required.
Response
Both tokens come back as resolved contract addresses, and all amounts are base units — here 6-decimal USDC, so 98046740 is 98.04674 USDT. The platform fee is 0.30%. to_amount_min reflects slippage protection — the swap reverts if output would fall below it.

Routing is automatic

You do not choose a venue. Rach picks it from the chains and tokens you pass: If our contract cannot serve a same-chain pair (no pool or liquidity), the quote falls back to LiFi automatically. Nothing is broadcast during quoting, so the fallback is free.
Execution currently starts from a POL or BSC wallet only. A request whose from_chain is anything else is rejected up front with a clear error — quotes still work for any pair.

2. Execute the swap

Run the swap for a customer wallet. Pass amount_out_min to protect against slippage — the quote’s to_amount_min is exactly what you want here.
amount_out_min must use the same unit as the amount field you sent. Send amount_in (base units) and amount_out_min is read as base units; send amount (human) and it is read as human. Mixing them silently sets the wrong slippage floor.The quote returns base units, so feeding a quote straight into execution means using amount_in + to_amount_min together — as below.
Response
status is pending when the transaction is broadcast — not when the swap has settled. Rach confirms it in the background; poll history for the final confirmed or failed. Cross-chain swaps can take several minutes to complete on the destination chain.
Re-quote if a quote is more than a few seconds old. If the live route can no longer deliver your amount_out_min, execution stops before anything is broadcast and returns an error telling you to re-quote — your customer’s funds are never at risk from a stale quote.

3. Track history

Same-chain swaps on Polygon and BSC route through Rach’s FiatSwapV2 proxy (0.30% platform fee, applied on-chain). Cross-chain swaps bridge via an aggregator and take longer — estimated_seconds reflects the route.
See the Swap endpoints in the Payments API Reference.