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

Was this helpful?

  1. API REFERENCE V1 (OLD)

Request Authorization

Authorization header

To authorize each API request, you will need to transmit your API KEY in the Authorization header as follows:

Authorization: Token <API KEY>

Example of request with a token

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

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

url = "https://api.cryptocloud.plus/v1/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/v1/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('Authorization error');
        }
    })
    .then(data => {
        console.log('Success:', data);
    })
    .catch(error => {
        console.error('Fail:', error);
    });

Possible errors

Response code
Error key
Error description

401

Unauthenticated

Incorrect API KEY

Example of response with an error

{
  "message": "Unauthenticated."
}
PreviousAutomatic POSTBACKNextInvoice Creation

Last updated 1 year ago

Was this helpful?