CrownPanel API Overview

CrownPanel's API allows you to manage your VPS programmatically - including actions like power control, hostname changes, snapshot management, and more.

You can use the API with:

  • PHP scripts
  • CLI tools like curl
  • Monitoring systems
  • Custom control panels or dashboards

Ideal for automation, integration into management panels, or performing bulk operations across multiple VPS instances.


๐Ÿ“‹ VPS Task Log

Use this API call to retrieve the task history (e.g., boot, shutdown, reboot, etc.) for a specific VPS instance.

This helps track recent actions performed on your VPS.

๐Ÿ” Key(s) and variable(s) required for this call

Key Variable Description Required
API_KEY YOUR_API_KEY Replace YOUR_API_KEY with your actual API key provided in "Account Settings", under the API section. โœ… Yes
QUERY task_log Fixed value: must be "task_log". โœ… Yes
VMID YOUR_VMID The VMID of your VPS. Retrieve it from the List All VPSes API Call. โœ… Yes

Response examples

If your API_KEY is valid, you would get the following output,

Output

'[{"task_id":"1021627","task":"Shutdown","task_added_on":"2022-04-18 03:38:08","task_status":"1"},{"task_id":"1021626","task":"Reboot","task_added_on":"2022-04-18 03:31:36","task_status":"1"}]'

If your API_KEY is invalid, you would get the following output,

Output

'{"query_status":"Error","query":"verify","query_result":""}'

CURL Example

curl -d "API_KEY=API-KEY-HERE&QUERY=task_log&VMID=YOUR_VMID" -X POST https://api.crownpanel.com

๐ŸŒ Other Language Examples

If you prefer to use another language or environment, here are examples for PHP, Python and Node.js:

PHP Example
<?php
$url = "https://api.crownpanel.com";

$post = [
'API_KEY' => 'YOUR_API_KEY',
'QUERY' => 'task_log',
'VMID' => 'YOUR_VMID',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
$response = curl_exec($ch);
var_export($response);
?>
Python Example

โš™๏ธ Install (only once): Required to install necessary libraries before running the code.

pip install requests
import requests

url = "https://api.crownpanel.com"
data = {
    "API_KEY": "YOUR_API_KEY",
    "QUERY": "task_log",
    "VMID": "YOUR_VMID"
}

response = requests.post(url, data=data)
print(response.text)
Node.js Example

โš™๏ธ Install (only once): Required to install necessary libraries before running the code.

npm install axios
const axios = require('axios');
const qs = require('qs');

const data = qs.stringify({
  API_KEY: 'YOUR_API_KEY',
  QUERY: 'task_log',
  VMID: 'YOUR_VMID'
});

axios.post('https://api.crownpanel.com', data)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Need help? Visit our Support Portal or use our live chat.