A client library for the Cloudnode API, written in TypeScript. Documentation
npm install cloudnode-tsimport Cloudnode from 'cloudnode-ts';
const cloudnode = new Cloudnode("token_YourSecretToken123");
// get a newsletter
const newsletter = await cloudnode.newsletter.get("newsletter_123asd");
// get response status code
console.log(newsletter._response.status); // 200const Cloudnode = require('cloudnode-ts');
const cloudnode = new Cloudnode("token_YourSecretToken123");
// get a newsletter
const newsletter = await cloudnode.newsletter.get("newsletter_123asd");
console.log(newsletter._response.status); // 200Download the browser version from browser/Cloudnode.js or use our hosted version.
<script src="https://cdn.jsdelivr.net/npm/cloudnode-ts@latest/browser/Cloudnode.min.js"></script>
<script>
const cloudnode = new Cloudnode();
// get a newsletter
const newsletter = await cloudnode.newsletter.get("newsletter_123asd");
console.log(newsletter._response.status); // 200
</script>Warning: You most likely don't want to set your private token in a public front-end website, as this will allow anyone who sees your front-end JavaScript code to use it for possibly malicious purposes. We advise you use a back-end server to proxy requests to our API, so you do not expose your token to the public.
import Cloudnode from 'cloudnode-ts';
const cloudnode = new Cloudnode("token_YourSecretToken123");
// get a newsletter
const newsletter: Cloudnode.Newsletter = await cloudnode.newsletter.get("newsletter_123asd");If you want to access response metadata (headers, status code, etc.), use Cloudnode.ApiResponse<T>, e.g.:
const newsletter: Cloudnode.ApiResponse<Cloudnode.Newsletter> = await cloudnode.newsletter.get("newsletter_123asd");
console.log(newsletter.id); // newsletter_123asd
console.log(newsletter._response.status); // 200Table of contents
-
new Cloudnode([token], [options])cloudnode.getPage<T>(response, page)cloudnode.getNextPage<T>(response)cloudnode.getPreviousPage<T>(response)cloudnode.getAllPages<T>(response)cloudnode.checkCompatibility()cloudnode.account.changePassword(currentPassword, newPassword)cloudnode.account.get()cloudnode.account.getEmail()cloudnode.account.getIdentity()cloudnode.account.listEmails()cloudnode.account.listPermissions()cloudnode.account.replaceIdentity(username, name)cloudnode.account.setEmail(email)cloudnode.account.updateIdentity(username, [name])cloudnode.auth.login(user, password)cloudnode.auth.register(username, email, password)cloudnode.newsletters.get(id)cloudnode.newsletters.list([limit], [page])cloudnode.projects.create(name)cloudnode.projects.delete(id)cloudnode.projects.get(id)cloudnode.projects.list([limit], [page])cloudnode.projects.update(id, name)cloudnode.subscriptions.create(newsletter, email, [data])cloudnode.subscriptions.delete(id)cloudnode.subscriptions.get(id)cloudnode.subscriptions.list([limit], [page])cloudnode.tokens.create(permissions, lifetime, [note])cloudnode.tokens.get(id)cloudnode.tokens.getRequest(id, request)cloudnode.tokens.list([limit], [page], [internal])cloudnode.tokens.listRequests(id, [limit], [page])cloudnode.tokens.refresh(id)cloudnode.tokens.revoke(id)
-
- Class:
Cloudnode.ApiResponse<T> - Class:
Cloudnode.RawResponse - Enum:
Cloudnode.CompatibilityStatus - Interface:
Cloudnode.AccountDetails - Interface:
Cloudnode.AccountEmail - Interface:
Cloudnode.AccountIdentity - Interface:
Cloudnode.DatedNewsletterSubscription - Interface:
Cloudnode.DatedPrimaryEmail - Interface:
Cloudnode.Error - Interface:
Cloudnode.Newsletter - Interface:
Cloudnode.NewsletterData - Interface:
Cloudnode.NewsletterSubscription - Interface:
Cloudnode.Options - Interface:
Cloudnode.PaginatedData<T> - Interface:
Cloudnode.PartialToken - Interface:
Cloudnode.Permission - Interface:
Cloudnode.PrimaryEmail - Interface:
Cloudnode.Project - Interface:
Cloudnode.Request - Interface:
Cloudnode.ShortRequest - Interface:
Cloudnode.Token - Interface:
Cloudnode.TokenMetadata
- Class:
A client library for the Cloudnode API, written in TypeScript. Documentation
Construct a new Cloudnode API client
tokenstringAPI token to use for requests.optionsPartial<Cloudnode.Options>API client options. Default:{baseUrl: "https://api.cloudnode.pro/v5/", autoRetry: true, maxRetryDelay: 5, maxRetries: 3}
Get another page of paginated results
responseCloudnode.ApiResponse<Cloudnode.PaginatedData<T>>Response to get a different page of.pagenumberPage to get.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<T>> | null>The new page or null if the page is out of bounds - Throws:
Cloudnode.ErrorError returned by the API
Get next page of paginated results
responseCloudnode.ApiResponse<Cloudnode.PaginatedData<T>>Response to get the next page of.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<T>> | null>The next page or null if this is the last page - Throws:
Cloudnode.ErrorError returned by the API
Get previous page of paginated results
responseCloudnode.ApiResponse<Cloudnode.PaginatedData<T>>Response to get the previous page of.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<T>> | null>The previous page or null if this is the first page - Throws:
Cloudnode.ErrorError returned by the API
Get all other pages of paginated results and return the complete data
Warning: Depending on the amount of data, this can take a long time and use a lot of memory.
responseCloudnode.ApiResponse<Cloudnode.PaginatedData<T>>Response to get all pages of.- Returns:
Promise<Cloudnode.PaginatedData<T>>All of the data in 1 page - Throws:
Cloudnode.ErrorError returned by the API
Check compatibility with the API
- Returns:
Promise<Cloudnode.CompatibilityStatus>
Change account password. Requires token with scope account.details.password.update.
currentPasswordstringYour current password.newPasswordstringThe new password. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.- Returns:
Promise<Cloudnode.ApiResponse<void>> - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get account details. Requires token with scope account.details.
- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.AccountDetails>> - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get your primary e-mail address. Requires token with scope account.details.email.
- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.DatedPrimaryEmail>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get account identity. Requires token with scope account.details.identity.
- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.AccountIdentity>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
List account e-mail addresses. Requires token with scope account.details.email.list.
- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.AccountEmail[]>>> - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
List account permissions with user-friendly descriptions. Some permissions (such as wildcard ones) may be excluded in this list if they don't have a description. Requires token with scope account.details.
- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.Permission[]>>> - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Replace account identity. Requires token with scope account.details.identity.update.
usernamestringYour unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start withuser_.namestring | nullYour full name. Set tonullto remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z',-.,andÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.AccountIdentity>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "CONFLICT"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Set your primary e-mail address. Requires token with scope account.details.email.update.
emailstringE-mail address to set as primary.- Returns:
Promise<Cloudnode.ApiResponse<void>> - Throws:
Cloudnode.Error & {code: "CONFLICT"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Update account identity. Requires token with scope account.details.identity.update.
usernamestringYour unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start withuser_.namestring | nullYour full name. Set tonullto remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z',-.,andÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.AccountIdentity | void>>voidif nothing was changed. - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "CONFLICT"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Create a session using user ID/username/e-mail and password.
Note: Logging in can only be performed from residential IP. Proxying this endpoint will likely not work. It is normally not recommended to use this endpoint to gain API access. Instead, create a token from your account to use with the API.
userstringUser ID (starts withuser_), username or e-mail address.passwordstringThe password of the account.- Returns:
Promise<Cloudnode.ApiResponse<{session: string}>>Session token. Also returned inSet-Cookieheader. - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "IP_REJECTED"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Create an account and session. After signing up, a welcome e-mail is sent to confirm your e-mail address.
Note: Registering an account can only be performed from residential IP. Proxying this endpoint will likely not work. Creating multiple/alternate accounts is not allowed as per the Terms of Service.
usernamestringThe username to use for the account. Must be between 3 and 20 characters long. Cannot start withuser_. May contain only letters, numbers, dashes and underscores. Must be unique.emailstringThe e-mail address to register. A valid unique non-disposable e-mail that can receive mail is required.passwordstringThe password to use for the account. Must be at least 15 characters, or 8 characters if it contains a mix of letters, numbers and symbols.- Returns:
Promise<Cloudnode.ApiResponse<{session: string}>>Session token. Also returned inSet-Cookieheader. - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "IP_REJECTED"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get newsletter
idstringA newsletter ID.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Newsletter>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
List newsletters
limitnumberThe number of newsletters to return per page. No more than 50. Default:10pagenumberThe page number. No more than 2³² (4294967296). Default:1- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.Newsletter[]>>> - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Create a project. Requires token with scope projects.create.own.
namestringProject name. Max 255 characters.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Project>> - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Delete a project. Requires token with scope projects.delete.own.
idstringProject ID.- Returns:
Promise<Cloudnode.ApiResponse<void>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get a project. Requires token with scope projects.get.own.
idstringProject ID.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Project>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
List projects. Requires token with scope projects.get.own.
limitnumberThe number of projects to return per page. No more than 100. Default:20pagenumberThe page number. No more than 2³² (4294967296). Default:1- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.Project[]>>> - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Update a project. Requires token with scope projects.update.own.
idstringProject ID.namestringProject name. Max 255 characters.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Project>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Subscribe to newsletter
newsletterstringThe ID of the newsletter to subscribe to.emailstringSubscriber's email address.dataRecord<string, string | number | boolean>Additional data that this newsletter requires.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.NewsletterSubscription>> - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "CONFLICT"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Unsubscribe from newsletter
idstringThe ID of the subscription to revoke.- Returns:
Promise<Cloudnode.ApiResponse<void>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get newsletter subscription
idstringThe ID of the subscription to get.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.DatedNewsletterSubscription>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
List newsletter subscriptions. Requires token with scope newsletter.subscriptions.list.own.
limitnumberThe number of subscriptions to return per page. No more than 50. Default:10pagenumberThe page number. No more than 2³² (4294967296). Default:1- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.DatedNewsletterSubscription[]>>> - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Create token. Requires token with scope tokens.create.own.
permissionsstring[]List of permissions to grant to the token. You must already have each of these permissions with your current token.lifetimenumberLifetime of the token in seconds. If null, the token will never expire (not recommended). Max: 31560000 (1 year). Min: 60 (1 minute).notestringA user-specified note to label the token. Max length: 2⁸ (256) characters.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Token>> - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get token details. Requires token with scope tokens.get.own.
idstring | "current"The ID of the token to get. Specifycurrentto get information about the token that was used to authenticate the request.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Token>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get a recent request by ID. Requires token with scope tokens.get.own.requests.
idstring | "current"The ID of the token. Specifycurrentto get information about the token that was used to authenticate the request.requeststringThe ID of the request.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Request>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "MODIFICATION_NOT_ALLOWED"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
List tokens of user. Requires token with scope tokens.list.own.
limitnumberThe number of tokens to return per page. No more than 50. Default:10pagenumberThe page number. No more than 2³² (4294967296). Default:1internalanyInternal tokens are returned as well if this parameter is present.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.PartialToken[]>>> - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Get list of recent requests made with the token. Requires token with scope tokens.get.own.requests.
idstring | "current"The ID of the token. Specifycurrentto get information about the token that was used to authenticate the request.limitnumberThe number of requests to return per page. No more than 50. Default:10pagenumberThe page number. No more than 2³² (4294967296). Default:1- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.PaginatedData<Cloudnode.ShortRequest[]>>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely. Requires token with scope token.refresh.
idstring | "current"The ID of the token to refresh. Specifycurrentto refresh the token that was used to authenticate the request.- Returns:
Promise<Cloudnode.ApiResponse<Cloudnode.Token>> - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
Revoke token. Requires token with scope tokens.revoke.own.
idstring | "current"The ID of the token to revoke. Specifycurrentto revoke the token that was used to authenticate the request.- Returns:
Promise<Cloudnode.ApiResponse<void>> - Throws:
Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"} - Throws:
Cloudnode.Error & {code: "INVALID_DATA"} - Throws:
Cloudnode.Error & {code: "MODIFICATION_NOT_ALLOWED"} - Throws:
Cloudnode.Error & {code: "UNAUTHORIZED"} - Throws:
Cloudnode.Error & {code: "NO_PERMISSION"} - Throws:
Cloudnode.Error & {code: "RATE_LIMITED"} - Throws:
Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"} - Throws:
Cloudnode.Error & {code: "MAINTENANCE"}
A client library for the Cloudnode API, written in TypeScript. Documentation
An API response. This class implements the interface provided as T and includes all of its properties.
_responseCloudnode.RawResponseRaw API response
Raw API response
headersRecord<string, string>The headers returned by the server. (read-only)okbooleanA boolean indicating whether the response was successful (status in the range200–299) or not. (read-only)redirectedbooleanIndicates whether or not the response is the result of a redirect (that is, its URL list has more than one entry). (read-only)statusnumberThe status code of the response. (read-only)statusTextstringThe status message corresponding to the status code. (e.g.,OKfor200). (read-only)urlstringThe URL of the response. (read-only)
API client compatibility status
COMPATIBLE"compatible"Fully compatible (API patch version may differ)OUTDATED"outdated"Compatible, but outdated (i.e. existing APIs will work, but you are missing out on new features).INCOMPATIBLE"incompatible"API has implemented breaking changes which are not compatible with this client.
Details about your account
idstringYour user IDpasswordbooleanWhether you have a password setgroupstringThe name of your permission grouppermissionsstring[]A list of all permission that you have access toidentityAccountIdentity | nullPersonal information associated with your account. Requiresaccount.details.identityto see. Maybe be null if the account is anonymised or you don't have permission to access the account identity.emailPrimaryEmail | nullYour current primary account e-mail address. Requiresaccount.details.emailto see. Maybe be null if you don't have a primary e-mail address or you don't have permission to access the account's e-mail address.
An e-mail address you have added to your account
idstringThe ID of the e-mail addressaddressstring | nullYour e-mail address. May ben null if anonymised.verifiedbooleanWhether this e-mail address has been verifiedprimarybooleanWhether this e-mail address is your primary e-mail addressaddedDateThe date and time when this e-mail address was added to your account
Personal information associated with your account
A newsletter subscription with a creation date
idstringThe ID of the subscription. Can be used to unsubscribe.emailstringThe email address of the subscribernewsletterstringThe ID of the newsletter that was subscribed todateDateThe date the subscription was created
Your current primary account e-mail address with a timestamp of when it was added to your account
idstringThe ID of the e-mail addressaddressstring | nullYour e-mail address. May ben null if anonymised.verifiedbooleanWhether this e-mail address has been verifiedaddedDateThe date and time when this e-mail address was added to your account
An API error response.
messagestringA human-readable description of this errorcodestringError codefieldsRecord<string, string | Record<string, string>>Affected request fields. The key is the name of the input parameter (e.g. from the request body or query string) and the value is a human-readable error message for that field.
A newsletter that you can subscribe to
idstringThe unique identifier for this newsletternamestringThe name of this newsletterdataRecord<string, NewsletterData>Additional data that is required to subscribe to this newsletter
A data field that is required to subscribe to this newsletter
namestringThe name of the fielddescriptionstring | undefinedDescription of the fieldtype"string" | "number" | "boolean"The type of datarequiredbooleanWhether this field is required
Your subscription to a newsletter
idstringThe ID of the subscription. Can be used to unsubscribe.emailstringThe email address of the subscribernewsletterstringThe ID of the newsletter that was subscribed to
API client options
baseUrlstringThe base URL of the APIautoRetrybooleanWhether to automatically retry requests that fail temporarily. If enabled, when a request fails due to a temporary error, such as a rate limit, the request will be retried after the specified delay.maxRetryDelaynumberThe maximum number of seconds that is acceptable to wait before retrying a failed request. This requiresautoRetryto be enabled.maxRetriesnumberThe maximum number of times to retry a failed request. This requiresautoRetryto be enabled.
Paginated response
itemsT[]The page itemstotalnumberThe total number of itemslimitnumberThe number of items per pagepagenumberThe current page number
A token, however, the permissions field is not included
idstringThe ID or key of the tokencreatedDateDate and time when this token was createdexpiresDate | nullDate and time when this token expires. Null if it never expires.internalstring | undefinedWhether this token is for internal use only, e.g. to power a session. In other words, an internal token is one that was not created by the client.metadataCloudnode.TokenMetadataAdditional metadata about this token
A permission node
permissionstringThe permission node stringdescriptionstringUser-friendly description of the permission nodenotestring | nullAdditional user-friendly information about the permission nodegroupstring | nullA group/category title that can be used to group permissions together
Your current primary account e-mail address
idstringThe ID of the e-mail addressaddressstring | nullYour primary e-mail address. May ben null if anonymised.verifiedbooleanWhether this e-mail address has been verified
An isolated group of servers
idstringThe ID of the projectnamestringProject nameuserstringID of the user that owns this project
A request
idstringThe ID of the requestmethodstringThe request method (e.g. GET, POST, HEAD, etc.scheme"http" | "https"The URL schemehoststringThe requested host nameurlstringThe request URL pathstatusnumberThe HTTP status code that was returned to this requestipstringThe IP address of the client that made the request (can be both IPv4 and IPv6)dateDateThe time when the request was receivedresponseTimenumberThe time in milliseconds that the request took to processhasEventsbooleanWhether any server-side error events occurred while processing this requestrequestHeadersRecord<string, string> | nullThe request headers that were receivedrequestBodystring | nullThe request body that was received (likely parsed and formatted as JSON)responseHeadersRecord<string, string> | nullThe headers that were returned by the serverresponseBody{type: "Buffer", data: number[]} | nullThe response body that was returned by the server in response to this request
Overview of a request
idstringThe ID of the requestmethodstringThe request method (e.g. GET, POST, HEAD, etc.scheme"http" | "https"The URL schemehoststringThe requested host nameurlstringThe request URL pathstatusnumberThe HTTP status code that was returned to this requestipstringThe IP address of the client that made the request (can be both IPv4 and IPv6)dateDateThe time when the request was receivedresponseTimenumberThe time in milliseconds that the request took to processhasEventsbooleanWhether any server-side error events occurred while processing this request
An authentication token
idstringThe ID or key of the tokencreatedDateDate and time when this token was createdexpiresDate | nullDate and time when this token expires. Null if it never expires.permissionsstring[]Permission scopes that this token holdsinternalstring | undefinedWhether this token is for internal use only, e.g. to power a session. In other words, an internal token is one that was not created by the client.metadataCloudnode.TokenMetadataAdditional metadata about this token
Token metadata