Withdraw from Reward Wallet
curl --request POST \
--url https://api.example.com/v1/wallet/reward/withdraw \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-client-key: <x-client-key>' \
--data '
{
"amount": "<string>"
}
'import requests
url = "https://api.example.com/v1/wallet/reward/withdraw"
payload = { "amount": "<string>" }
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-client-key': '<x-client-key>',
Authorization: '<authorization>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: '<string>'})
};
fetch('https://api.example.com/v1/wallet/reward/withdraw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/wallet/reward/withdraw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-client-key: <x-client-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/wallet/reward/withdraw"
payload := strings.NewReader("{\n \"amount\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/wallet/reward/withdraw")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/wallet/reward/withdraw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"txHash": "0xb92de09d893e8162b0861c0f7321f68df02212efbc58f208839ae3f176d89638"
}
{
"message": "Insufficient reward balance"
}
{
"message": "amount must be a positive number"
}
Wallet
Withdraw from Reward Wallet
Initiate a withdrawal from reward wallet to external wallet address
POST
/
v1
/
wallet
/
reward
/
withdraw
Withdraw from Reward Wallet
curl --request POST \
--url https://api.example.com/v1/wallet/reward/withdraw \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-client-key: <x-client-key>' \
--data '
{
"amount": "<string>"
}
'import requests
url = "https://api.example.com/v1/wallet/reward/withdraw"
payload = { "amount": "<string>" }
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-client-key': '<x-client-key>',
Authorization: '<authorization>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: '<string>'})
};
fetch('https://api.example.com/v1/wallet/reward/withdraw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/wallet/reward/withdraw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-client-key: <x-client-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/wallet/reward/withdraw"
payload := strings.NewReader("{\n \"amount\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/wallet/reward/withdraw")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/wallet/reward/withdraw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"txHash": "0xb92de09d893e8162b0861c0f7321f68df02212efbc58f208839ae3f176d89638"
}
{
"message": "Insufficient reward balance"
}
{
"message": "amount must be a positive number"
}
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
string
required
Your public API client key
string
required
Bearer token for authentication
Query Parameters
boolean
default:false
Route to US backend environment
Request Body
string
required
Amount to withdraw in USDC (decimal string)
Response
string
Blockchain transaction hash for tracking on Linea network
{
"txHash": "0xb92de09d893e8162b0861c0f7321f68df02212efbc58f208839ae3f176d89638"
}
{
"message": "Insufficient reward balance"
}
{
"message": "amount must be a positive number"
}
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"}'
import requests
url = "https://dev.api.baanx.com/v1/wallet/reward/withdraw"
headers = {
"x-client-key": "YOUR_CLIENT_KEY",
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
data = {"amount": "25.00"}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
result = response.json()
print(f"Withdrawal initiated: {result['txHash']}")
print(f"Track on Linea: https://lineascan.build/tx/{result['txHash']}")
interface WithdrawalResponse {
txHash: string;
}
async function withdrawRewards(amount: string): Promise<string> {
const response = await fetch(
'https://dev.api.baanx.com/v1/wallet/reward/withdraw',
{
method: 'POST',
headers: {
'x-client-key': 'YOUR_CLIENT_KEY',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({ amount })
}
);
if (!response.ok) throw new Error('Withdrawal failed');
const data: WithdrawalResponse = await response.json();
return data.txHash;
}
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.Related Endpoints
Was this page helpful?
⌘I