API Documentation
Integration docs for the Tovanix open API, organized by service: Multi-chain Pay, Energy Rental, SMTP API, AI API, Virtual Card, Email, Object Storage, Verification & Risk, MCP Access. Labs: Contract Studio, Payment Replay, AI Routing Lab.
- Multi-chain Pay
- Energy Rental
- SMTP API
- AI API
- Virtual Card
- Object Storage
- Verification & Risk
- MCP Access
USDT / USDC / ETH / TRX / BTC · TRON / EVM / Bitcoin · Dual signing with HMAC-SHA256 (payment) + RSA-2048 (payout) · 30-second settlement push
3-Step Integration
- 1 Register an account + create an app Get your app_id and app_key under "My Apps" in the console, then configure notify_url Sign Up Free →
- 2 Implement the signing helper Payment uses HMAC-SHA256 (symmetric), payout uses RSA-2048 (asymmetric). The official SDK wraps both, with full cross-language examples
- 3 Pick a mode and run your first transaction One-to-One (address bound to a user, ideal for wallets/account top-ups) · Rotation (address generated per order, ideal for e-commerce checkout)
Overview
Tovanix supports two payment modes that can be enabled simultaneously:
One-to-One Mode
Users bind a fixed address; all income is proactively pushed. Ideal for top-ups and collections.
- User binds a fixed receiving address
- Real-time income push notifications
- Supports repeated payments
- Independent signature verification
Rotation Mode
A receiving address is dynamically assigned when an order is created and recycled on timeout. Ideal for one-time payments.
- Dynamic address allocation
- Order expiration control
- Automatic exchange rate conversion
- Checkout page
Signature Algorithm
One-to-one mode push notifications use webhook_secret for signing, not app_key.
1. Use HMAC-SHA256 algorithm with the secret as the HMAC key parameter (not appended to the string)
2. Signature output is a lowercase 64-char hex string; comparison is case-sensitive
3. When creating an order, amount must be formatted to two decimal places (e.g. 100.00), timeout as an integer string; even when timeout is omitted it must be signed as timeout=0 (the server always includes timeout in the sign string)
4. Empty-value fields are excluded from signature computation
Replay Protection
To prevent intercepted requests from being replayed, signed requests can carry a timestamp and a nonce; both are included in the signature. Closing an order, binding an address and unbinding an address require them and return 400 when they are missing; they are optional for the other endpoints.
/api/v1/pay/close: timestamp and nonce are required. /api/v1/pay/bind-address and /api/v1/pay/unbind-address: sign_ts and nonce are required (the timestamp field also accepts the name timestamp). /api/v1/pay/get-address uses sign_ts as well, but it is optional there. Create order, query order and app config use timestamp, and it is optional: when both the timestamp and the nonce are present the server checks the time window and the nonce; with only one or neither, only the signature is verified.
timestamp must be within 300 seconds of server time; keep your servers in sync with NTP. A nonce cannot be reused within 5 minutes. A request with an out-of-window timestamp or a reused nonce is rejected: create order and query order return HTTP 400, the other endpoints return 401; the message field of the response gives the reason.
Bind Address
POST /api/v1/pay/bind-address
Assign a fixed payment address to a user. Returns the existing address if already bound.
Query Binding
POST /api/v1/pay/get-address
Query the payment address bound to a user.
Unbind Address
POST /api/v1/pay/unbind-address
Unbind a user's payment address.
Create Order
POST /api/v1/pay/create
Create a payment order; the system auto-assigns a receiving address.
Response Fields
amount accepts both number and string: 100 or "100". For signing, always format as two decimal places like "100.00".
Query Order
GET /api/v1/pay/query
Query order status by merchant order ID. Parameters via URL Query.
Close Order
POST /api/v1/pay/close
Manually close an unpaid order; the address is recycled. Only pending orders (status=0) can be closed.
Query App Config
GET /api/v1/pay/app-config
Query app mode settings, enabled tokens, push configs, etc. No sensitive data exposed.
One-to-One Push Notification
When a bound address receives a transfer, the system sends a POST request to the configured notify_url.
Push notifications are signed with webhook_secret, viewable or regenerated on the app detail page.
Push Fields
Return HTTP 200 or {"code": 0} upon receipt; otherwise the system auto-retries (up to 10 times, exponential backoff).
Order Callback Notification
After a rotation-mode order is paid, the system sends a callback to notify_url.
Callback notifications are signed with webhook_secret, viewable or resettable on the app detail page.
Callback Fields
Any 2xx status counts as delivered; the response body is not checked (returning {"code": 0} with a non-2xx status is still a failure). Non-2xx, no response within 10 seconds, connection errors and redirects all count as failures; the platform retries after 30 seconds, 1, 2 and 5 minutes, then every 10 minutes, up to 10 times. Retries keep the same notify_id but carry a fresh sign_ts, nonce and signature — deduplicate on notify_id.
Get Exchange Rate
GET /api/v1/rate
Get the real-time exchange rate between two currencies
Convert Amount
POST /api/v1/convert
Convert an amount using real-time exchange rates
Batch Rates
GET /api/v1/rates
Query exchange rates for multiple currencies (comma-separated codes)
All Exchange Rates
GET /api/v1/rates/all
Get the exchange rate list for all supported currencies
Fiat Exchange Rates
GET /api/v1/rates/fiat
Get all fiat exchange rates based on a given fiat currency (30+ fiats, grouped by region)
Order Status
Orders go through the following statuses:
Error Codes
Unified error codes for the payment API (/api/v1/pay/*); payout API error codes are in the Reference section.
Payout Overview / Prerequisites
The Payout API is the funds-disbursement side of the Multi-chain Payment product — it programmatically sends assets already swept into the central wallet out to external addresses. RSA-2048 mutual signing + IP allowlist + delayed broadcast + multi-channel notification interception + on-chain confirmation callback.
The Payout API only spends assets swept into the central wallet under system-custody mode. If your payment app uses self-custody mode — funds land directly in your own addresses and the platform never sweeps them — no "swept, pending payout" balance is ever produced, so payouts cannot be made through this API.
Enable in 4 Steps
- Go to the console "Multi-chain Payment → API Payout" settings page
- Generate an RSA-2048 key pair locally on your side and upload the public key to us
- Configure at least one IP allowlist entry (mandatory); optionally set an address allowlist / per-transaction limit / payout delay
- Turn on the master switch; the system auto-generates a platform key pair for the account — copy the platform public key to your side for callback verification
Signature · RSA-2048 (Payout)
All /api/v1/withdraw* endpoints must carry the following request headers. Unlike the symmetric HMAC of the payment API, payouts use asymmetric RSA — the platform only holds your public key, so the only risk is if your private key leaks.
- X-API-Key — API Key of a platform API key (get it from the console under Tools & Settings → API management); the key must have the withdraw capability
- X-Timestamp — Current unix ms; clock skew from the server must be ≤ 60 seconds
- X-Nonce — One-time nonce (uuid); cannot be reused within 5 minutes
- X-Withdraw-Signature — RSA-PKCS1v15-SHA256(caller_private_key, signString), Base64
Sign String Concatenation Rule
Here BODY is the raw HTTP body (the JSON string verbatim — do not re-serialize). For GET requests, BODY is an empty string.
In addition to the account-level RSA signature and account-level IP allowlist above, the API key used must have the withdraw capability and is subject to its own source IP whitelist: a missing capability returns 403 / 4032, and a source IP outside the key's whitelist returns 403 / 4033. Both checks apply to /api/v1/withdraw, /api/v1/balance/withdrawable and /api/v1/fee/quote. Keys that existed before this change automatically have the withdraw capability and are not affected; for new keys, select it under Tools & Settings → API management. You can check which capabilities the key has with GET /api/v1/whoami (called with X-API-Key + X-Secret-Key or an HMAC signature).
Payout Result Callback
You may pass callback_url in the body when placing an order; once the payout completes / fails / is cancelled, the platform POSTs the result to that URL.
- The callback body is signed with the platform private key and placed in the X-Platform-Signature header
- Your side must verify the signature with the platform public key (copyable on the settings page); the verification algorithm is the same as the request direction
- On failure it retries with backoff at 1m / 5m / 30m / 2h / 6h / 24h — 6 times total — then gives up and escalates to manual handling
- Your side must return HTTP 2xx; any non-2xx response is treated as a failure
Headers
- X-Timestamp — Current unix timestamp in milliseconds
- X-Platform-Signature — Base64(RSA-PKCS1v15-SHA256(platform private key, signing string))
Sign String Concatenation Rule
PATH is the path of callback_url (no host, no query string) and BODY is the raw request body — do not re-serialize it. Verify with the platform public key from the settings page.
status is one of completed / failed / failed_onchain / cancelled; amounts and fees are strings; created_at and completed_at are unix seconds, and 0 when there is no completion time. The body does not change between retries of the same order — deduplicate on order_id.
Initiate Payout
POST /api/v1/withdraw
After the order is placed its status is pending, waiting for the delay to expire before a worker broadcasts it automatically. During this window you can pause / expedite / cancel it in the console.
Field Descriptions
- chain — string — Yes — tron / eth / bsc / polygon / arbitrum / base / optimism / avax / xlayer / btc
- symbol — string — Yes — USDT / TRX / ETH, etc.
- amount — string — Yes — Up to 18 decimal places; use a string to avoid floating-point errors
- to_address — string — Yes — Destination address (must be added in the console first when the address allowlist is enabled)
- memo — string — No — Description text (≤500 chars); pushed to the account user along with the notification
- callback_url — string — No — Result callback URL; no callback is sent if empty
- request_id — string — Strongly recommended — Idempotency key; resending the same value for the same account returns the original order; if the chain, symbol, address or amount differs, 409 is returned and no order is created Without it there is no idempotency protection: retrying after a timeout or a 5xx response creates a second real payout.
Response Fields
- order_id — string — Withdrawal order ID; used by the "Query Single Withdrawal" endpoint
- status — string — Current order status, with the same values as status_label in the query endpoint. A new order is pending (balance deducted, awaiting the risk-control delay and broadcast); resubmitting the same request_id returns the order's actual status, which may already be completed, failed, etc.
- amount — string — Withdrawal amount (string)
- fee — string — Expected fee (snapshotted at order time)
- fee_mode — string — in_amount = deducted from amount (received = amount − fee, balance charged amount); out_amount = charged separately (received = amount, balance charged amount + fee)
- delayed_until — string | null — Planned broadcast time (risk-control delay); null = no delay
Query Single Payout Status
GET /api/v1/withdraw/:id
Returns the order details; can be used to poll the status (using the callback is still recommended).
Response Fields
- id — string — Withdrawal order ID
- request_id — string — Idempotency key you passed in
- chain / symbol — string — Chain / token symbol
- amount / expected_fee / fee_mode — string — Withdrawal amount / expected fee snapshotted at order time / fee mode (in_amount, out_amount)
- to_address — string — Destination address
- memo — string — Memo (TAG/Memo)
- status / status_label — int / string — Status code and text label; see "Order Status" below
- tx_hash — string — On-chain transaction hash (set after broadcast)
- fail_reason — string — Failure reason (set on failure)
- delayed_until / broadcast_at / confirmed_at / paused_at / cancelled_at — string | null — Stage timestamps: planned broadcast / broadcast / on-chain confirmation / paused / cancelled; null when not reached
- callback_url / callback_retry — string / int — Result callback URL / retry count so far
- callback_state — string — Callback state: pending = not yet called or retrying, success = 2xx received, giveup = retries exhausted, no_url = no callback configured
- created_at — string — Creation time
Query Available Balance
GET /api/v1/balance/withdrawable
Returns the "swept, pending payout" balance for this account per chain × per asset. Only this portion can be used for API payouts.
Two-level structure: chain → token symbol → withdrawable balance (string); only entries with balance greater than 0 are returned.
Fee Estimate
Returns the pre-deducted fee configured by the admin for this chain × symbol (an OKX-style fixed value).
Response Fields
- chain / symbol / amount — string — Echoed request params: chain / symbol / amount
- fee_amount — string — Fee amount
- fee_asset — string — Fee settlement asset
Full cURL Example
The complete signing + request flow; copy it straight into your terminal to test.
Order Status · Payout
State machine: pending → broadcasted → completed / failed_onchain; in between it may be paused / cancelled / failed.
- 0 — pending — Balance deducted; awaiting delay expiry / not yet broadcast
- 1 — completed — On-chain transaction confirmed successfully (callback eligible)
- 2 — failed — Failed before broadcast (balance refunded)
- 3 — broadcasted — Broadcast; awaiting on-chain confirmation
- 4 — failed_onchain — Failed on-chain (revert / not mined for a long time; balance refunded)
- 5 — paused — Manually paused by the user; can be resumed or cancelled
- 6 — cancelled — Manually cancelled by the user; balance refunded
- 7 — broadcasting — Broadcasting (brief transient state that prevents double broadcast)
Error Codes · Payout API
- 400 — Invalid parameters / insufficient balance / amount outside the chain × symbol limits / address validation failed
- 401 — Invalid API Key / timestamp skew too large / nonce already used / signature verification failed
- 403 — API payout not enabled for the account / IP not in the account allowlist; or the API key lacks the withdraw capability (code 4032) or the source IP is not in that key's whitelist (code 4033)
- 404 — Order not found
- 429 — Too many requests (up to 10 per second per account). The response carries Retry-After: 1; wait one second and retry with the same request_id
- 5xx — Platform error; retryable (use the same request_id to guarantee idempotency)
Payout Security Notes
- Keep your private key safe locally; a leak would let others issue payouts on your behalf
- You must configure an IP allowlist before enabling API payouts (mandatory); a non-allowlisted IP is rejected even with a valid signature
- We recommend also enabling the "payout address allowlist" and registering known destination addresses in advance
- Once the account user enables 2FA, they can use 2FA in the console to expedite / cancel orders within the delay window
- For large orders, consider a longer delay (several hours) to give notifications time for manual interception
Related pages: Multi-chain crypto payments · SMTP Aggregation API · AI Services
Loading…