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
  • Authorization header
  • Example of a request with a token
  • Possible errors
  • Example of a response with an error

Was this helpful?

  1. API REFERENCE V2

Request Authorization

Authorization header

To authorize each API request, pass your API KEY in the Authorization header as follows:

Authorization: Token <API KEY>

Example of a request with a token

An example of using the Authorization header in an API request:

curl -X POST https://api.cryptocloud.plus/v2/invoice/create \
-header "Authorization: Token eyJ0eXAi1iJKV1QiLCJhbGci1iJIAcI1NiJ9.eyJpZCI6MTMsImV4cCI6MTYzMTc4NjQyNn0.HQavV3z8dFnk56bX3MSY5X9lR6qVa9YhAoeTEH"
import requests

url = "https://api.cryptocloud.plus/v2/invoice/create"
headers = {
    "Authorization": "Token eyJ0eXAi1iJKV1QiLCJhbGciOiJIAcI1NiJ9.eyJpZCI6MTMsImV4cCI6MTYzMTc4NjQyNn0.HQavV3z8dFnk56bX3MSY5X9lR6qVa9YhAoeTEH"
}

response = requests.post(url, headers=headers)

if response.status_code == 200:
    print("Success:", response.json())
else:
    print("Fail:", response.status_code, response.text)
const url = 'https://api.cryptocloud.plus/v2/invoice/create';
const headers = new Headers({
    'Authorization': 'Token eyJ0eXAi1iJKV1QiLCJhbGciOiJIAcI1NiJ9.eyJpZCI6MTMsImV4cCI6MTYzMTc4NjQyNn0.HQavV3z8dFnk56bX3MSY5X9lR6qVa9YhAoeTEH'
});

fetch(url, { method: 'POST', headers })
    .then(response => {
        if (response.ok) {
            return response.json();
        } else {
            return Promise.reject('Auth error');
        }
    })
    .then(data => {
        console.log('Success:', data);
    })
    .catch(error => {
        console.error('Fail:', error);
    });
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.cryptocloud.plus/v2/invoice/create");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array(
    "Authorization: Token eyJ0eXAi1iJKV1QiLCJhbGciOiJIAcI1NiJ9.eyJpZCI6MTMsImV4cCI6MTYzMTc4NjQyNn0.HQavV3z8dFnk56bX3MSY5X9lR6qVa9YhAoeTEH"
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error cURL: ' . curl_error($ch);
} else {
    $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    if ($statusCode == 200) {
        echo "Success: " . $response;
    } else {
        echo "Fail: " . $statusCode . " " . $response;
    }
}

curl_close($ch);
?>

You don't need to send a separate authorization request. API KEY should be transferred in the Authorization header.

Possible errors

Response code
Error key
Error description

400

Bad request

Invalid request

Example of a response with an error

{
    "status": "error",
    "result": {
        "authorization": "Unauthorized request."
    }
}
PreviousSupport and FAQNextInvoice Creation

Last updated 1 year ago

Was this helpful?