Self Help Documentation
< All Topics

API Basics

SPanel uses a REST API, which relies on POST related requests and JSON formatted responses from the API endpoint.
All API requests are performed on the API endpoint located inside SPanel’s directory.

Warning
The API endpoint is dependant on the branding url settings, so the name of the folder is subject to change to ‘hostpanel’ or ‘spanel’ (default) if the owner of the VM enables that feature from the admin interface.

Authentication

Authentication is performed using an API token generated from the SPanel Admin Interface. The API token is provided with the rest of the request inside the ‘token’ variable. Tokens can be Admin or Client based tokens, depending on how they are generated.

Admin based tokens have access to the functionality available inside the SPanel Admin interface. Requests to the API, which use an admin token should not provide the ‘accountuser’ field.

Client based tokens are generated with a client username and are limited to performing SPanel Client interface actions only for the username with which they are generated. On the time of authentication to the SPanel API, the account username is provided in the ‘accountuser’ field.

FieldTypeRequiredDescription
tokenstringYesAuth token generated from SPanel Admin Interface
accountuserstringNoAccount user if the token is user-specific

Parameters

Request calls require 1 additional parameters, ‘action’. It is dependant on the type of the token/user combination and is different for Admin and Client calls. Additional parameters might be required depending on the function executed. More info can be found in each function’s article.

FieldTypeRequiredDescription
actionstringYesThe category and function being executed
accountuserstringYes/NoThe accountuser parameter is required only when executing user functions. It contains the SPanel user account name to which the function will be performed.

Example

Output

Success

The above request will provide the following json output:

Error

Output errors always have a standard format, providing an array of error fields with the descriptive text provided for the corresponding issue.

Table of Contents