Skip to main content
POST
/
v1
/
wallet
/
reward
/
withdraw
{
  "txHash": "0xb92de09d893e8162b0861c0f7321f68df02212efbc58f208839ae3f176d89638"
}

Overview

Withdraw accumulated rewards to a registered external wallet. The withdrawal is processed on-chain on the Linea network. The net amount received equals the requested amount minus network gas fees. Prerequisites:
  • User must have registered external wallet (completed delegation)
  • Reward wallet must have sufficient balance
  • Rewards must be vested and withdrawable

Authentication

x-client-key
string
required
Your public API client key
Authorization
string
required
Bearer token for authentication

Query Parameters

x-us-env
boolean
default:false
Route to US backend environment

Request Body

amount
string
required
Amount to withdraw in USDC (decimal string)

Response

txHash
string
Blockchain transaction hash for tracking on Linea network
{
  "txHash": "0xb92de09d893e8162b0861c0f7321f68df02212efbc58f208839ae3f176d89638"
}

Code Examples

curl -X POST "https://dev.api.baanx.com/v1/wallet/reward/withdraw" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": "25.00"}'

Complete Withdrawal Flow

1

Check Reward Balance

const wallet = await fetch('/v1/wallet/reward').then(r => r.json());
const balance = parseFloat(wallet.balance);
2

Estimate Fees

const fees = await fetch('/v1/wallet/reward/withdraw-estimation')
  .then(r => r.json());
const feeUSDC = parseFloat(fees.usdc);
3

Calculate Net Amount

const netAmount = balance - feeUSDC;
console.log(`You will receive: ${netAmount.toFixed(2)} USDC`);
4

Initiate Withdrawal

const { txHash } = await fetch('/v1/wallet/reward/withdraw', {
  method: 'POST',
  body: JSON.stringify({ amount: balance.toString() })
}).then(r => r.json());
5

Monitor Transaction

const explorerUrl = `https://lineascan.build/tx/${txHash}`;
console.log(`Track withdrawal: ${explorerUrl}`);

Important Notes

Balance Requirements: Withdrawal amount plus fees must not exceed available reward balance.
Vesting Periods: Some rewards may have vesting periods before withdrawal is allowed. Check isWithdrawable flag on the reward wallet.
Transaction Monitoring: Use the returned txHash to track status. Linea confirmations typically take 1-3 minutes.