Вывод средств
Подробное описание запроса на создание заявки на вывод средств.
Для того, чтобы создать заявку на вывод средств, необходимо отправить POST запрос.
Для аутентификации необходимо использовать отдельный API KEY. Его можно сгенерировать в разделе «Безопасность» в настройках вашего аккаунта. Ключ отображается один раз, поэтому обязательно сохраните его в надежном месте и не допускайте его раскрытия.
Минимальный интервал между запросами — 12 секунд.
Создание заявки на вывод
POST https://api.cryptocloud.plus/v2/invoice/api/out/create
Headers
Authorization*
String
Token <API KEY>
Request Body
currency_code*
String
Код валюты: BTC, LTC, TRX, USDT_TRC20, USDD_TRC20 , ETH, USDT_ERC20, USDC_ERC20, TUSD_ERC20, SHIB_ERC20, ETH_ARB, USDT_ARB, USDC_ARB, ETH_OPT, USDT_OPT, USDC_OPT, ETH_BASE, USDC_BASE, BNB, USDT_BSC, USDC_BSC, TUSD_BSC, TON, USDT_TON, SOL, USDT_SOL, USDC_SOL
to_address*
String
Адрес кошелька получателя
amount*
Int
Сумма заявки на вывод в указанной валюте
{
"status": "success",
"data": {
"invoice_id": "INV-XXXXXXXX",
"status": "created",
"currency": "BTC",
"amount": 0.05
}
}required_parameter
Отсутствуют обязательные параметры запроса
currency_code
Неподдерживаемый или неверный валютный код
network
Неправильный формат адреса получателя
uncorrected_amount
Сумма слишком мала, велика или в неверном формате
rate_limit
Превышен лимит запросов в минуту
validate_error
Внутренняя ошибка валидации
Описание параметров
currency_code*
String
BTC, LTC, TRX, USDT_TRC20, USDD_TRC20 , ETH, USDT_ERC20, USDC_ERC20, TUSD_ERC20, SHIB_ERC20, ETH_ARB, USDT_ARB, USDC_ARB, ETH_OPT, USDT_OPT, USDC_OPT, ETH_BASE, USDC_BASE, BNB, USDT_BSC, USDC_BSC, TUSD_BSC, TON, USDT_TON, SOL, USDT_SOL, USDC_SOL
BTC
to_address*
String
Адрес получателя
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
amount*
Int
Сумма заявки на вывод
0.05
Описание параметров ответа
На успешный запрос приходит ответ со статусом success и объектом data.
invoice_id — уникальный идентификатор заявки на вывод с префиксом INV.
status — статус заявки на вывод, при отправке запроса всегда равен created.
currency — код выбранной криптовалюты в заявке.
amount — сумма заявки на вывод в криптовалюте.
Пример запроса
Эти примеры показывают, как можно отправить запрос на создание заявки на вывод средств. Обратите внимание, что необходимо предоставить ваш API ключ из раздела «Безопасность» в заголовке Authorization для успешной авторизации запроса.
curl -X POST \
https://api.cryptocloud.plus/v2/invoice/api/out/create \
-H 'Authorization: Token YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"currency_code": "BTC",
"to_address": "YOUR_RECIPIENT_ADDRESS",
"amount": 0.00023
}'import requests
from typing import Optional
class PayoutAPIClient:
def __init__(self, api_key: str):
self.api_key = api_key
self.base_url = 'https://api.cryptocloud.plus'
self.headers = {
'Authorization': f'Token {self.api_key}',
'Content-Type': 'application/json'
}
def create_payout(self, currency_code: str, to_address: str, amount: float) -> dict:
"""
Creates a withdrawal request.
:param currency_code: Currency code (e.g. “BTC”, “ETH”, “USDT”, “LTC”).
:param to_address: Recipient's address.
:param amount: Amount to send.
:return: API response in dict format.
"""
url = f"{self.base_url}/v2/invoice/api/out/create"
payload = {
"currency_code": currency_code,
"to_address": to_address,
"amount": amount
}
response = requests.post(url, json=payload, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
raise PayoutAPIError(response.status_code, response.json())
class PayoutAPIError(Exception):
def __init__(self, status_code: int, error_data: Optional[dict] = None):
self.status_code = status_code
self.error_data = error_data or {}
message = f"API Request failed with status {status_code}: {self.error_data}"
super().__init__(message)
# Example of use:
if __name__ == "__main__":
# Client Configuration
api_key = ""
client = PayoutAPIClient(api_key)
try:
result = client.create_payout(
currency_code="BTC",
to_address="",
amount=0.00023
)
print("Success:", result)
except PayoutAPIError as e:
print("Error occurred:", e)/**
* Custom error for handling payout API response failures.
*/
class PayoutAPIError extends Error {
/**
* @param {number} statusCode - HTTP status code returned by the API.
* @param {object} [errorData={}] - Error details returned by the API.
*/
constructor(statusCode, errorData = {}) {
super(`API Request failed with status ${statusCode}: ${JSON.stringify(errorData)}`);
this.name = 'PayoutAPIError';
this.statusCode = statusCode;
this.errorData = errorData;
}
}
/**
* Client for interacting with CryptoCloud Payout API.
*/
class PayoutAPIClient {
/**
* @param {string} apiKey - API token used for authentication.
*/
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://api.cryptocloud.plus';
this.headers = {
'Authorization': `Token ${this.apiKey}`,
'Content-Type': 'application/json'
};
}
/**
* Creates a payout request.
*
* @param {string} currencyCode - Currency code (e.g., "BTC", "ETH", "USDT", "LTC").
* @param {string} toAddress - Recipient address.
* @param {number} amount - Amount to send.
* @returns {Promise<object>} - API response data.
* @throws {PayoutAPIError} - On failed request.
*/
async createPayout(currencyCode, toAddress, amount) {
const url = `${this.baseUrl}/v2/invoice/api/out/create`;
const payload = {
currency_code: currencyCode,
to_address: toAddress,
amount: amount
};
try {
const response = await axios.post(url, payload, {
headers: this.headers
});
return response.data;
} catch (error) {
const status = error.response?.status || 500;
const data = error.response?.data || {};
throw new PayoutAPIError(status, data);
}
}
}
// Example usage with Axios
(async () => {
const client = new PayoutAPIClient('<your_api_key_here>');
try {
const result = await client.createPayout("BTC", "<recipient_address>", 0.00023);
console.log("Success:", result);
} catch (error) {
console.error("Error occurred:", error);
}
})();const apiKey = '<your_api_key>';
const payload = {
currency_code: 'BTC',
to_address: '<recipient_address>',
amount: 0.00023
};
fetch('https://api.cryptocloud.plus/v2/invoice/api/out/create', {
method: 'POST',
headers: {
'Authorization': `Token ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(response => {
if (!response.ok) throw new Error(`HTTP error ${response.status}`);
return response.json();
})
.then(data => console.log('Success:', data))
.catch(err => console.error('Error:', err));const apiKey = '<your_api_key>';
const xhr = new XMLHttpRequest();
xhr.open("POST", "https://api.cryptocloud.plus/v2/invoice/api/out/create");
xhr.setRequestHeader("Authorization", `Token ${apiKey}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = function () {
if (xhr.status === 200) {
console.log("Success:", JSON.parse(xhr.responseText));
} else {
console.error("Error:", xhr.status, xhr.responseText);
}
};
const payload = {
currency_code: 'BTC',
to_address: '<recipient_address>',
amount: 0.00023
};
xhr.send(JSON.stringify(payload));<?php
/**
* Class PayoutAPIError
*
* Custom exception for API errors.
*/
class PayoutAPIError extends Exception
{
public int $statusCode;
public array $errorData;
/**
* PayoutAPIError constructor.
*
* @param int $statusCode
* @param array $errorData
*/
public function __construct(int $statusCode, array $errorData = [])
{
$this->statusCode = $statusCode;
$this->errorData = $errorData;
$message = "API Request failed with status $statusCode: " . json_encode($errorData);
parent::__construct($message, $statusCode);
}
}
/**
* Class PayoutAPIClient
*
* Client for creating crypto payouts via CryptoCloud API.
*/
class PayoutAPIClient
{
private string $apiKey;
private string $baseUrl;
private array $headers;
/**
* PayoutAPIClient constructor.
*
* @param string $apiKey
*/
public function __construct(string $apiKey)
{
$this->apiKey = $apiKey;
$this->baseUrl = 'https://api.cryptocloud.plus';
$this->headers = [
'Authorization: Token ' . $this->apiKey,
'Content-Type: application/json'
];
}
/**
* Create payout request.
*
* @param string $currencyCode Currency code (e.g., BTC, ETH).
* @param string $toAddress Recipient address.
* @param float $amount Amount to send.
* @return array Response from API.
* @throws PayoutAPIError On API failure.
*/
public function createPayout(string $currencyCode, string $toAddress, float $amount): array
{
$url = $this->baseUrl . '/v2/invoice/api/out/create';
$payload = json_encode([
'currency_code' => $currencyCode,
'to_address' => $toAddress,
'amount' => $amount,
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$decoded = json_decode($response, true);
curl_close($ch);
if ($httpCode === 200) {
return $decoded;
} else {
throw new PayoutAPIError($httpCode, $decoded ?? []);
}
}
}
// Example usage
try {
$client = new PayoutAPIClient('<your_api_key_here>');
$response = $client->createPayout('BTC', '<recipient_address>', 0.00023);
echo "Success:\n";
print_r($response);
} catch (PayoutAPIError $e) {
echo "Error occurred:\n" . $e->getMessage();
}Мы регулярно работаем над улучшением документации сервиса для разработчиков. Пожалуйста, оцените качество и полезность материалов по ссылке.
Last updated
Was this helpful?