[2024-10-09 16:49:42] Core(433): E_WARNING: Undefined array key "billic_lock_session_ip", File: /var/www/6ab474d6-cdc0-4240-941a-f8f83d769a20/public_html/Modules/Core.php
Documentation > Getting Started > API

API

VirtPanel has the ability to be managed easily by using an integrated API.

 

How to setup an API Key

This can be done by going to "Tools" -> "API Access". Then, enter the main IP address of the server your script is located and click on Add.

On the API Access page, get the randomly generated API Key. The IP Address is now ready to access the API.

 

Example Generic Usage (Applies to everything in the GUI)

!!! When using the apikey for API Access, POST fields are also accepted as GET !!!

List Virtual Machines

http://you.virtpanel.com/?vm&apikey=XXXXXX Returns: The HTML of the page as accessed normally though the GUI. Add Rule to Firewall (POST EXAMPLE) http://you.virtpanel.com/?security&apikey=XXXXXX&action=firewall&subaction=add&id=1&type=tcp&port=80&add=1

Returns: The HTML of the page as accessed normally though the GUI.

 

Special API Functions

List Accounts

/api/list_accounts.php?apikey=XXXXXX

Returns: A JSON encoded array of all your accounts.


List Server Hostnames

/api/list_servers.php?apikey=XXXXXX

Returns: A comma separated list of server hostnames.


List Servers

/api/list_servers.php?apikey=XXXXXX

Optional Arguments: type (currently only qemu)

Returns: A comma separated list of servers.


List Servers (Detailed)

/api/list_servers_full.php?apikey=XXXXXX

Optional Arguments: type (currently only qemu)

Returns: A JSON encoded array of all your servers with their settings.


List Server Pools

/api/list_pools.php?apikey=XXXXXX

Returns: A comma separated list of server pool names.


List Plans

/api/list_plans.php?apikey=XXXXXX

Returns: A comma separated list of plans.


List Templates

/api/list_templates.php?apikey=XXXXXX&type=qemu

Required Arguments: type (currently only qemu)

Returns: A comma separated list of templates. The format is: filename.lzo [128 XX] where XX is either B, KB, MB or GB.


One Time Login Auth Key

/api/login_auth.php?apikey=XXXXXX&username=XXXXXXX

Required Arguments: username (the account username)

Returns: The plain key.

Explanation: The end user should be logged into the panel by accessing http://you.virtpanel.com/?login&auth=XXXXXXXXX where XXXXXXX is the key returned from the API. The key can only be used once and lasts for 60 seconds after generation.


Get Account Details

/api/get_vm.php?username=XXXXXX

Required Arguments: username (the account username)

Returns: A JSON encoded array of the single account.


Get Account Logs

/api/get_vm_logs.php?username=XXXXXX

Required Arguments: username (the account username)

Returns: A JSON encoded array of the action logs.

 

Get Task History

/api/get_vm_tasks.php?username=XXXXXX

Required Arguments: username (the account username)

Returns: A JSON encoded array of the task history.
 


Get Account IP Addresses

/api/get_ip.php?username=XXXXXXX

Required Arguments: username (the account username)

Returns: A comma separated list of IP addresses that the account has been assigned.




Next: Getting Started » Check if disk I/O throttling is supported by running kernel
Previous: Getting Started » Add an OS template

Testimonials