Prerequisites
Before starting this guide, ensure you have:- Obtained an API key from the OpenXSwitch Console.
- Configured an Application Account: An active
accountIdgenerated via the API or dashboard. See Get Started with Account Management for details.
The Plan
We’ll go through:- Creating a Wallet via API: Provisioning a chain-specific wallet address scoped to an account.
- Updating Wallet Settings: Managing wallet activity state (
isActive), display labels, and auto-sweep configurations. - Fetching Wallet Balances: Querying asset holdings by wallet ID or blockchain address.
- Next Steps: Configuring treasury sweeps.
Step 1: Create a Wallet via API
To provision a new wallet, send aPOST request to the /v2/wallets endpoint.
Key Request Parameters
idempotencyKey(string, required): A unique string to prevent duplicate wallet creation requests.accountId(string, required): The parent Application Account container.blockchain(string, required): Target network identifier (e.g.,ethereum-mainnet,polygon-mainnet).name(string, optional): A human-readable display label for internal tracking.userId(string, optional): Pass auserIdduring creation to link this wallet directly to an end-user identity.refId(string, optional): Client reference identifier. Re-using the samerefIdacross different EVM chains ensures deterministically identical wallet addresses.autoSweep(boolean, optional): Set totrueto automatically route incoming deposits directly into your primary Settlement Account treasury. Defaults tofalse.
Sample Response
Step 2: Update Wallet Settings
You can modify wallet metadata, toggle auto-sweeping, or adjust the wallet’s active status using thePATCH endpoint.
💡 User Association If a wallet was created without auserId, you can link the wallet to a user identity during an update request by supplying theuserIdfield.
Field Breakdown
name(string, optional): Updated display name for internal tracking.userId(string, optional): Links or updates the owner user entity for this wallet.autoSweep(boolean, optional): Enables or disables automatic treasury sweeping rules for incoming funds.isActive(boolean, optional): Set tofalseto freeze wallet actions.
⚠️ Important Security Rule IfisActiveis set tofalse, the wallet is disabled. Disabled wallets cannot withdraw or swap funds.
Step 3: Fetch Wallet Balances
To inspect real-time token or native cryptocurrency balances, query the balances endpoint. You must provide either thewalletId or the on-chain address as a parameter.
Query Parameters
walletId(string, conditional): The unique ID of the wallet (Required ifaddressis omitted).address(string, conditional): The on-chain wallet address (Required ifwalletIdis omitted).blockchain(string, optional): Filter results to a specific network.token(string, optional): Filter by a specific asset symbol or contract address (e.g.,USDT).
Sample Response
Next Steps
- Auto Collection and Sweep Rule: Configure automated collection rules to aggregate user deposits into your central Settlement Account.
.png?fit=max&auto=format&n=ML35RDblT1Ol-zJb&q=85&s=062e79ad9c4540929eec204aff020178)
.png?fit=max&auto=format&n=ML35RDblT1Ol-zJb&q=85&s=f6328956931c9664a2a070c2edb6e9b3)