Create a stablecoin withdrawal
curl --request POST \
--url https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount": "<string>",
"destinationId": "<string>",
"externalReference": "<string>"
}
'import requests
url = "https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals"
payload = {
"amount": "<string>",
"destinationId": "<string>",
"externalReference": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: '<string>', destinationId: '<string>', externalReference: '<string>'})
};
fetch('https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals', 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.sandbox.rails.wayex.com/v1/treasury/withdrawals",
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>',
'destinationId' => '<string>',
'externalReference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.sandbox.rails.wayex.com/v1/treasury/withdrawals"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"destinationId\": \"<string>\",\n \"externalReference\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.sandbox.rails.wayex.com/v1/treasury/withdrawals")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"destinationId\": \"<string>\",\n \"externalReference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"destinationId\": \"<string>\",\n \"externalReference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"clientId": "<string>",
"asset": "USDC",
"network": "ethereum",
"amount": "<string>",
"fee": {
"amount": "<string>",
"currency": "AUD",
"network": "ethereum"
},
"sourceDebit": {
"amount": "<string>",
"currency": "AUD",
"network": "ethereum"
},
"destinationAddress": "<string>",
"status": "accepted",
"configurationId": "<string>",
"externalReference": "<string>",
"reservation": {
"status": "reserved",
"amount": {
"amount": "<string>",
"currency": "AUD",
"network": "ethereum"
}
},
"nextAction": "none",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"destinationId": "<string>",
"destinationTag": "<string>",
"providerReference": "<string>",
"statusReason": "<string>",
"txHash": "<string>"
}Withdraw stablecoin
Create a stablecoin withdrawal
Creates a stablecoin withdrawal and durably reserves its source debit from this tenant account’s matching asset/network wallet.
POST
/
v1
/
treasury
/
withdrawals
Create a stablecoin withdrawal
curl --request POST \
--url https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount": "<string>",
"destinationId": "<string>",
"externalReference": "<string>"
}
'import requests
url = "https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals"
payload = {
"amount": "<string>",
"destinationId": "<string>",
"externalReference": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: '<string>', destinationId: '<string>', externalReference: '<string>'})
};
fetch('https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals', 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.sandbox.rails.wayex.com/v1/treasury/withdrawals",
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>',
'destinationId' => '<string>',
'externalReference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.sandbox.rails.wayex.com/v1/treasury/withdrawals"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"destinationId\": \"<string>\",\n \"externalReference\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.sandbox.rails.wayex.com/v1/treasury/withdrawals")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"destinationId\": \"<string>\",\n \"externalReference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.rails.wayex.com/v1/treasury/withdrawals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"destinationId\": \"<string>\",\n \"externalReference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"clientId": "<string>",
"asset": "USDC",
"network": "ethereum",
"amount": "<string>",
"fee": {
"amount": "<string>",
"currency": "AUD",
"network": "ethereum"
},
"sourceDebit": {
"amount": "<string>",
"currency": "AUD",
"network": "ethereum"
},
"destinationAddress": "<string>",
"status": "accepted",
"configurationId": "<string>",
"externalReference": "<string>",
"reservation": {
"status": "reserved",
"amount": {
"amount": "<string>",
"currency": "AUD",
"network": "ethereum"
}
},
"nextAction": "none",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"destinationId": "<string>",
"destinationTag": "<string>",
"providerReference": "<string>",
"statusReason": "<string>",
"txHash": "<string>"
}What this endpoint does
Creates a stablecoin withdrawal and durably reserves its source debit from this tenant account’s matching asset/network wallet.When to use it
Submit it after reviewing the approved destination, exact network, fee, source debit, and available balance.Before you call
Use a secret API key withtreasury:write. The destination, asset/network, limits, screening, and available balance must all be eligible.
Money and balance effect
On acceptance, the source debit is reserved. It is captured after confirmed execution or released only when non-execution is proven.States and completion
Bothaccepted and held withdrawals have durably reserved the source debit; accepted means reserved, not sent, and held needs review before submission. A withdrawal on a network this account has no credited deposit or settled conversion for is accepted as held with statusReason withdrawal_network_not_held and stays parked until Wayex releases it — withdraw on a chain you have funded, or convert onto it first. The status moves to settled only after on-chain finality is reached — confirmation counts are not exposed on this resource. Follow status, reason, and next action through submission, failure, and hold; an unresolved outcome remains reconciling.
Safe retries
Send a uniqueIdempotency-Key for the logical action. If the response is lost, retry the same payload with the same key; never create a new key merely because the first response timed out.
Read Conversions and withdrawals for the complete workflow.Authorizations
BearerApiKey
Send the same Wayex API key as Authorization: Bearer <key>.
Headers
A unique key for this logical action. Reuse the same key and identical payload when retrying after an unknown response.
Required string length:
8 - 255Body
application/json
Available options:
USDC, USDT Available options:
ethereum, base, arbitrum, optimism, polygon, bsc, avalanche, solana, tron Pattern:
^\d+(\.\d+)?$Minimum string length:
1Minimum string length:
1Response
201 - application/json
Minimum string length:
1Minimum string length:
1Available options:
USDC, USDT Available options:
ethereum, base, arbitrum, optimism, polygon, bsc, avalanche, solana, tron Pattern:
^\d+(\.\d+)?$Show child attributes
Show child attributes
Show child attributes
Show child attributes
Minimum string length:
1Available options:
accepted, held, submitted, settled, failed, returned Minimum string length:
1Minimum string length:
1Show child attributes
Show child attributes
Available options:
none, wait_for_settlement, contact_support, retry_new_request, review_balance Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1On-chain transaction hash. Resolvable on a block explorer for this withdrawal's network.
Minimum string length:
1
