EN
English
  • Getting Started
    • Documentation Overview
    • How the Integration Works
    • Integration Testing
    • How to Get API Keys
    • SDK for Work with API
    • Integration of Icons and Buttons
    • Cryptocurrency payment instruction
    • Support and FAQ
  • API REFERENCE V2
    • Request Authorization
    • Invoice Creation
    • Invoice Cancellation
    • Invoice List
    • Invoice Information
    • Balance
    • Statistics
    • Static Wallet
    • Funds Withdrawal
    • Automatic POSTBACK
  • API REFERENCE V1 (OLD)
    • Request Authorization
    • Invoice Creation
    • Invoice Status Check
    • Automatic POSTBACK
  • CMS Plugins
    • List of CMS Plugins
      • WooCommerce
      • OpenCart
      • Shopify
      • Tilda
      • GetCourse
      • XenForo 2
      • PrestaShop
      • Drupal
      • WHMCS
  • Buttons and forms
    • HTML-widget
      • HTML-form
      • HTML-button
  • CryptoCloud Website
  • Help Center
  • Brand Guide
Powered by GitBook
On this page
  • Creation of a withdrawal request
  • Parameter description
  • Description of response parameters
  • Example request

Was this helpful?

  1. API REFERENCE V2

Funds Withdrawal

Detailed description of the request to create a withdrawal request.

In order to create a withdrawal request, you need to send a POST request.

For authentication you need to use a separate API KEY. It can be generated in the «Security» section of your account settings. The key is displayed once, so be sure to keep it in a safe place and prevent its disclosure.

The minimum interval between requests is 12 seconds.

Creation of a withdrawal request

POST https://api.cryptocloud.plus/v2/invoice/api/out/create

Headers

Name
Type
Description

Authorization*

String

Token <API KEY>

Request Body

Name
Type
Description

currency_code*

String

Currency code: 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

Recipient's wallet address

amount*

Int

Withdrawal request amount in the specified currency

{
	"status": "success",
	"data": {
		"invoice_id": "INV-XXXXXXXX",
		"status": "created",
		"currency": "BTC",
		"amount": 0.05
	}
}
Ключ ошибки
Описание

required_parameter

There are no mandatory query parameters

currency_code

Unsupported or incorrect currency code

network

Incorrect recipient address format

uncorrected_amount

The amount is too small, too large, or in the wrong format

rate_limit

The limit of requests per minute has been exceeded

validate_error

Internal validation error

Parameter description

Parameter name
Data type
Values
Example

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

Recipient's address

1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

amount*

Int

Withdrawal request amount

0.05

Description of response parameters

A successful request receives a response with a success status and a data object.

  • invoice_id — unique identifier of the withdrawal request with the prefix INV.

  • status — withdrawal request status, when sending a request is always equal to created.

  • currency — code of the selected cryptocurrency in the request.

  • amount — the amount of the withdrawal request in cryptocurrency.

Example request

These examples show how you can submit a request to create a withdrawal request. Note that you need to provide your API key from the «Security» section in the Authorization header to successfully authorize the request.

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)
Axios.js:
/**
 * 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);
  }
})();
Fetch.js:
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));
Ajax.js:
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 8.0 +
<?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();
}
PreviousStatic WalletNextAutomatic POSTBACK

Last updated 11 hours ago

Was this helpful?