REST API

Run cron jobs by triggering REST API endpoints from an external scheduler.

This method lets you use external services to manage and run your cron jobs through simple HTTP requests. It's flexible and works with many providers, so you can pick the scheduling tool that best fits your infrastructure.

CloudSelf-Hosted
✅ Supported✅ Supported

Add a Secret Key

Define a secret key that will be required for authentication when calling your cron endpoint.

Add it to your .env file:

.env
CRON_SECRET=your_secret_key

We recommend using a random string of at least 16 characters for better security.

Configure an External Scheduler

Next, configure a scheduler that will send HTTP requests to your cron endpoint. Most modern platforms allow you to set up scheduled jobs that call URLs at defined intervals. Some popular options include:

Run Frequency

You need to set schedule for every minute to ensure that your cron jobs are executed on time. Some schedulers may have limitations on minimum intervals, so choose one that fits your needs.

Authentication Required

Make sure to include the Authorization header with the value Bearer{" "} {your_key} in your requests, where {your_key} is the value of the CRON_SECRET variable you set in your .env file.

Example Request

Here's an example of how to set up a cron job that runs every minute using curl:

cURL Example
curl -X POST https://your-domain.com/api/cron \
  -H "Authorization {{your_key}}"

Replace https://your-domain.com/api/cron with your actual domain and {{your_key}} with the secret key you defined earlier.

Check Your Cron Jobs

You can check your cron jobs in AdminCP under Core => Advanced => Cron Jobs.

REST API - VitNode