curl --request POST \
--url https://api.openxswitch.com/v2/transactions/withdraw \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"walletId": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"amount": "0.5",
"withdrawalAddress": "0x1234567890123456789012345678901234567890",
"token": "USDT",
"blockchain": "ethereum",
"refId": "txn_ref_123",
"note": "This is a test transaction",
"metadata": {
"employeeId": "EMP001"
}
}
'import requests
url = "https://api.openxswitch.com/v2/transactions/withdraw"
payload = {
"idempotencyKey": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"walletId": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"amount": "0.5",
"withdrawalAddress": "0x1234567890123456789012345678901234567890",
"token": "USDT",
"blockchain": "ethereum",
"refId": "txn_ref_123",
"note": "This is a test transaction",
"metadata": { "employeeId": "EMP001" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotencyKey: '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
walletId: '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
amount: '0.5',
withdrawalAddress: '0x1234567890123456789012345678901234567890',
token: 'USDT',
blockchain: 'ethereum',
refId: 'txn_ref_123',
note: 'This is a test transaction',
metadata: {employeeId: 'EMP001'}
})
};
fetch('https://api.openxswitch.com/v2/transactions/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.openxswitch.com/v2/transactions/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([
'idempotencyKey' => '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
'walletId' => '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
'amount' => '0.5',
'withdrawalAddress' => '0x1234567890123456789012345678901234567890',
'token' => 'USDT',
'blockchain' => 'ethereum',
'refId' => 'txn_ref_123',
'note' => 'This is a test transaction',
'metadata' => [
'employeeId' => 'EMP001'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.openxswitch.com/v2/transactions/withdraw"
payload := strings.NewReader("{\n \"idempotencyKey\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"walletId\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"amount\": \"0.5\",\n \"withdrawalAddress\": \"0x1234567890123456789012345678901234567890\",\n \"token\": \"USDT\",\n \"blockchain\": \"ethereum\",\n \"refId\": \"txn_ref_123\",\n \"note\": \"This is a test transaction\",\n \"metadata\": {\n \"employeeId\": \"EMP001\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.openxswitch.com/v2/transactions/withdraw")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"walletId\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"amount\": \"0.5\",\n \"withdrawalAddress\": \"0x1234567890123456789012345678901234567890\",\n \"token\": \"USDT\",\n \"blockchain\": \"ethereum\",\n \"refId\": \"txn_ref_123\",\n \"note\": \"This is a test transaction\",\n \"metadata\": {\n \"employeeId\": \"EMP001\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openxswitch.com/v2/transactions/withdraw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotencyKey\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"walletId\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"amount\": \"0.5\",\n \"withdrawalAddress\": \"0x1234567890123456789012345678901234567890\",\n \"token\": \"USDT\",\n \"blockchain\": \"ethereum\",\n \"refId\": \"txn_ref_123\",\n \"note\": \"This is a test transaction\",\n \"metadata\": {\n \"employeeId\": \"EMP001\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "TRANSACTION_ID",
"refId": "REF_ID",
"idempotencyKey": "IDEMPOTENCY_KEY",
"tokenName": "Bitcoin",
"tokenSymbol": "BTC",
"tokenTicker": "BTC",
"tokenAddress": "0x1234567890123456789012345678901234567890",
"decimals": 18,
"isNative": true,
"amount": {
"formatted": "479000.10",
"raw": "47900010"
},
"totalAmount": {
"formatted": "479000.10",
"raw": "47900010"
},
"chainDecimals": 18,
"blockchain": "ethereum",
"protocol": "EVM",
"environment": "mainnet",
"network": "ethereum",
"standard": "ERC20",
"txType": "incoming",
"txSubType": "DEPOSIT",
"status": "pending",
"fromAddress": "0x1234567890123456789012345678901234567890",
"toAddress": "0x1234567890123456789012345678901234567890",
"txHash": "0x1234567890123456789012345678901234567890",
"totalFee": {
"formatted": "479000.10",
"raw": "47900010"
},
"feeLevel": "normal",
"feeToken": "ETH",
"isBatch": false,
"note": "Note",
"triggerOrigin": "TRIGGER_ORIGIN",
"transactionGroupId": "TRANSACTION_GROUP_ID",
"confirmation": 1,
"confirmed": true,
"confirmedAt": "2022-01-01T00:00:00.000Z",
"userId": "USER_ID",
"walletId": "WALLET_ID",
"accountId": "ACCOUNT_ID",
"workspaceId": "WORKSPACE_ID"
}
}{
"statusCode": 400,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}{
"statusCode": 404,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "Cannot GET /v1/..."
}{
"statusCode": 422,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": [
"param is required"
]
}{
"statusCode": 500,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}Create Transfer Transaction
Create a new Transfer Transaction (fee is included)
Example:
When calling the endpoint with amount = 10 USDC, the receiver receives 10 USDC minus fee, and the balance decreases by 10 USDC.
curl --request POST \
--url https://api.openxswitch.com/v2/transactions/withdraw \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"walletId": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"amount": "0.5",
"withdrawalAddress": "0x1234567890123456789012345678901234567890",
"token": "USDT",
"blockchain": "ethereum",
"refId": "txn_ref_123",
"note": "This is a test transaction",
"metadata": {
"employeeId": "EMP001"
}
}
'import requests
url = "https://api.openxswitch.com/v2/transactions/withdraw"
payload = {
"idempotencyKey": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"walletId": "0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4",
"amount": "0.5",
"withdrawalAddress": "0x1234567890123456789012345678901234567890",
"token": "USDT",
"blockchain": "ethereum",
"refId": "txn_ref_123",
"note": "This is a test transaction",
"metadata": { "employeeId": "EMP001" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotencyKey: '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
walletId: '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
amount: '0.5',
withdrawalAddress: '0x1234567890123456789012345678901234567890',
token: 'USDT',
blockchain: 'ethereum',
refId: 'txn_ref_123',
note: 'This is a test transaction',
metadata: {employeeId: 'EMP001'}
})
};
fetch('https://api.openxswitch.com/v2/transactions/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.openxswitch.com/v2/transactions/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([
'idempotencyKey' => '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
'walletId' => '0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4',
'amount' => '0.5',
'withdrawalAddress' => '0x1234567890123456789012345678901234567890',
'token' => 'USDT',
'blockchain' => 'ethereum',
'refId' => 'txn_ref_123',
'note' => 'This is a test transaction',
'metadata' => [
'employeeId' => 'EMP001'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.openxswitch.com/v2/transactions/withdraw"
payload := strings.NewReader("{\n \"idempotencyKey\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"walletId\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"amount\": \"0.5\",\n \"withdrawalAddress\": \"0x1234567890123456789012345678901234567890\",\n \"token\": \"USDT\",\n \"blockchain\": \"ethereum\",\n \"refId\": \"txn_ref_123\",\n \"note\": \"This is a test transaction\",\n \"metadata\": {\n \"employeeId\": \"EMP001\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.openxswitch.com/v2/transactions/withdraw")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"walletId\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"amount\": \"0.5\",\n \"withdrawalAddress\": \"0x1234567890123456789012345678901234567890\",\n \"token\": \"USDT\",\n \"blockchain\": \"ethereum\",\n \"refId\": \"txn_ref_123\",\n \"note\": \"This is a test transaction\",\n \"metadata\": {\n \"employeeId\": \"EMP001\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openxswitch.com/v2/transactions/withdraw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotencyKey\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"walletId\": \"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4\",\n \"amount\": \"0.5\",\n \"withdrawalAddress\": \"0x1234567890123456789012345678901234567890\",\n \"token\": \"USDT\",\n \"blockchain\": \"ethereum\",\n \"refId\": \"txn_ref_123\",\n \"note\": \"This is a test transaction\",\n \"metadata\": {\n \"employeeId\": \"EMP001\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "TRANSACTION_ID",
"refId": "REF_ID",
"idempotencyKey": "IDEMPOTENCY_KEY",
"tokenName": "Bitcoin",
"tokenSymbol": "BTC",
"tokenTicker": "BTC",
"tokenAddress": "0x1234567890123456789012345678901234567890",
"decimals": 18,
"isNative": true,
"amount": {
"formatted": "479000.10",
"raw": "47900010"
},
"totalAmount": {
"formatted": "479000.10",
"raw": "47900010"
},
"chainDecimals": 18,
"blockchain": "ethereum",
"protocol": "EVM",
"environment": "mainnet",
"network": "ethereum",
"standard": "ERC20",
"txType": "incoming",
"txSubType": "DEPOSIT",
"status": "pending",
"fromAddress": "0x1234567890123456789012345678901234567890",
"toAddress": "0x1234567890123456789012345678901234567890",
"txHash": "0x1234567890123456789012345678901234567890",
"totalFee": {
"formatted": "479000.10",
"raw": "47900010"
},
"feeLevel": "normal",
"feeToken": "ETH",
"isBatch": false,
"note": "Note",
"triggerOrigin": "TRIGGER_ORIGIN",
"transactionGroupId": "TRANSACTION_GROUP_ID",
"confirmation": 1,
"confirmed": true,
"confirmedAt": "2022-01-01T00:00:00.000Z",
"userId": "USER_ID",
"walletId": "WALLET_ID",
"accountId": "ACCOUNT_ID",
"workspaceId": "WORKSPACE_ID"
}
}{
"statusCode": 400,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}{
"statusCode": 404,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "Cannot GET /v1/..."
}{
"statusCode": 422,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": [
"param is required"
]
}{
"statusCode": 500,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
This key is utilized to ensure exactly-once execution of mutating requests. If the same key is reused, it will be treated as the same request and the original response will be returned.
"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4"
The unique identifier of the wallet
"0e472f6b-336b-4d4f-87d6-4f93e4e4e4e4"
The transaction amount in token units
"0.5"
The destination wallet address
"0x1234567890123456789012345678901234567890"
The token symbol (e.g., USDT, USDC, ETH).
Refer to the Get Supported Tokens endpoint for the list of supported tokens.
"USDT"
The chain. Can be either the blockchain name or slug.
Refer to the Get Supported Blockchains endpoint for the list of supported blockchains.
"ethereum"
The external reference ID to uniquely identify the transaction
"txn_ref_123"
An optional note or description for the transaction
"This is a test transaction"
Additional metadata associated with the transaction
{ "employeeId": "EMP001" }
.png?fit=max&auto=format&n=ML35RDblT1Ol-zJb&q=85&s=062e79ad9c4540929eec204aff020178)
.png?fit=max&auto=format&n=ML35RDblT1Ol-zJb&q=85&s=f6328956931c9664a2a070c2edb6e9b3)