Skip to main content

PAXG Swap Integration

This guide walks through integrating the PAXG swap REST API into your application.
Currently only available via REST API.

Prerequisites

  • A Paxos Labs API key
  • An Ethereum mainnet RPC endpoint
  • A wallet library (viem, ethers, wagmi, etc.)

Supported Token Pairs

PAXG must be either the offerAsset (sell) or wantAsset (buy) in every swap request. Supported stablecoins for the other side of the trade:
TokenAddress
USDC0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
USDT0xdAC17F958D2ee523a2206206994597C13D831ec7
PYUSD0x6c3ea9036406852006290770BEdFcAbA0e23A0e8
USDG0xe343167631d89B6Ffc58B88d6b7fB0228795491D

Getting a Swap Quote

Request a quote by calling the /v1/paxg/swapQuotes endpoint:

Response Structure

The quote response includes:

Handling Token Approvals

Before executing the swap, ensure the user has approved sufficient tokens:

Executing the Swap

Once approved, execute the swap using the provided calldata:

Using Permit2 Authorization

For gasless approvals, use the permit2 auth method:

Error Handling

The API returns standard HTTP error codes:
StatusDescription
400Invalid parameters or insufficient liquidity
503DEX aggregator temporarily unavailable
Example error response:
Always validate the minBuyAmount before executing to protect against slippage. Consider showing users the expected output and allowing them to set slippage tolerance.