Create Withdrawal
HTTP Method: POST
Endpoint URL: /v2/withdrawal
Description: Creates a new withdrawal request that requires approval before processing.
Security: Requires both API-KEY and X-HMAC headers.
Request Headers
Content-Type: application/jsonAPI-KEY: your_account_api_keyX-HMAC: your_hmac_signature(calculated from all request body fields)
Request Body (JSON)
{
"amount": "10",
"asset": {
"short": "USDT",
"network": "tron"
},
"addressTo": "TPSMckmxoQBQWfUcasbUs2cRUdh2EMQu4n",
"customer": {
"id": 1,
"name": "Customer Name",
"email": "customer-email@email.com"
},
"destTag": "",
"invoice": "your-system-invoice-id"
}
Required Fields
- amount (string) — Withdrawal amount as a decimal string with up to 8 decimal places
- asset (object) — Cryptocurrency asset:
short— Asset ticker symbol, e.g.USDTnetwork— Blockchain network API value, e.g.tron
- addressTo (string) — Destination wallet address
Optional Fields
- customer (object) — Customer information. If omitted, the withdrawal is stored with
id: 0and emptyname/email:id— Your internal customer identifier (integer)name— Customer nameemail— Customer email address
- destTag (string | null) — Destination tag/memo; omit, or pass an empty string or
null, if the destination does not need one - invoice (string) — Your internal invoice/order ID for transaction tracking. Must be unique among your
OPENandAPPROVEDwithdrawals (see409 Conflict). If omitted,invoiceisnullin the response - addressFrom (string) — Source wallet address for withdraw-direct mode. Must be provided together with
clientId. See Withdraw-Direct section below. - clientId (string) — Client identifier for address ownership validation. Must be provided together with
addressFrom. See Client ID documentation for details. - transferAll (boolean) — When
true, withdraws the entire balance from the source address instead of the specifiedamount. Used with withdraw-direct mode.
Validation:
addressFromandclientIdmust both be provided together. Sending only one will return a400 Bad Requesterror.
Supported Asset Combinations
Withdrawals are available for every asset and network listed on the Available Assets page. Use the API value of the network (e.g. tron, ethereum, bsc, base, solana, ton, bitcoin). An unsupported short + network combination returns 400 Bad Request.
For networks that use a memo (e.g. ton), pass it in destTag when the destination requires one, such as an exchange deposit account.
Example cURL
curl https://api.alppay.io/v2/withdrawal \
-X POST \
-H "Content-Type: application/json" \
-H "API-KEY: ak_live_1234567890abcdef" \
-H "X-HMAC: your_calculated_signature" \
-d '{
"amount": "10",
"asset": {
"short": "USDT",
"network": "tron"
},
"addressTo": "TPSMckmxoQBQWfUcasbUs2cRUdh2EMQu4n",
"customer": {
"id": 1,
"name": "Customer Name",
"email": "customer-email@email.com"
},
"destTag": "",
"invoice": "your-system-invoice-id"
}'
Successful Response (200 OK)
{
"id": "5f5a8ced-5c6a-4038-9d73-662441242fd3",
"txnId": "",
"amount": "10",
"receivedAmount": "0",
"asset": {
"short": "USDT",
"name": "Tether",
"logoUrl": "https://cryptologos.cc/logos/tether-usdt-logo.png",
"network": "tron"
},
"addressFrom": "",
"addressTo": "TPSMckmxoQBQWfUcasbUs2cRUdh2EMQu4n",
"destTag": null,
"status": "OPEN",
"customer": {
"id": 1,
"name": "Customer Name",
"email": "customer-email@email.com"
},
"merchant": {
"id": 1,
"name": "TestMerchant",
"email": "test-merchant@test.com",
"siteUrl": "",
"logoUrl": ""
},
"invoice": "your-system-invoice-id",
"createdAt": "2025-08-07T09:08:58.780375195Z",
"updatedAt": "2025-08-07T09:08:58.780375285Z",
"timeToApprove": null
}
Response Field Descriptions
id— Unique UUID identifier of the withdrawal requesttxnId— Transaction ID on blockchain (empty until processing)amount— Requested withdrawal amount as decimal stringreceivedAmount— Amount actually sent as decimal string (0 until processed)asset— Asset details object including name and logo URLaddressFrom— Source address (empty until processing)addressTo— Destination wallet addressdestTag— Destination tag if applicable, otherwise nullstatus— Current status:OPEN,APPROVED,CANCELLED, orCOMPLETEcustomer— Customer information objectmerchant— Merchant account details objectinvoice— Your internal invoice IDcreatedAt— ISO 8601 timestamp of withdrawal creationupdatedAt— ISO 8601 timestamp of last updatetimeToApprove— ISO 8601 timestamp when withdrawal will be auto-approved by the system (null if manual approval required)
Withdrawal Status Flow
- OPEN - Initial status after creation, awaiting approval
- APPROVED - Withdrawal approved (manually or automatically after
timeToApprove) - COMPLETE - Withdrawal successfully processed on blockchain
- CANCELLED - Withdrawal cancelled before processing
Important Notes
-
Approval Required: All withdrawals require approval before processing. This can happen:
- Manually through the dashboard
- Automatically after the time specified in
timeToApprove
-
HMAC Signature: The
X-HMACheader must be calculated using ALL fields sent in the request body -
Customer ID: The
customer.idfield should be your internal customer identifier to maintain linkage between your system and the payment gateway -
Invoice Field: Use the
invoicefield to store your internal transaction reference. This helps recover transaction links if the withdrawal ID is lost -
Webhooks: Status change notifications are sent automatically to your configured webhook URL. See the Withdrawal Webhooks documentation for details
Withdraw-Direct Mode
When you provide addressFrom and clientId together, the withdrawal operates in withdraw-direct mode — funds are sent directly from the specified deposit address rather than from the merchant's pooled balance.
Withdraw-Direct Request Example
{
"amount": "10",
"asset": {
"short": "USDT",
"network": "tron"
},
"addressTo": "TPSMckmxoQBQWfUcasbUs2cRUdh2EMQu4n",
"addressFrom": "TXkFpL3HmzE9KPpXGWNXdCbNcDYYn73U4C",
"clientId": "client-12345",
"transferAll": true,
"customer": {
"id": 1,
"name": "Customer Name",
"email": "customer-email@email.com"
},
"destTag": "",
"invoice": "your-system-invoice-id"
}
Key Points
addressFrommust belong to the authenticated merchant and the specifiedclientId- If
addressFromdoes not match ownership, a403 Forbiddenerror is returned - The merchant's Withdrawal to whitelist setting must be enabled; otherwise the request returns
400 Bad Requestwithwithdrawal to whitelist is disabled for this merchant addressTomust be on the merchant's whitelist for the asset and network; otherwise the request returns400 Bad RequestwithaddressTo is not whitelisted for this merchanttransferAll: trueignores theamountfield and transfers the full address balance
Error Responses
400 Bad Request
Returned when request validation fails (invalid email, unsupported asset/network combination, etc.). For withdraw-direct also when the Withdrawal to whitelist setting is disabled or addressTo is not whitelisted (see Withdraw-Direct Mode).
401 Unauthorized
Missing or invalid API-KEY header, or a missing / invalid X-HMAC signature.
{
"code": "unauthorized",
"message": "Invalid HMAC signature"
}
403 Forbidden
The API key is valid but the request is not allowed: the request IP is not in the merchant's IP whitelist ("Blocked by IP"), or the merchant account is frozen or deactivated. For withdraw-direct, 403 is also returned when addressFrom is not linked to clientId or the wallet is blocked.
409 Conflict
A withdrawal with the same invoice already exists in OPEN or APPROVED status. Once that withdrawal is COMPLETE or CANCELLED, the invoice can be reused.
{
"code": 409,
"message": "a withdrawal with this invoice already exists in OPEN or APPROVED status"
}
500 Internal Server Error
Server-side error occurred. If it happened while checking the whitelist or the source address (withdraw-direct), no withdrawal was created and the request can be retried.