logo

Deserialize

Introduction

The Deserialize API provides comprehensive endpoints for token swaps, market data, and account information on the 0G blockchain. Whether you're building a DEX, wallet, or trading interface, our API offers everything you need.

Fast, reliable, and developer-friendly

Getting Started

Base URL

https://evm-api.deserialize.xyz/:networkId

Follow these steps to integrate with our API:

1. Get Token Information

Use the token list endpoints to discover available tokens and their details.

2. Request a Quote

Get optimal swap routes and expected output amounts before executing trades.

3. Execute Swaps

Use the quote to execute transactions with your preferred slippage tolerance.

Quick Example

Here's a complete example showing how to swap native token for W0G:

1. Get Token Details

GET/tokenListWithDetails
json
{
  "result": [
    {
      "address": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
      "decimals": 18,
      "symbol": "W0G",
      "name": "Wrapped 0G"
    }
  ]
}

2. Get Swap Quote

POST/quote
json
{
  "tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
  "tokenB": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
  "dexId": "ALL",
  "amountIn": "1000000000000000000"
}

3. Execute Swap

POST/swap
json
{
  "publicKey": "0xe0918C56A2C7a216644B6d890c80d164417A70E3",
  "quote": { /* quote from step 2 */ },
  "slippage": 1
}

Available Endpoints

EndpointMethodDescription
/quotePOSTGet swap quote with optimal routing
/swapPOSTExecute swap transaction
/tokenListGETGet list of available token addresses
/tokenListWithDetailsGETGet tokens with full metadata
/tokenDetails/:addressGETGet detailed token information
/tokenPrice/:addressGETGet current token price in USD

Key Concepts

Token Addresses

Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE to represent the native token (0G) in swap operations.

Amount Format

All amounts are specified in wei (the smallest unit). For example, 1 0G = 1000000000000000000 wei.

Slippage Tolerance

Specify slippage as a percentage (e.g., 1 = 1%). This protects against price movements during transaction confirmation.

DEX Support

Use "ALL" for dexId to automatically find the best route across all supported DEXs.

Need help? Contact support or visit our developer community.