Scheduled Tasks
Manage automated server tasks including backups, restarts, command execution, and custom schedules.
List Schedules
Retrieve all scheduled tasks for a server.
GET /api/client/servers/{server}/schedules
URL Parameters
Parameter | Type | Description |
---|---|---|
server | string | Server identifier (UUID or short ID) |
Example Request
- cURL
- JavaScript
- Python
- PHP
- Go
- Java
- C#
- Ruby
GET /api/client/servers/{server}/schedules
curl "https://your-panel.com/api/client/servers/d3aac109/schedules" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json"
Node.js
const axios = require('axios');
const serverId = 'd3aac109';
const response = await axios.get(`https://your-panel.com/api/client/servers/${serverId}/schedules`, {
headers: {
'Authorization': 'Bearer ptlc_YOUR_API_KEY',
'Accept': 'Application/vnd.pterodactyl.v1+json',
'Content-Type': 'application/json'
}
});
console.log('Server schedules:', response.data.data);
Python
import requests
server_id = 'd3aac109'
headers = {
'Authorization': 'Bearer ptlc_YOUR_API_KEY',
'Accept': 'Application/vnd.pterodactyl.v1+json',
'Content-Type': 'application/json'
}
response = requests.get(f'https://your-panel.com/api/client/servers/{server_id}/schedules', headers=headers)
print('Server schedules:', response.json()['data'])
PHP
<?php
$serverId = 'd3aac109';
$client = new GuzzleHttp\Client();
$response = $client->get("https://your-panel.com/api/client/servers/{$serverId}/schedules", [
'headers' => [
'Authorization' => 'Bearer ptlc_YOUR_API_KEY',
'Accept' => 'Application/vnd.pterodactyl.v1+json',
'Content-Type' => 'application/json'
]
]);
$data = json_decode($response->getBody(), true);
print_r($data['data']);
?>
Go
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
serverId := "d3aac109"
url := fmt.Sprintf("https://your-panel.com/api/client/servers/%s/schedules", serverId)
client := &http.Client{}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer ptlc_YOUR_API_KEY")
req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println("Server schedules:", result["data"])
}
Java
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String serverId = "d3aac109";
String url = String.format("https://your-panel.com/api/client/servers/%s/schedules", serverId);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer ptlc_YOUR_API_KEY")
.header("Accept", "Application/vnd.pterodactyl.v1+json")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Server schedules: " + response.body());
C#
using System.Net.Http;
using System.Threading.Tasks;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer ptlc_YOUR_API_KEY");
client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json");
string serverId = "d3aac109";
var response = await client.GetAsync($"https://your-panel.com/api/client/servers/{serverId}/schedules");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine("Server schedules: " + content);
Ruby
require 'net/http'
require 'json'
server_id = 'd3aac109'
uri = URI("https://your-panel.com/api/client/servers/#{server_id}/schedules")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer ptlc_YOUR_API_KEY'
request['Accept'] = 'Application/vnd.pterodactyl.v1+json'
request['Content-Type'] = 'application/json'
response = http.request(request)
data = JSON.parse(response.body)
puts "Server schedules: #{data['data']}"
Get Schedule Details
Retrieve detailed information about a specific schedule including all tasks.
GET /api/client/servers/{server}/schedules/{schedule}
URL Parameters
Parameter | Type | Description |
---|---|---|
server | string | Server identifier (UUID or short ID) |
schedule | integer | Schedule ID |
Example Request
- cURL
- JavaScript
- Python
- PHP
- Go
- Java
- C#
- Ruby
curl "https://your-panel.com/api/client/servers/d3aac109/schedules/2" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json"
const axios = require('axios');
const serverId = 'd3aac109';
const scheduleId = 2;
const response = await axios.get(`https://your-panel.com/api/client/servers/${serverId}/schedules/${scheduleId}`, {
headers: {
'Authorization': 'Bearer ptlc_YOUR_API_KEY',
'Accept': 'Application/vnd.pterodactyl.v1+json',
'Content-Type': 'application/json'
}
});
const schedule = response.data.attributes;
console.log(`Schedule: ${schedule.name}`);
console.log(`Cron: ${schedule.cron.minute} ${schedule.cron.hour} ${schedule.cron.day_of_month} ${schedule.cron.month} ${schedule.cron.day_of_week}`);
console.log(`Active: ${schedule.is_active}`);
console.log(`Tasks: ${schedule.relationships.tasks.data.length}`);
import requests
from datetime import datetime
server_id = 'd3aac109'
schedule_id = 2
headers = {
'Authorization': 'Bearer ptlc_YOUR_API_KEY',
'Accept': 'Application/vnd.pterodactyl.v1+json',
'Content-Type': 'application/json'
}
response = requests.get(f'https://your-panel.com/api/client/servers/{server_id}/schedules/{schedule_id}',
headers=headers)
schedule = response.json()['attributes']
print(f"Schedule: {schedule['name']}")
print(f"Cron: {schedule['cron']['minute']} {schedule['cron']['hour']} {schedule['cron']['day_of_month']} {schedule['cron']['month']} {schedule['cron']['day_of_week']}")
print(f"Active: {schedule['is_active']}")
print(f"Processing: {schedule['is_processing']}")
print(f"Last run: {schedule['last_run_at']}")
print(f"Next run: {schedule['next_run_at']}")
<?php
$serverId = 'd3aac109';
$scheduleId = 2;
$client = new GuzzleHttp\Client();
$response = $client->get("https://your-panel.com/api/client/servers/{$serverId}/schedules/{$scheduleId}", [
'headers' => [
'Authorization' => 'Bearer ptlc_YOUR_API_KEY',
'Accept' => 'Application/vnd.pterodactyl.v1+json',
'Content-Type' => 'application/json'
]
]);
$schedule = json_decode($response->getBody(), true)['attributes'];
echo "Schedule: " . $schedule['name'] . "\n";
echo "Cron: " . implode(' ', $schedule['cron']) . "\n";
echo "Active: " . ($schedule['is_active'] ? 'Yes' : 'No') . "\n";
echo "Processing: " . ($schedule['is_processing'] ? 'Yes' : 'No') . "\n";
echo "Last run: " . $schedule['last_run_at'] . "\n";
echo "Next run: " . $schedule['next_run_at'] . "\n";
?>
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
serverId := "d3aac109"
scheduleId := 2
url := fmt.Sprintf("https://your-panel.com/api/client/servers/%s/schedules/%d", serverId, scheduleId)
client := &http.Client{}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer ptlc_YOUR_API_KEY")
req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
schedule := result["attributes"].(map[string]interface{})
cron := schedule["cron"].(map[string]interface{})
fmt.Printf("Schedule: %s\n", schedule["name"])
fmt.Printf("Cron: %s %s %s %s %s\n",
cron["minute"], cron["hour"], cron["day_of_month"], cron["month"], cron["day_of_week"])
fmt.Printf("Active: %t\n", schedule["is_active"])
fmt.Printf("Processing: %t\n", schedule["is_processing"])
fmt.Printf("Last run: %s\n", schedule["last_run_at"])
fmt.Printf("Next run: %s\n", schedule["next_run_at"])
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.JsonNode;
String serverId = "d3aac109";
int scheduleId = 2;
String url = String.format("https://your-panel.com/api/client/servers/%s/schedules/%d", serverId, scheduleId);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer ptlc_YOUR_API_KEY")
.header("Accept", "Application/vnd.pterodactyl.v1+json")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
ObjectMapper mapper = new ObjectMapper();
JsonNode data = mapper.readTree(response.body());
JsonNode schedule = data.get("attributes");
JsonNode cron = schedule.get("cron");
System.out.println("Schedule: " + schedule.get("name").asText());
System.out.printf("Cron: %s %s %s %s %s\n",
cron.get("minute").asText(),
cron.get("hour").asText(),
cron.get("day_of_month").asText(),
cron.get("month").asText(),
cron.get("day_of_week").asText());
System.out.println("Active: " + schedule.get("is_active").asBoolean());
System.out.println("Processing: " + schedule.get("is_processing").asBoolean());
System.out.println("Last run: " + schedule.get("last_run_at").asText());
System.out.println("Next run: " + schedule.get("next_run_at").asText());
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer ptlc_YOUR_API_KEY");
client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json");
string serverId = "d3aac109";
int scheduleId = 2;
string url = $"https://your-panel.com/api/client/servers/{serverId}/schedules/{scheduleId}";
var response = await client.GetAsync(url);
var content = await response.Content.ReadAsStringAsync();
JObject data = JObject.Parse(content);
var schedule = data["attributes"];
var cron = schedule["cron"];
Console.WriteLine($"Schedule: {schedule["name"]}");
Console.WriteLine($"Cron: {cron["minute"]} {cron["hour"]} {cron["day_of_month"]} {cron["month"]} {cron["day_of_week"]}");
Console.WriteLine($"Active: {schedule["is_active"]}");
Console.WriteLine($"Processing: {schedule["is_processing"]}");
Console.WriteLine($"Last run: {schedule["last_run_at"]}");
Console.WriteLine($"Next run: {schedule["next_run_at"]}");
require 'net/http'
require 'uri'
require 'json'
server_id = 'd3aac109'
schedule_id = 2
uri = URI("https://your-panel.com/api/client/servers/#{server_id}/schedules/#{schedule_id}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer ptlc_YOUR_API_KEY'
request['Accept'] = 'Application/vnd.pterodactyl.v1+json'
request['Content-Type'] = 'application/json'
response = http.request(request)
schedule = JSON.parse(response.body)['attributes']
cron = schedule['cron']
puts "Schedule: #{schedule['name']}"
puts "Cron: #{cron['minute']} #{cron['hour']} #{cron['day_of_month']} #{cron['month']} #{cron['day_of_week']}"
puts "Active: #{schedule['is_active']}"
puts "Processing: #{schedule['is_processing']}"
puts "Last run: #{schedule['last_run_at']}"
puts "Next run: #{schedule['next_run_at']}"
Create Schedule
Create a new scheduled task for the server.
POST /api/client/servers/{server}/schedules
Request Body
Field | Type | Required | Description |
---|---|---|---|
name | string | Yes | Schedule name (max 255 characters) |
minute | string | Yes | Cron minute (0-59 or *) |
hour | string | Yes | Cron hour (0-23 or *) |
day_of_month | string | Yes | Cron day of month (1-31 or *) |
month | string | Yes | Cron month (1-12 or *) |
day_of_week | string | Yes | Cron day of week (0-6 or *) |
is_active | boolean | No | Enable schedule immediately (default: true) |
only_when_online | boolean | No | Only run when server is online (default: false) |
Example Request
- cURL
- JavaScript
- Python
- PHP
- Go
- Java
- C#
- Ruby
curl -X POST "https://your-panel.com/api/client/servers/d3aac109/schedules" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"name": "Daily Backup",
"minute": "0",
"hour": "3",
"day_of_month": "*",
"month": "*",
"day_of_week": "*",
"is_active": true,
"only_when_online": false
}'
const axios = require('axios');
const serverId = 'd3aac109';
const scheduleData = {
name: 'Daily Backup',
minute: '0',
hour: '3',
day_of_month: '*',
month: '*',
day_of_week: '*',
is_active: true,
only_when_online: false
};
const response = await axios.post(`https://your-panel.com/api/client/servers/${serverId}/schedules`, scheduleData, {
headers: {
'Authorization': 'Bearer ptlc_YOUR_API_KEY',
'Accept': 'Application/vnd.pterodactyl.v1+json',
'Content-Type': 'application/json'
}
});
const schedule = response.data.attributes;
console.log(`Created schedule: ${schedule.name} (ID: ${schedule.id})`);
console.log(`Next run: ${schedule.next_run_at}`);
import requests
server_id = 'd3aac109'
headers = {
'Authorization': 'Bearer ptlc_YOUR_API_KEY',
'Accept': 'Application/vnd.pterodactyl.v1+json',
'Content-Type': 'application/json'
}
schedule_data = {
'name': 'Daily Backup',
'minute': '0',
'hour': '3',
'day_of_month': '*',
'month': '*',
'day_of_week': '*',
'is_active': True,
'only_when_online': False
}
response = requests.post(f'https://your-panel.com/api/client/servers/{server_id}/schedules',
headers=headers, json=schedule_data)
schedule = response.json()['attributes']
print(f"Created schedule: {schedule['name']} (ID: {schedule['id']})")
print(f"Cron expression: {schedule['cron']['minute']} {schedule['cron']['hour']} {schedule['cron']['day_of_month']} {schedule['cron']['month']} {schedule['cron']['day_of_week']}")
print(f"Next run: {schedule['next_run_at']}")
<?php
$serverId = 'd3aac109';
$client = new GuzzleHttp\Client();
$scheduleData = [
'name' => 'Daily Backup',
'minute' => '0',
'hour' => '3',
'day_of_month' => '*',
'month' => '*',
'day_of_week' => '*',
'is_active' => true,
'only_when_online' => false
];
$response = $client->post("https://your-panel.com/api/client/servers/{$serverId}/schedules", [
'headers' => [
'Authorization' => 'Bearer ptlc_YOUR_API_KEY',
'Accept' => 'Application/vnd.pterodactyl.v1+json',
'Content-Type' => 'application/json'
],
'json' => $scheduleData
]);
$schedule = json_decode($response->getBody(), true)['attributes'];
echo "Created schedule: " . $schedule['name'] . " (ID: " . $schedule['id'] . ")\n";
echo "Cron: " . implode(' ', $schedule['cron']) . "\n";
echo "Next run: " . $schedule['next_run_at'] . "\n";
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
serverId := "d3aac109"
scheduleData := map[string]interface{}{
"name": "Daily Backup",
"minute": "0",
"hour": "3",
"day_of_month": "*",
"month": "*",
"day_of_week": "*",
"is_active": true,
"only_when_online": false,
}
jsonData, _ := json.Marshal(scheduleData)
url := fmt.Sprintf("https://your-panel.com/api/client/servers/%s/schedules", serverId)
client := &http.Client{}
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer ptlc_YOUR_API_KEY")
req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
schedule := result["attributes"].(map[string]interface{})
id := schedule["id"].(float64)
name := schedule["name"].(string)
nextRun := schedule["next_run_at"].(string)
fmt.Printf("Created schedule: %s (ID: %.0f)\n", name, id)
fmt.Printf("Next run: %s\n", nextRun)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String serverId = "d3aac109";
String jsonData = """
{
"name": "Daily Backup",
"minute": "0",
"hour": "3",
"day_of_month": "*",
"month": "*",
"day_of_week": "*",
"is_active": true,
"only_when_online": false
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(String.format("https://your-panel.com/api/client/servers/%s/schedules", serverId)))
.header("Authorization", "Bearer ptlc_YOUR_API_KEY")
.header("Accept", "Application/vnd.pterodactyl.v1+json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Schedule created: " + response.body());
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer ptlc_YOUR_API_KEY");
client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json");
string serverId = "d3aac109";
var scheduleData = new {
name = "Daily Backup",
minute = "0",
hour = "3",
day_of_month = "*",
month = "*",
day_of_week = "*",
is_active = true,
only_when_online = false
};
var json = JsonSerializer.Serialize(scheduleData);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync($"https://your-panel.com/api/client/servers/{serverId}/schedules", content);
var responseContent = await response.Content.ReadAsStringAsync();
JObject data = JObject.Parse(responseContent);
var schedule = data["attributes"];
Console.WriteLine($"Created schedule: {schedule["name"]} (ID: {schedule["id"]})");
Console.WriteLine($"Next run: {schedule["next_run_at"]}");
require 'net/http'
require 'json'
server_id = 'd3aac109'
schedule_data = {
name: 'Daily Backup',
minute: '0',
hour: '3',
day_of_month: '*',
month: '*',
day_of_week: '*',
is_active: true,
only_when_online: false
}
uri = URI("https://your-panel.com/api/client/servers/#{server_id}/schedules")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer ptlc_YOUR_API_KEY'
request['Accept'] = 'Application/vnd.pterodactyl.v1+json'
request['Content-Type'] = 'application/json'
request.body = schedule_data.to_json
response = http.request(request)
schedule = JSON.parse(response.body)['attributes']
puts "Created schedule: #{schedule['name']} (ID: #{schedule['id']})"
puts "Next run: #{schedule['next_run_at']}"
Success Response
{
"object": "server_schedule",
"attributes": {
"id": 12,
"name": "Daily Backup",
"cron": {
"day_of_week": "*",
"day_of_month": "*",
"hour": "3",
"minute": "0",
"month": "*"
},
"is_active": true,
"is_processing": false,
"only_when_online": false,
"last_run_at": null,
"next_run_at": "2023-10-21T03:00:00+00:00",
"created_at": "2023-10-20T16:45:00+00:00",
"updated_at": "2023-10-20T16:45:00+00:00",
"relationships": {
"tasks": {
"object": "list",
"data": []
}
}
}
}