Crypto swap API documentation
Quote and create swaps from your own app or site. Payouts go straight to your user's address. You can add your own commission on top of the rate. On the swap form's decentralized routes (/api/v1/dex), a commission also needs commissionTo, the EVM wallet the route pays it to.
Every endpoint, request and response field, error and webhook, in a format API tools and code generators read.
Taking payments on your website? Use the payment gatewayCreate a payment, send your customer to our checkout, get a signed webhook. Quickstart, webhooks, code samples and test mode.Overview
JSON over HTTPS. Coin amounts are decimal strings in coin units ("0.015"), never floats. US dollar values are numbers. Times are ISO 8601 strings in UTC. A coin on a particular network is a method, with an id such as btc, eth-base or usdt-tron: use those ids for from and to.
Sandbox
A build running in sim mode is the sandbox: every chain is simulated and no real coins move. The same endpoints work, plus two developer helpers that only exist outside mainnet: POST /api/dev/deposit sends a test deposit to an order (with a clean, high_risk or sanctioned scenario) and POST /api/dev/mine mines blocks so it confirms. GET /api/v1/meta tells you which mode you are talking to.
BASE=http://localhost:4200
curl -s -X POST "$BASE/api/dev/deposit" -H "content-type: application/json" \
-d '{"orderId":"ORDER_ID","scenario":"clean"}'
curl -s -X POST "$BASE/api/dev/mine" -H "content-type: application/json" -d '{"blocks":3}'Authentication
Partner requests carry an API key in the x-api-key header (Authorization: Bearer also works). Keys look like pxk_<prefix>_<secret> and are shown only once: get one on the partner page (it works at once, within starter limits we can raise). Requests without a key are treated as a regular visitor with no commission. A wrong or switched-off key gets 401 invalid_api_key.
End-user IP
Country rules apply to the person swapping, not to your server. With an API key, every request that prices or creates something must send that person's public IP address in x-user-ip. Requests without it fail with user_ip_required, and private or reserved addresses with user_ip_invalid. If you know the person's country (for example from Cloudflare's CF-IPCountry), send it too, as two letters in x-user-country: we use it when we cannot place the IP address ourselves. You vouch for it as for the IP address.
Rate limits
Limits count requests per IP address (your end user's, with an API key). Going over returns HTTP 429 with the code rate_limited. Endpoints not listed here have no fixed limit, but cache /api/v1/coins: it changes rarely.
| Endpoint | Limit |
|---|---|
| GET /api/v1/pair | 120 per minute |
| GET /api/v1/prices/history | 120 per minute |
| POST /api/v1/quotes | 20 per minute |
| POST /api/v1/orders | 10 per minute |
| POST /api/v1/orders/{id}/aml | 10 per IP address and minute |
| POST /api/v1/orders/{id}/aml/documents | 20 per IP address and minute |
| POST /api/v1/kyc/{id}/submit | 10 per minute |
| POST /api/v1/payment-links | 10 per minute without an API key, 60 with one |
| GET /api/v1/payment-links/{id} | 120 per minute |
| POST /api/v1/payment-links/{id}/quote | 20 per minute |
| POST /api/v1/payment-links/{id}/orders | 10 per minute |
| GET /api/v1/payment-links/{id}/payments | 60 per minute |
| POST /api/v1/payment-links/{id}/cancel | 60 per minute |
| GET /api/v1/alerts | 60 per minute |
| POST /api/v1/alerts | 10 per 10 minutes |
| GET /api/v1/alerts/{id} | 60 per minute |
| DELETE /api/v1/alerts/{id} | 30 per minute |
| GET /api/v1/telegram | 60 per minute |
| POST /api/v1/telegram/webapp | 30 per 10 minutes |
| GET /api/v1/account | 120 per minute |
| POST /api/v1/account | 10 per minute |
| POST /api/v1/account/restore | 10 per minute, 30 per hour |
| POST /api/v1/account/key | 10 per minute |
| POST /api/v1/account/forget | 20 per minute |
| GET /api/v1/account/orders | 120 per minute |
| POST /api/v1/account/orders/{id}/access | 30 per minute |
| GET /api/v1/account/addresses | 120 per minute |
| POST /api/v1/account/addresses | 30 per minute |
| PATCH /api/v1/account/addresses/{id} | 30 per minute |
| DELETE /api/v1/account/addresses/{id} | 30 per minute |
| GET /api/v1/account/referrals | 120 per minute |
| GET /api/v1/account/withdrawals | 120 per minute |
| POST /api/v1/account/withdrawals | 5 per minute |
| GET /api/v1/partner | 60 per minute |
| POST /api/v1/partner/signup | 3 per hour |
| GET /api/v1/partner/orders | 60 per minute |
| GET /api/v1/partner/withdrawals | 60 per minute |
| POST /api/v1/partner/withdrawals | 5 per minute |
| POST /api/v1/consent | 20 per minute |
| POST /api/v1/support | 20 tries per 10 minutes, 5 new requests per hour |
| GET /api/v1/support/{id} | 60 per minute |
| POST /api/v1/support/{id}/messages | 10 per 10 minutes |
| POST /api/v1/assistant | set by Plaxswap (20 per 10 minutes by default) |
| POST /api/v1/assistant/event | 20 per 10 minutes |
| POST /api/v1/merchant/security/approve | 10 approvals per minute per merchant, plus persisted five-attempt/five-minute lock |
| GET /api/v1/merchant/swaps | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/swaps | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/swaps/quote | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/swaps/cancel | 300 requests a minute per key (Admin can change it) |
| PATCH /api/v1/merchant/swaps/preferences | 300 requests a minute per key (Admin can change it) |
| GET /api/v1/payments | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/payments | 300 requests a minute per key (Admin can change it) |
| GET /api/v1/payments/{id} | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/payments/{id}/cancel | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/payments/{id}/simulate | 300 requests a minute per key (Admin can change it) |
| GET /api/v1/gateway/coins | 60 per minute per IP address |
| GET /api/v1/merchant | 300 requests a minute per key (Admin can change it) |
| PATCH /api/v1/merchant | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/keys | 300 requests a minute per key (Admin can change it) |
| PATCH /api/v1/merchant/keys/{id} | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/webhook-secret | 300 requests a minute per key (Admin can change it) |
| GET /api/v1/merchant/webhooks | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/webhooks/test | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchant/webhooks/{id}/resend | 300 requests a minute per key (Admin can change it) |
| POST /api/v1/merchants/signup | 10 per hour per IP address |
| GET /api/v1/checkout/{id} | 240 per minute |
| POST /api/v1/checkout/{id}/quote | 15 per minute |
| POST /api/v1/checkout/{id}/pay | 10 per minute |
| POST /api/v1/checkout/{id}/simulate | 20 per minute |
Two more limits protect the service: at most 10 new orders per device per hour (velocity_limit), and at most 6 open live streams per IP address (too_many_streams).
Swap API flow
This is the way to run swaps from your app or site today. The user sends coins to a one-time deposit address and the new coin goes straight to their own wallet. Plaxswap compares NEAR Intents and Relay for these deposit swaps and never holds the coins: the deposit address belongs to the route. Rates float; there are no fixed rates.
1. Coins
GET /api/v1/dex/coins lists the coins and their ids (add ?list=v2 for about 200 more popular coins). Cache it for a minute or more.
2. Routes
Ask for routes with the amount to send and pay set to send. toAccount is the user's payout address. When the answer has refundNeeded: true, ask again with account, the user's own address on the sending network, where a failed swap is refunded. For your commission, add commissionBps (0 to 200) and commissionTo, your EVM wallet.
curl -s "$BASE/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 has an id, the provider, toAmount, toAmountMin (the least the user gets), providerFeePct, plaxswapFeePct, partnerFeePct and seconds, the expected time. Best first. Plaxswap's fee is at most 0.3% and is already inside toAmount. A route id is valid for 2 minutes.
3. Deposit address
POST /api/v1/dex/build with {"routeId": "…"} returns kind: "deposit" with depositAddress, memo (when the network needs one), amount, toAmountMin, provider and track. Show the address and the exact amount to the user. An expired route id gets 409 quote_expired: ask for routes again.
4. Status
GET /api/v1/dex/status?depositAddress=TRACK&provider=near (or provider=relay), with the track value from step 3. status moves through PENDING_DEPOSIT, KNOWN_DEPOSIT_TX and PROCESSING to SUCCESS, REFUNDED or FAILED; txs.in and txs.out hold the transaction hashes.
Swaps are refused in sanctioned countries (403 country_blocked), and payout, refund and commission addresses on the sanctions list are refused before any deposit address exists.
Endpoints
Service
Mode, coins, status and policies. No authentication.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/meta | Service mode, the caller's country rules and time limits |
| GET | /api/v1/coins | Coins, networks and methods (a coin on a network) |
| GET | /api/v1/status | Price feed, queues and network health |
| GET | /api/v1/reserves | Balances held against payouts owed |
| GET | /api/v1/stats | Swap counts, volume and median time to payout |
| GET | /api/v1/recent | The latest completed swaps, without addresses |
| GET | /api/v1/compliance/policy | Country rules, limits, review deadline and travel-rule threshold |
| GET | /api/v1/telegram | Whether the Telegram bot is set up, its links and commands |
| POST | /api/v1/telegram/webapp | Follow an order in the Telegram chat that opened the swap screen |
| POST | /api/v1/consent | Accept the terms of service and privacy notice (the site's banner) |
| GET | /api/v1/openapi.json | This document |
Swaps
Prices, quotes and new orders, and the website swap form's decentralized routes (/api/v1/dex). An API key is optional and adds your commission; on swap-form routes the commission also needs commissionTo.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/dex/coins | The swap form's coins |
| POST | /api/v1/dex/routes | Decentralized routes for a pair and amount, best first |
| POST | /api/v1/dex/build | The transaction for the customer's wallet, or a Relay or NEAR Intents deposit address |
| GET | /api/v1/dex/status | Progress of a swap paid to a one-time deposit address (NEAR Intents or Relay) |
| GET | /api/v1/dex/deposit | Who holds a one-time deposit address, and how to pay it (for its page on another device) |
| GET | /api/v1/dex/tx | Whether a swap sent from the customer's wallet is confirmed |
| POST | /api/v1/dex/submit | The customer's signatures for a gasless swap; 0x sends it |
| POST | /api/v1/wallet-push | Opt in to private incoming-payment notifications |
| DELETE | /api/v1/wallet-push | Remove a device notification registration and its queued notices |
| POST | /api/v1/wallet-push/test | Send a test notification to an opted-in registered device |
| POST | /api/v1/wallet-push/prices | Sync a device's instant price alerts |
| POST | /api/v1/wallet-swap-fee | Verify a company platform-fee receipt |
| POST | /api/v1/dex/done | A wallet swap the browser saw confirmed |
| GET | /api/v1/dex/gas | Whether the gas sent for a swap has reached the customer's wallet |
| GET | /api/v1/dex/gasless | Whether 0x has sent and confirmed a gasless swap |
| GET | /api/v1/dex/bridge | Whether a swap between networks has arrived |
| GET | /api/v1/pair | Rate, limits and fees for a pair, with an estimate when amount is given |
| GET | /api/v1/prices/markets | Every coin the wallets carry, with price, day's change and a week's line |
| GET | /api/v1/prices/history | One coin priced in another over a range (the home page chart) |
| POST | /api/v1/quotes | Lock a price for a fixed-rate swap (switched off now: returns fixed_unavailable) |
| POST | /api/v1/orders | Create an order (variable rate; fixed-rate orders are switched off now) |
Orders
Reading and changing an order. Changes need the order token.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/orders/{id} | An order, its deposits and its history |
| GET | /api/v1/orders/{id}/stream | Live updates for an order (server-sent events) |
| POST | /api/v1/orders/{id}/refund-address | Set or change the refund address |
| POST | /api/v1/orders/{id}/cancel | Cancel an order before any deposit |
| POST | /api/v1/orders/{id}/kyc | Start identity verification for an order |
| GET | /api/v1/orders/{id}/aml | What we asked for during an AML review |
| POST | /api/v1/orders/{id}/aml | Answer an AML request |
| POST | /api/v1/orders/{id}/aml/documents | Send a document for an AML review |
| POST | /api/v1/orders/{id}/travel-rule | Say who owns an exchange payout address |
| GET | /api/v1/kyc/{id} | An identity verification session |
Payment links
"Pay me exactly X of coin Y": links that anyone can pay with any supported coin.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/payment-links/coins | Supported payment-link coins and networks |
| POST | /api/v1/payment-links/{id}/route-quote | Preview an exact-output provider payment |
| POST | /api/v1/payment-links/{id}/route-pay | Start the previewed provider payment |
| POST | /api/v1/payment-links/{id}/route-preview | Price of paying the link with a coin, shown before any address is made |
| POST | /api/v1/payment-links/{id}/wallet-quote | Price paying the link from a wallet (a same-network swap to the link's address) |
| POST | /api/v1/payment-links/{id}/wallet-build | The transactions to sign for a started wallet payment |
| POST | /api/v1/payment-links/{id}/wallet-done | Report the wallet payment's transaction |
| GET | /api/v1/payment-links/{id}/route-payments/{paymentId} | Payment status for the browser that started it |
| POST | /api/v1/payment-links | Create a payment link |
| GET | /api/v1/payment-links/{id} | A payment link (public view) |
| POST | /api/v1/payment-links/{id}/quote | What a payer would send, in the coin they choose |
| POST | /api/v1/payment-links/{id}/orders | Start a payment: create the fixed-rate order that pays the link |
| GET | /api/v1/payment-links/{id}/payments | Every payment of a link (creator only) |
| POST | /api/v1/payment-links/{id}/cancel | Close a link to new payments (creator only) |
Price alerts
One Telegram message when a rate crosses a number.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/alerts | The alerts with these ids |
| POST | /api/v1/alerts | Create a price alert, delivered on Telegram |
| GET | /api/v1/alerts/{id} | One price alert |
| DELETE | /api/v1/alerts/{id} | Cancel a price alert |
Plaxcoin
The PLXC token page (/plaxcoin): live chain figures, quotes for trades the visitor's own wallet sends, wallet history, the airdrop, Telegram alerts and optional accounts. Writes from the page need a wallet signature or x-px-plxc: 1.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/plaxcoin/stats | PLXC price, pool, time locks and supply, read from BNB Chain |
| GET | /api/v1/plaxcoin/trades | Every pool trade and PLXC transfer, daily totals and the price series |
| GET | /api/v1/plaxcoin/scan | Token safety checks (PLXC, or any BNB Chain token by address) |
| GET | /api/v1/plaxcoin/quote | Quote a PLXC buy or sell, or a USDT/BNB swap, with the box limits |
| GET | /api/v1/plaxcoin/wallet | A wallet's BNB, USDT and PLXC, router approvals and BNB needed for fees |
| GET | /api/v1/plaxcoin/history | A wallet's PLXC history from the chain |
| GET | /api/v1/plaxcoin/tx | Whether a transaction is pending, done or failed |
| GET | /api/v1/plaxcoin/airdrop | Airdrop rules, totals and whether this visitor may join |
| GET | /api/v1/plaxcoin/holder | The lower swap fee rule for PLXC holders, and whether a wallet qualifies (?address=) |
| GET | /api/v1/plaxcoin/cashback | Swap cashback rules and paid weeks, or one wallet's cashback (?address=) |
| GET | /api/v1/plaxcoin/airdrop/status | A wallet's airdrop sign-up and friends |
| POST | /api/v1/plaxcoin/airdrop/challenge | The text a wallet signs to join the airdrop |
| POST | /api/v1/plaxcoin/airdrop/join | Join the airdrop with a wallet signature |
| GET | /api/v1/plaxcoin/alerts | Whether a wallet has Telegram alerts |
| POST | /api/v1/plaxcoin/alerts | Turn Telegram alerts on or off with a wallet signature |
| GET | /api/v1/plaxcoin/me | The signed-in Plaxcoin account and the sign-in options |
| POST | /api/v1/plaxcoin/me | Sign out, two-factor sign-in and linked wallets |
| GET | /api/v1/plaxcoin/auth/{provider}/start | Start signing in with Google, Telegram, Apple or Discord |
| GET | /api/v1/plaxcoin/auth/{provider}/callback | The return trip from Apple or Discord |
Accounts
Optional accounts with no sign-up: order history, address book, referrals. The account key lives in an HttpOnly cookie; writes need x-px-account: 1.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/account | This browser's account, if it has one |
| POST | /api/v1/account | Create an account for this browser (or return the one it has) |
| POST | /api/v1/account/restore | Use an account in this browser, with its account key |
| POST | /api/v1/account/key | Show the account key this browser holds, to back it up |
| POST | /api/v1/account/forget | Remove the account key from this browser |
| GET | /api/v1/account/orders | This account's orders, newest first |
| POST | /api/v1/account/orders/{id}/access | An order key for one of this account's orders |
| GET | /api/v1/account/addresses | Saved payout addresses (the address book) |
| POST | /api/v1/account/addresses | Save a payout address |
| PATCH | /api/v1/account/addresses/{id} | Change a saved address |
| DELETE | /api/v1/account/addresses/{id} | Delete a saved address |
| GET | /api/v1/account/referrals | Referral link, referred volume, earnings and withdrawals |
| GET | /api/v1/account/withdrawals | This account's referral withdrawals, newest first |
| POST | /api/v1/account/withdrawals | Withdraw every available referral earning as one stablecoin payout |
Partner portal
Your volume, commission, webhook deliveries and withdrawals. Needs your API key.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/partner | Your volume, commission, recent orders, webhook deliveries and withdrawals |
| POST | /api/v1/partner/signup | Get a partner API key |
| GET | /api/v1/partner/orders | Orders made with your API key, newest first, 25 per page |
| GET | /api/v1/partner/withdrawals | Your commission withdrawals |
| POST | /api/v1/partner/withdrawals | Withdraw all available commission as one stablecoin payout |
Support
Support requests without an account, read on a private page.
| Method | Path | What it does |
|---|---|---|
| POST | /api/v1/support | Open a support request |
| GET | /api/v1/support/{id} | A support request and its messages |
| POST | /api/v1/support/{id}/messages | Write again on a support request |
| POST | /api/v1/assistant | Ask the help chat |
| POST | /api/v1/assistant/event | Count a help chat action or rate an answer |
Payment gateway
Accept crypto on your website: create a payment, send the payer to the hosted checkout, get a signed webhook. Needs your merchant key (pxs_live_... or pxs_test_...). Guide: /developers/payments.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/merchant/swaps | Owner wallet conversion history and auto-conversion policy |
| POST | /api/v1/merchant/swaps | Confirm a quoted wallet conversion batch |
| POST | /api/v1/merchant/swaps/quote | Preview a merchant balance swap or consolidation |
| POST | /api/v1/merchant/swaps/cancel | Cancel an unstarted wallet conversion |
| PATCH | /api/v1/merchant/swaps/preferences | Set or revoke auto-conversion consent |
| GET | /api/v1/payments | List your payments |
| POST | /api/v1/payments | Create a payment |
| GET | /api/v1/payments/{id} | A payment as it stands now |
| POST | /api/v1/payments/{id}/cancel | Cancel a payment nothing was paid to |
| POST | /api/v1/payments/{id}/simulate | Test mode: act out a payment's outcome |
| GET | /api/v1/gateway/coins | Coins you can receive, and what payers can pay each with |
Merchant account
Sign up, your account's settings, keys and webhook deliveries.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/merchant/overview | Filtered settled income, coin prices and orders |
| GET | /api/v1/merchant/security | Authenticator status and recovery-code count |
| POST | /api/v1/merchant/security | Enroll or recover a mandatory merchant authenticator |
| POST | /api/v1/merchant/security/approve | Approve one exact account or withdrawal request with TOTP |
| GET | /api/v1/merchant/wallet | Balances, ledger activity and withdrawals |
| POST | /api/v1/merchant/onboarding | Complete business profile |
| POST | /api/v1/merchant/withdrawals/quote | Preview a withdrawal and its fees |
| POST | /api/v1/merchant/withdrawals | Confirm the exact withdrawal preview |
| POST | /api/v1/merchants/lock | Lock an account from a security email |
| GET | /api/v1/merchant/addresses | Saved withdrawal addresses |
| POST | /api/v1/merchant/addresses | Add a withdrawal address |
| GET | /api/v1/merchant/security/devices | Signed-in devices |
| POST | /api/v1/merchant/security/devices | Sign a device or every other device out |
| GET | /api/v1/merchant/security/passkeys | Saved passkeys |
| POST | /api/v1/merchant/security/passkeys | Passkey options or removal |
| POST | /api/v1/merchant/passkeys | Save a passkey |
| POST | /api/v1/merchant/anti-phishing | Set the anti-phishing code |
| GET | /api/v1/merchant/markets | Prices for the wallet's coins |
| GET | /api/v1/merchant/receive | Coins the wallet can receive |
| POST | /api/v1/merchant/receive | Get or make a deposit address |
| GET | /api/v1/merchant/kyc | Business verification |
| POST | /api/v1/merchant/kyc | Send business verification |
| DELETE | /api/v1/merchant/addresses/{id} | Remove a withdrawal address |
| GET | /api/v1/merchant/payments/{id}/refund | Refund panel of an overpaid payment |
| POST | /api/v1/merchant/payments/{id}/refund | Start a refund of the extra |
| POST | /api/v1/merchant/payments/{id}/refund/quote | Preview sending a refund |
| POST | /api/v1/merchant/payments/{id}/refund/send | Send a refund |
| POST | /api/v1/merchant/payments/{id}/refund/cancel | Cancel a refund not sent yet |
| POST | /api/v1/merchant/payments/{id}/refund/manual | Record a refund sent from your own wallet |
| GET | /api/v1/merchant/notifications | Notification inbox and channel preferences |
| PATCH | /api/v1/merchant/notifications | Mark inbox items read or change opted-in channels |
| POST | /api/v1/merchant/notifications/telegram | A one-time Telegram link that turns Telegram alerts on |
| GET | /api/v1/merchant | Your merchant account |
| PATCH | /api/v1/merchant | Change your account's settings |
| POST | /api/v1/merchant/keys | Create another key |
| PATCH | /api/v1/merchant/keys/{id} | Switch a key on or off |
| POST | /api/v1/merchant/webhook-secret | A new webhook signing secret |
| GET | /api/v1/merchant/webhooks | Recent webhook deliveries |
| POST | /api/v1/merchant/webhooks/test | Send a signed ping webhook |
| POST | /api/v1/merchant/webhooks/{id}/resend | Send a webhook again |
| POST | /api/v1/merchants/signup | Legacy signup endpoint (retired) |
Checkout
What the hosted checkout page calls. No key; the payer's browser.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/checkout/{id} | The hosted checkout's view of a payment |
| POST | /api/v1/checkout/{id}/quote | How much to send with one coin |
| POST | /api/v1/checkout/{id}/pay | Pay with a coin |
| POST | /api/v1/checkout/{id}/simulate | Test mode: the checkout's outcome buttons |
Sandbox
Only where developer tools are on.
| Method | Path | What it does |
|---|---|---|
| POST | /api/v1/kyc/{id}/submit | Submit the mock identity check (sandbox only) |
Request and response fields are in the OpenAPI document. The TypeScript types live in src/lib/api-types.ts in this project.
Fixed-rate flow
Closed to new orders since 2 Nov 2026. POST /api/v1/quotes and POST /api/v1/orders return 410 orders_closed: swaps now go through the decentralized swap API (/api/v1/dex), and payment links pay through a direct route. The steps below describe the closed order API.
Lock the price first, then create the order within the quote's lifetime. The user must send exactly depositAmount, and receives exactly settleAmount: network fees are already taken off. You can quote by the amount sent (depositAmount) or by the amount received (settleAmount), not both.
curl -s "$BASE/api/v1/quotes" \
-H "content-type: application/json" \
-H "x-api-key: $PX_KEY" \
-H "x-user-ip: 203.0.113.7" \
-d '{"from":"btc","to":"usdt-tron","depositAmount":"0.005"}'{
"id": "q_zp4h32n4f18gsz53",
"from": "btc",
"to": "usdt-tron",
"depositAmount": "0.005",
"settleAmount": "407.417394",
"rate": "81831.8587259",
"expiresAt": "2026-10-13T15:58:54.958Z",
"fees": {
"receiveFeeUsd": 0.3, "sendFeeUsd": 1.44, "totalNetworkFeesUsd": 1.74,
"sendFeeInSettle": "1.441572", "networkFeesInSettle": "1.741899",
"spreadBps": 180, "commissionBps": 0,
"spreadParts": { "tierBps": 150, "fixedBps": 30, "volatilityBps": 0, "surchargeBps": 0, "nudgeBps": 0, "minEarningsBps": 0 }
}
}curl -s "$BASE/api/v1/orders" \
-H "content-type: application/json" \
-H "x-api-key: $PX_KEY" \
-H "x-user-ip: 203.0.113.7" \
-d '{
"type": "fixed",
"quoteId": "q_zp4h32n4f18gsz53",
"settleAddress": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"refundAddress": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
"payoutDestination": "self_hosted",
"acceptTerms": true
}'The response holds order (show order.depositAddress, order.depositMemo when set, and order.expectedDeposit) and orderToken. When depositAddress is null, the user must verify their identity first: start it with POST /api/v1/orders/:id/kyc.
Variable-rate flow
Closed to new orders since 2 Nov 2026, like the fixed-rate flow above. No quote. Create the order with from and to. The user can send any amount between order.depositMin and order.depositMax; the rate is set when each deposit confirms. GET /api/v1/pair with an amount gives an estimate to show beforehand.
curl -s "$BASE/api/v1/orders" \
-H "content-type: application/json" \
-H "x-api-key: $PX_KEY" \
-H "x-user-ip: 203.0.113.7" \
-d '{"type":"variable","from":"eth","to":"sol","settleAddress":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","acceptTerms":true}'Payouts to an exchange account: send "payoutDestination": "exchange". If the swap can reach the travel-rule threshold, also send beneficiary: { name, vaspName }, the account holder's full name and the exchange's name. See the compliance policy for the threshold.
Order token
orderToken is returned once, when the order is created. Store it with the order. Send it as x-order-token to set a refund address, cancel, start identity verification or send travel-rule details. Anyone with the order id can read the order, with addresses shortened; the token holder (or the partner whose key created the order) sees them in full and can change the order.
Order statuses
| Status | Meaning |
|---|---|
| waiting | No deposit has arrived yet. |
| pending | Deposit seen. Waiting for network confirmations. |
| processing | Deposit confirmed. Pricing and checks are running. |
| review | Held for a compliance check. |
| settling | Payout broadcast. Waiting for it to confirm. |
| settled | Payout confirmed. |
| refund | Needs a refund address, or is queued for a refund. |
| refunding | Refund broadcast. Waiting for it to confirm. |
| refunded | Refund confirmed. |
| frozen | Blocked by a sanctions match or a legal hold. |
| failed | Cannot be paid out or returned. |
| expired | No deposit arrived before the deadline. |
| cancelled | Cancelled before any deposit. |
| multiple | Deposits with different outcomes. See each one. |
Follow an order with the event stream (GET /api/v1/orders/:id/stream, an order event with the full order on connect and on every change), by polling GET /api/v1/orders/:id every few seconds, or with webhooks. When a deposit leaves the normal path, deposit.reason names why and deposit.reasonText explains it in plain English. Reviews with manualDecision: true have no automatic refund deadline: a person decides.
Payment links
A payment link says pay me exactly 25 USDT on Tron at this address. Whoever pays can use any coin we support: they get a fixed-rate quote for exactly that amount, and their payment is a normal fixed-rate swap whose payout goes to the link's address. The payer pays our spread and the network fees; the recipient gets the stated amount. Links created with your API key belong to you and send payment_link.* webhooks.
curl -s -X POST "$BASE/api/v1/payment-links" \
-H "content-type: application/json" \
-H "x-api-key: $PX_KEY" \
-H "x-user-ip: 203.0.113.7" \
-d '{
"title": "Invoice 1042",
"settleMethodId": "usdt-tron",
"settleAmount": "25",
"settleAddress": "TBFQ4wTTgtsK4SvFuBNVCbhHJPbWdxE9zN",
"expiresIn": "7d",
"payoutDestination": "self_hosted"
}'The response has link, payUrl (share it) and manageToken with manageUrl (shown once: keep them private). One-payment links (the default) take one payment at a time and are paid once it settles; reusable links ("reusable": true) take any number of full payments. Expiry: 1h, 24h, 7d, 30d or never.
curl -s -X POST "$BASE/api/v1/payment-links/pl_pztpm3f8c04ez2/quote" \
-H "content-type: application/json" -d '{"from":"btc"}'
curl -s -X POST "$BASE/api/v1/payment-links/pl_pztpm3f8c04ez2/orders" \
-H "content-type: application/json" \
-d '{"from":"btc","quoteId":"q_h9tga45ztbr27xdk","refundAddress":"bc1q...","acceptTerms":true}'curl -s "$BASE/api/v1/payment-links/pl_pztpm3f8c04ez2/payments" -H "x-link-token: $MANAGE_TOKEN"
curl -s -X POST "$BASE/api/v1/payment-links/pl_pztpm3f8c04ez2/cancel" -H "x-link-token: $MANAGE_TOKEN"GET /api/v1/payment-links/:id is public (no secrets, no payer details). Its availability says whether a payment can start now and, if not, why: paid, expired, cancelled, payment_open (someone else has an open order, with retryAfter), payment_in_progress or unavailable. Every payer goes through the same country rules, limits and screening as any other order.
Webhooks
Set a webhook URL on your partner account. We POST JSON to it for these events. Each body is { "event", "createdAt", "data" }.
Orders
Orders created with your API key.
- order.createdAn order was created with your API key.
- order.expiredThe order closed before a deposit arrived.
- order.cancelledThe order was cancelled before any deposit.
Deposits
Each deposit on those orders, as it moves through the steps.
- deposit.detectedA deposit was seen on the network and is waiting for confirmations.
- deposit.confirmedThe deposit has its confirmations; pricing and checks run next.
- deposit.reviewThe deposit is held for a check (reason and deadline in the order).
- deposit.settlingThe payout was sent and is waiting for the network.
- deposit.settledThe payout is confirmed. The swap is complete.
- deposit.refundThe deposit will be returned (it may need a refund address).
- deposit.refundingThe refund was sent and is waiting for the network.
- deposit.refundedThe refund is confirmed.
- deposit.frozenThe deposit is frozen under a sanctions match or a legal hold.
- deposit.failedThe deposit could not be paid out or returned (for example, too small to send back).
Payment links
Links created with your API key.
- payment_link.paidA one-payment link created with your API key was paid. Sent once.
- payment_link.expiredAn open link created with your API key passed its expiry. Sent once.
Commission withdrawals
Payouts of the commission you earned.
- withdrawal.sentA commission withdrawal to your payout address was broadcast.
- withdrawal.completedA commission withdrawal is confirmed on the network.
{
"event": "deposit.settled",
"createdAt": "2026-10-13T15:40:02.114Z",
"data": { "orderId": "82mvk6s12m9sz0", "depositId": "d_ac88wy833k5h8tb4", "message": "Sent 0.0033 ETH to your address." }
}{
"event": "payment_link.paid",
"createdAt": "2026-10-13T20:02:30.101Z",
"data": {
"linkId": "pl_pztpm3f8c04ez2", "status": "paid", "title": "Invoice 1042",
"settleMethodId": "usdt-tron", "settleAmount": "25", "amountReceived": "25.000112",
"orderId": "d29k7x4wbq5psa", "depositId": "d_f9wvve7nksmtjwc0",
"settleTxid": "634b39ce...", "paidAt": "2026-10-13T20:02:25.573Z"
}
}Every request carries x-px-signature: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of t + "." + body using your webhook secret. Check it against the raw body before you parse it, and reject old timestamps. Answer with any 2xx status within 8 seconds; failed deliveries are retried with growing gaps, up to 10 attempts over several hours, so the same event can arrive twice. Use the ids to ignore repeats.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyPlaxswapSignature(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(",").map((part) => part.split("=")));
const t = Number(parts.t);
if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
const given = Buffer.from(parts.v1 ?? "", "hex");
return given.length === expected.length && timingSafeEqual(given, expected);
}Embeddable widget
Put a small swap box on your own site. It shows two coins, an amount and the live order rate. There is no address field in it: Continue opens the swap form in a new tab with the pair and amount filled in, where your visitor adds their address and sees each route's own rate and fee (a 0.3% Plaxswap fee plus the route's fee), which can differ from the widget's. Pass your referral code with ref; swaps on the swap form do not earn referral commission yet.
URL: /widget?from=btc&to=eth&amount=0.01&theme=auto&ref=CODE. from and to take method ids or coins, theme is light, dark or auto (follows your visitor's system setting). A frame of about 400 by 460 pixels fits it.
Leave empty for an example amount.
Passed on to the swap page. Swaps on the swap form do not earn referral commission yet.
At least 420. The width fits the space it is given, up to 400.
<iframe
src="https://plaxswap.com/widget?from=btc&to=eth&amount=0.01"
title="Crypto swap"
width="400" height="460"
style="border:0;border-radius:20px;max-width:100%"
loading="lazy"
sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"
></iframe>
<p style="margin:6px 0 0;font:12px/1.4 system-ui,sans-serif"><a href="https://plaxswap.com/">Powered by Plaxswap</a></p>The frame only shows coins, an amount and the live order rate. There is no address field in it, and nothing is created there: Continue opens the swap form in a new tab, where your visitor adds their address and sees each route's own rate and fee. The sandbox attribute keeps the frame away from your page.
Live preview
Errors
Errors use HTTP status codes and a JSON body: { "error": { "code", "message", "details" } }. The message is plain English and safe to show to your user. Codes you will see most:
| Code | HTTP | Meaning |
|---|---|---|
| bad_request | 400 | A field is missing or malformed. The message says which. |
| invalid_address | 400 | The payout or refund address failed its format or checksum check. |
| invalid_memo | 400 | The memo, tag or comment is not valid for that network. |
| travel_rule_required | 400 | An exchange payout over the threshold needs the account holder's name. |
| user_ip_required | 400 | A request with an API key did not send x-user-ip. |
| user_ip_invalid | 400 | x-user-ip is not a public IP address. |
| invalid_api_key | 401 | The API key is wrong or switched off. |
| forbidden | 403 | The order token (x-order-token) or link token (x-link-token) is missing or wrong. |
| address_not_allowed | 403 | The address failed sanctions or risk screening. |
| private_pilot | 403 | Real-money swaps are a private test and not open to the public yet. |
| not_found | 404 | No order, quote, link or alert with that id. |
| fixed_unavailable | 409 | Fixed rates are switched off at the moment. Create a variable-rate order instead. |
| quote_expired | 409 | The quote ran out. Request a new one. |
| coin_unavailable | 409 | Deposits or payouts for that coin are paused. |
| limit_exceeded | 409 | The caller's remaining limit without verification is below the pair minimum. |
| refund_address_locked | 409 | A deposit is being checked, so the refund address cannot change now. |
| rate_limited | 429 | Too many requests from this IP address in the time window. |
| velocity_limit | 429 | Too many orders from one device in the last hour. |
| too_many_streams | 429 | Too many open live streams from one IP address. Poll instead. |
| jurisdiction_blocked | 451 | Swaps are not offered in the end user's country. |
| service_paused | 503 | New swaps are paused for now. Open orders still complete. |
The full list for each endpoint is in the OpenAPI document.