Crypto withdraw operation [Private]
This endpoint allows you to withdraw cryptocurrency assets.
Method name: | /v2/withdraw/crypto |
Request type: | POST |
To call private endpoints, you need to get a JWT token or an API key for authentication.
Here you can learn in detail how to successfully authenticate.
This endpoint is intended to ensure the possibility of withdrawing the client's funds to the specified deposit address.
The list of available paymentMethodCode
and fields for it can be obtained by executing a request at /v2/withdraw/pre-request
.
The response from the endpoint contains a set of fields that is universal for all types of operations. Some fields may contain null values, as they are not specific to this operation type.
Before performing a crypto withdrawal, the crypto address is validated, and its AML check is also carried out. If the crypto address is found to belong to the suspicious list, such an operation will be blocked, and the operation will be in OnHold status.
Crypto withdrawals can acquire the following statuses:
Created | Operation created. |
Processing | Operation in processing. |
OnHold | The operation is blocked (for example, for checking AML). |
Declined | The operation is rejected. |
Completed | The operation is successful. |
To provide information about the status of the operation, a callback service is implemented. The link for receiving callbacks should be provided in the cryptocurrency withdrawal request.
The duration of execution of a crypto withdrawal depends on many factors, but the main one is the speed of processing such withdrawal by the blockchain network. In most cases, this is a few minutes, but sometimes the processing time can take much longer. In this case, the operation will be in Processing status.
Information about the amount of operation fees will be indicated along with other operation details.
Data dictionary
Name | Type | Parameter type | Required | Range | Description |
---|---|---|---|---|---|
walletId | string | BODY | YES | - | Unique identifier of customer wallet in Kuna Core. |
paymentMethodCode | string | BODY | YES | - | Payment code. You can get it via "Pre-request for crypto withdraw" endpoint. |
amount | string | BODY | YES | - | Amount of funds to withdraw. |
externalId | string | BODY | YES | - | Unique Id of operation in your system. |
callbackUrl | string | BODY | NO | - | After the withdraw is completed, a POST request will be created to the callbackUrl. |
fields | string | BODY | YES | - | Description and requirements of fields for withdraw, described in "Pre-request for crypto withdraw" endpoint. |
Exemplary request
const url = BASE_URL;
const path = "/v2/withdraw/crypto";
const body = {
fields: { address: "T9zGcAgLTSQdwqiebc4miqreaUZ68HrhiF" },
paymentMethodCode: "crypto_withdraw_trx_usdt",
amount: "6.008699",
walletId: "1f44b1c7-9fd4-4d20-b9a4-7aca3646d0d5",
externalId: "withdrawal-002-003",
callbackUrl: "https://webhook.site/12495b92-cbe4-4e88-a645-19b1ae5f4c97",
};
const options = {
method: "POST",
headers: {
accept: "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${data.accessToken}` // data.accessToken - generated a JWT token via /v2/auth/login.
},
body: JSON.stringify(body),
};
fetch(url + path, options)
.then((response) => response.json())
.then((showResponse) => console.log(showResponse.data));
import requests
url = BASE_URL
path = "/v2/withdraw/crypto"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + data.accessToken # data.accessToken - generated a JWT token via /v2/auth/login.
}
body = {
"fields": { "address": "T9zGcAgLTSQdwqiebc4miqreaUZ68HrhiF" },
"paymentMethodCode": "crypto_withdraw_trx_usdt",
"amount": "6.008699",
"walletId": "1f44b1c7-9fd4-4d20-b9a4-7aca3646d0d5",
"externalId": "withdrawal-002-003",
"callbackUrl": "https://webhook.site/12495b92-cbe4-4e88-a645-19b1ae5f4c97"
}
request = requests.post(url + path, headers=headers, json=body)
print(request.json())
How to call private endpoints here
Response
{
"data": {
"callbackUrl": "https://webhook.site/12495b92-cbe4-4e88-a645-19b1ae5f4c97", // Link to the callback handler.
"createdAt": "2024-03-18T16:29:56.294Z", // Operation сreation time.
"externalId": "withdrawal-002-003", // External operation ID.
"id": "0e8586ba-05a5-4804-ac71-c9e317b5a76a", // Internal operation ID.
"sourceAmount": "2", // Withdrawal amount.
"sourceAsset": "USDT", // Withdrawal asset.
"status": "Processing", // Operation status.
"targetAmount": null, // Always null for "Crypto withdraw operation".
"targetAsset": "USDT", // Withdrawal asset.
"type": "Withdraw", // Operation type.
"walletId": "1f44b1c7-9fd4-4d20-b9a4-7aca3646d0d5", // Customer wallet ID.
"address": "T9zGcAgLTSQdwqiebc4miqreaUZ68HrhiF", // Withdrawal address.
"blockchainTxId": null, // Transaction hash.
"feeDepositAsset": null, // Always null for "Crypto withdraw operation".
"feeTradeAsset": null, // Always null for "Crypto withdraw operation".
"feeWithdrawAsset": "USDT", // Withdrawal asset.
"feeDeposit": null, // Always null for "Crypto withdraw operation".
"feeTrade": null, // Always null for "Crypto withdraw operation".
"feeWithdraw": null, // Withdrawal fee.
"memo": null, // Memo tag.
"network": "TRX", // Withdrawal network.
"rate": null, // Always null for "Crypto withdraw operation".
"reason": null, // Reason for stopping the operation.
"totalFeeSourceAsset": null, // Withdrawal fee.
"totalFeeTargetAsset": null // Always null for "Crypto withdraw operation".
}
}
Calback
{
"data": {
"id": "0e8586ba-05a5-4804-ac71-c9e317b5a76a",
"memo": null,
"rate": null,
"type": "Withdraw",
"reason": null,
"status": "Created | Processing | OnHold | Declined | Completed",
"address": "T9zGcAgLTSQdwqiebc4miqreaUZ68HrhiF",
"network": "TRX",
"feeTrade": null,
"metadata": {},
"walletId": "1f44b1c7-9fd4-4d20-b9a4-7aca3646d0d5",
"createdAt": "2024-03-18T16:29:56.294Z",
"externalId": "withdrawal-002-003",
"feeDeposit": null,
"callbackUrl": "https://webhook.site/12495b92-cbe4-4e88-a645-19b1ae5f4c97",
"completedAt": "2024-03-18T16:32:08.131Z",
"feeWithdraw": "0.36",
"sourceAsset": "USDT",
"targetAsset": "USDT",
"sourceAmount": "2.36",
"targetAmount": "2",
"feeTradeAsset": null,
"initialAmount": "2",
"blockchainTxId": "7db75d293bbd797ead3da6600b2fa5e4337f2ba90792fdfac1f0632cf7ddef8b",
"feeDepositAsset": null,
"feeWithdrawAsset": "USDT",
"totalFeeSourceAsset": "0.36",
"totalFeeTargetAsset": null
}
}
Updated 9 months ago