Skip to main content
Transferring or withdrawing tokens allows you to programmatically move digital assets from a specified wallet address to an external recipient address or internal infrastructure.

Prerequisites

Before starting this guide, ensure you have:
  • Obtained an API key from the OpenXSwitch Console.
  • An active API key with the necessary write and withdraw permissions.
  • Obtained an accountId (if not using the default dashboard account). See the Get Started with Account Management for details.
  • A provisioned source wallet with sufficient asset balance.

The Plan

We’ll go through:
  1. Fetching Supported Blockchains and Tokens: Identifying valid target networks and asset symbols.
  2. Obtaining Source Wallet ID: Retrieving the originating walletId containing the assets.
  3. Initiating a Token Withdrawal: Submitting the transfer request via the API.
  4. Fetching Transaction Status: Tracking transaction state using the returned transaction ID.

Step 1: Fetch Supported Blockchains & Tokens

Before initiating a transfer, query the tokens endpoint to fetch supported cryptocurrencies and their associated blockchain network identifiers (slug or name). Send a GET request to retrieve available tokens along with their supported target networks:

Sample Response

💡 Selecting Network and Asset Parameters
  • Use the symbol (e.g., "ETH" or "USDT") for the token parameter when initiating a withdrawal request.
  • For the blockchain parameter, you can pass either the network name (e.g., "Ethereum") or the network slug (e.g., "ethereum-sepolia"). Using the name is recommended for standard network routing unless targeting a specific testnet environment.

Step 2: Obtain Source Wallet ID

You must provide a valid walletId from which the assets will be debited. If you do not already have the wallet ID, you can retrieve it using either of the following endpoints depending on your application flow:

Option A: Query Wallets by User ID

If the source wallet is linked to a specific user entity, fetch all wallets associated with that userId:

Option B: List Account Wallets

If you are operating across account-level wallets or treasury reserves, fetch all wallets provisioned under your workspace/account:

Sample Response (Common)

Tip: Select and copy the walletId matching the target blockchain network and asset balance to pass into the withdrawal payload in Step 3.

Step 3: Initiate a Token Withdrawal

To execute a token transfer or external withdrawal, send a POST request to the /v2/transactions/withdraw endpoint.

Request Payload Fields

  • idempotencyKey (string, required): Unique client string to prevent duplicate execution during retries.
  • walletId (string, required): The source wallet initiating the transfer.
  • amount (string, required): The nominal token or native currency quantity to send.
  • withdrawalAddress (string, required): The destination blockchain address.
  • token (string, required): Asset symbol (e.g., USDT, ETH).
  • blockchain (string, required): Target network identifier.
  • refId (string, optional): Client transaction reference ID for internal mapping.
  • note (string, optional): Human-readable internal label or memo.

Step 4: Fetch Transaction Details

To monitor execution status, query the transaction endpoint using the transactionId returned in Step 3. Bash

Sample Response