Cron

Endpoints for managing cron jobs.

Admins see every cron job on the server. Non-admin users see only their own.

List Cron Jobs

GET /api/v1/cron

Scope: read:cron

Query Parameters

Parameter Type Description
page integer Page number. See Pagination
limit integer Items per page. See Pagination

Response

{
    "data": [
        {
            "id": 2,
            "user_id": 2,
            "name": "Daily Backup",
            "schedule": "0 2 * * *",
            "command": "date",
            "run_as": "www-data",
            "is_active": true,
            "created_at": "2026-10-19T11:05:06Z"
        }
    ],
    "pagination": {
        "page": 1,
        "limit": 25,
        "total": 1,
        "total_pages": 1
    }
}
Field Type Description
id integer Cron job ID
user_id integer ID of the owning panel user
name string Job name
schedule string Standard cron expression (minute hour day month weekday)
command string Shell command that runs
run_as string System user the command runs as
is_active boolean true if enabled, false if disabled
created_at string (RFC 3339) Creation timestamp

Example

curl -H "Authorization: Bearer $TOKEN" \
  "https://panel.example.com/api/v1/cron?page=1&limit=25"

Get Cron Job

GET /api/v1/cron/{id}

Scope: read:cron

Path Parameters

Parameter Type Description
id integer Cron job ID

Response

Same shape as a single item in the list response, wrapped in data:

{
  "data": {
    "id": 2,
    "name": "Daily Backup",
    ...
  }
}

Errors

Code Status Condition
not_found 404 Job does not exist
forbidden 403 Job belongs to another user
invalid_request 400 id is not a valid integer

Example

curl -H "Authorization: Bearer $TOKEN" \
  https://panel.example.com/api/v1/cron/2

Create Cron Job

POST /api/v1/cron

Scope: write:cron

Request Body

{
    "name": "Daily Backup",
    "command": "/usr/local/bin/backup.sh",
    "schedule": "0 2 * * *",
    "run_as": "www-data"
}
Field Type Required Description
name string Yes Job display name
command string Yes Shell command to execute
schedule string Yes 5-field cron expression
run_as string Admin: yes. User: no System user to run as. Non-admin users cannot set this; it defaults to the web server user

Response

The created cron job, wrapped in data:

{
    "data": {
        "id": 3,
        "user_id": 1,
        "name": "Daily Backup",
        "schedule": "0 2 * * *",
        "command": "/usr/local/bin/backup.sh",
        "run_as": "www-data",
        "is_active": true,
        "created_at": "2026-10-19T11:10:00Z"
    }
}

The system crontab is updated immediately after creation.

Errors

Code Status Condition
invalid_request 400 A required field is missing, or the schedule is invalid

Example

curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Daily Backup",
    "command": "/usr/local/bin/backup.sh",
    "schedule": "0 2 * * *",
    "run_as": "www-data"
  }' \
  https://panel.example.com/api/v1/cron

Update Cron Job

PATCH /api/v1/cron/{id}

Scope: write:cron

All fields are optional. Only supplied fields are updated.

Path Parameters

Parameter Type Description
id integer Cron job ID

Request Body

{
    "name": "Renamed Job",
    "schedule": "0 3 * * *"
}

Any combination of name, command, schedule, and run_as can be included. Fields not in the body are left unchanged.

Response

The updated cron job, wrapped in data. Same shape as a single item in the list response.

Errors

Code Status Condition
not_found 404 Job does not exist
forbidden 403 Job belongs to another user
invalid_request 400 A supplied field is invalid

Example

curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"schedule": "0 3 * * *"}' \
  https://panel.example.com/api/v1/cron/3

Delete Cron Job

DELETE /api/v1/cron/{id}

Scope: write:cron

Path Parameters

Parameter Type Description
id integer Cron job ID

Response

{
    "data": {
        "status": "ok"
    }
}

The system crontab is updated immediately after deletion.

Errors

Code Status Condition
not_found 404 Job does not exist
forbidden 403 Job belongs to another user

Example

curl -X DELETE \
  -H "Authorization: Bearer $TOKEN" \
  https://panel.example.com/api/v1/cron/3
Last updated: October 19, 2026