Quick Start

Get your API keys

Most endpoints (e.g. those requiring access to your account) require authentication using a token. You can create an API token in your account settings. Your API key will only be shown once, so make sure to record it securely.

Authenticate Request

Most endpoints require authentication. Follow this example to authenticate your requests.

Sample authentication

GET https://api.cloudnode.pro/v4/

Token is provided with Authorization: Bearer <YOUR TOKEN>. If authentication fails, you will get either err_unauthorised or err_no_permission. See below for more info.

Headers

Name
Type
Description

Authorization*

string

Bearer token_abc123...

{
    "code": "err_unauthorised",
    "title": "Authentication credentials are missing",
    "message": "You did not provide an API key or it was invalid. Please provide your API key in the Authorization header, using e.g. 'Authorization: Bearer YOUR_API_KEY'"
}

To authenticate with a session, send a cookie named session and value the session ID.

Send your first request

We recommend using our well-maintained Node.js library or command-line interface for the simplest experience in operating our API.

Library

const apiClient = new ApiClient("<YOUR TOKEN>");

console.log(await apiClient.auth.check());

CLI

cloudnode login --token <YOUR_TOKEN>
cloudnode auth/check

The Fetch API is available client-side by default without additional code. On Node.js, you can import and use node-fetch.

fetch("https://api.cloudnode.pro/v4/auth/check", {
    method: "GET",
    headers: {
        Authorization: "Bearer <YOUR TOKEN>"
    }
})
  .then(response => response.json())
  .then(data => console.log(data));

XHR can be used in older/legacy browsers which do not support the Fetch API. We do not recommend using XHR server-side, although you could, using one of the many available wrappers on NPM.

const xhr = new XMLHttpRequest();
xhr.addEventListener("load", function () {
    const data = JSON.parse(this.responseText);
    console.log(data);
});
xhr.open("GET", "https://cloudnode.pro/v4/auth/check");
xhr.setRequestHeader("Authorization", "Bearer <YOUR TOKEN>");
xhr.send();

Other platforms

The following are some examples of how you can communicate with our API using other platforms. We only provide limited support for these platforms and we strongly advise you to learn how to work with HTTP requests in your language of choice on your own before using this API.

require 'net/http'
require 'uri'

uri = URI.parse("https://api.cloudnode.pro/v4/auth/check")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer <YOUR TOKEN>"

req_options = {
  use_ssl: uri.scheme == "https",
}

response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(request)
end

# response.code
# response.body

Last updated