Endpoint-level schemas, request bodies, and response examples are available in the generated API Reference. This page explains the conventions that apply across the API.
Base URL
Production API requests use:environment option:
Authentication
CoinVoyage uses two credential types:
Keep the API secret in a server-side environment variable or secrets manager. Never expose it through frontend bundles, mobile apps, public repositories, logs, analytics events, or client-side error reporting.
Public API key flows
DEPOSIT PayOrders can be created with the public API key because the destination address is supplied by the integration and no merchant settlement configuration is modified.
Signed server-side flows
SALE, REFUND, PayOrder listing, KYC links, bank account management, withdrawals, webhook management, and fee operations require your API secret. The SDK generates the authorization signature internally when you pass the raw secret to the relevant method.
Where payout APIs fit
KYC, bank accounts, and withdrawals are part of the optional fiat off-ramp flow. They do not replace PayOrders, and they are not required when you only want on-chain settlement to a wallet.Withdrawals to bank accounts are optional. You can bring your own externally owned account (EOA), receive funds there, and move funds anywhere you want from that wallet. Use withdrawals only when your product needs a CoinVoyage-managed fiat payout to a linked bank account.
Where swap APIs fit
Swap APIs are for standalone on-chain asset exchanges. They are separate from PayOrders: a PayOrder may use swaps internally while routing a payment, butswapQuote() and swapData() are useful when your product wants to quote and execute a swap as its own user action.
See Integration flows for the standalone swap sequence.
Request conventions
- Send JSON request bodies with
Content-Type: application/json. - Use ISO 8601 timestamps in UTC for stored times and event payloads.
- Treat IDs as opaque strings. Do not parse structure out of
payorder_id, webhook IDs, quote IDs, or transaction hashes. - Store token amounts exactly as returned by the API when reconciling payments. Prefer raw string amounts for accounting systems that require exact precision.
- Attach your own order, user, or invoice identifiers in
metadataso webhook handlers can reconcile events without a separate lookup.
Response shape
The SDK wraps every result inAPIResponse<T>:
error before using data:
Error handling
Handle API errors by status code category:Rate limits
When a request exceeds a limit, CoinVoyage returns429 Too Many Requests. Back off instead of retrying immediately, and use the Retry-After response header when it is present.
See Rate limits for retry guidance and response headers.
Pagination and listing
List endpoints return paginated data when the result set can grow over time. Use pagination for reconciliation jobs, dashboards, exports, and backfills instead of assuming a single response contains every record. When consuming paginated endpoints:- Keep the original filter set stable while walking pages.
- Store the last successful cursor, page, or timestamp checkpoint for long-running jobs.
- Expect new records to appear while you paginate.
- Reconcile by PayOrder ID rather than by page position.
Idempotency and retries
Network requests can time out after CoinVoyage receives them. Design your integration so retrying does not create duplicate business effects:- Store your internal order ID in PayOrder
metadata. - Before creating a replacement PayOrder, check whether your order already has an active PayOrder.
- Treat webhook event IDs as delivery IDs and PayOrder IDs as payment lifecycle IDs.
- Make fulfillment idempotent by recording the PayOrder ID and terminal status before shipping goods, crediting balances, or updating inventory.
Webhook-first processing
Production integrations should use webhooks for payment state changes:- Create a PayOrder from your server.
- Store the PayOrder ID against your internal order or account.
- Show the payment modal to the user.
- Verify webhook signatures before parsing the event.
- Update internal state from terminal events such as
payorder_completed,payorder_refunded,payorder_expired, orpayorder_error. - Run a scheduled reconciliation job that compares your internal state with the CoinVoyage API.
Go-live requirements
Before using production credentials, confirm that:- Your API secret is stored server-side only.
- Webhook signature verification is enabled.
- Fulfillment is idempotent.
- Failed, expired, refunded, and partial-payment states are handled.
- Your settlement currency and wallet address are configured in the dashboard.
- You have tested a full payment, refund, and webhook flow in the development environment.