Create account cron job
Creates a cron job for the specified account from a schedule expression and a command. Returns the created cron job, including its uid, which is required to delete the cron job or fetch its output.
Creates a cron job for the specified account from a schedule expression and a command.
Returns the created cron job, including its uid, which is required to delete the cron job or fetch its output.
API Token authentication
u123456789Cron schedule expression (for example "0 2 * * *" runs daily at 02:00).
0 2 * * *Command to execute on the schedule.
php /home/u123456789/cleanup.phpSuccess response
Unique identifier of the cron job. Use it to delete the cron job or fetch its output.
cron_abc123Username of the account that owns the cron job.
u123456789Cron schedule expression.
0 2 * * *Command executed on the schedule.
php /home/u123456789/cleanup.phpUnauthenticated response
Validation error response
Error response
POST /api/hosting/v1/accounts/{username}/cron-jobs HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 65
{
"time": "0 2 * * *",
"command": "php /home/u123456789/cleanup.php"
}{
"uid": "cron_abc123",
"username": "u123456789",
"time": "0 2 * * *",
"command": "php /home/u123456789/cleanup.php"
}Last updated
Was this helpful?