We build Plaxswap, and this guide first appeared in our help center. It shows our swap API, but the flow (quote, deposit address, status) is how most non-custodial swap APIs work.

The swap API is JSON over HTTPS. Your app quotes a swap, gets a one-time deposit address from the route, and follows the swap until the new coin reaches your user's wallet. Plaxswap compares NEAR Intents and Relay for these swaps and never holds the coins. Rates float: there are no fixed quotes. Each request is shown on the developers page, and the machine-readable reference is at /api/v1/openapi.json.

The four calls

  1. GET /api/v1/dex/coins lists the coins and their ids.
  2. POST /api/v1/dex/routes returns the routes for an amount, with what your user receives, the least they receive, the fees and the time. Send pay: "send" and your user's payout address in toAccount.
  3. POST /api/v1/dex/build with a route id returns the deposit address and the exact amount to send. A route id is valid for 2 minutes.
  4. GET /api/v1/dex/status follows the swap by that address until it shows SUCCESS, REFUNDED or FAILED.

Here is the quote request for 0.01 BTC to ETH, with a 0.5% commission:

curl -s "https://plaxswap.com/api/v1/dex/routes" \ -H "content-type: application/json" \ -H "x-api-key: $PX_KEY" \ -H "x-user-ip: 203.0.113.7" \ -d '{"from":"btc","to":"eth","amount":"0.01","pay":"send", "toAccount":"0xUSER_PAYOUT_ADDRESS","account":"bc1qUSER_REFUND_ADDRESS", "commissionBps":50,"commissionTo":"0xYOUR_WALLET"}' 

Each route in the answer has an id, the provider, toAmount, toAmountMin and seconds. Pass the id you pick to /api/v1/dex/build, show your user the deposit address and amount it returns, then poll /api/v1/dex/status.

What you need

  • A partner key, sent in the x-api-key header. Get one on the partner page.
  • Your user's IP address in the x-user-ip header, so the country rules apply to your user and not to your server. Swaps are refused in sanctioned countries.
  • Your user's refund address on the sending network, sent as account, when the routes answer says refundNeeded.

Your commission

Add commissionBps, up to 2%, and commissionTo, your EVM wallet. The route pays the commission straight to that wallet: on Relay you claim it at relay.link, and on NEAR Intents you withdraw it at near-intents.org, where NEAR keeps half of it. Your users see the commission inside the quote.

Limits and errors

Requests are rate limited per IP address (your user's, with a partner key). Errors come back as JSON with a code and a plain message, listed on the developers page. There is also a public Postman workspace with the swap and payments collections, if you'd rather try the calls there first.