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.
Keep your API token secret! In the wrong hands, your API token can be used to gain unlimited, unrestricted access to your account and even delete your account.
We do not permit sharing of your API token with anyone in any way. If you want to share access to the API of a server, add the person as a sub-user and they will be able to create their own token to manage the server.
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
Authorization*
string
Bearer token_abc123...
To authenticate with a session, send a cookie named session
and value the session ID.
We strongly advise you to use tokens instead of sessions as their permissions and expiration can be controlled, whereas sessions grant access to all permissions the account holds and can be virtually infinite.
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();
We strongly recommend that you use the JavaScript Fetch API instead.
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