Skip to content

Change a cron job

PUT /v1/sites/{siteId}/cron-jobs/{jobId}

Replaces every setting of the job: send them all, as for adding one, with timeoutSeconds and enabled too (a paused job stays paused only with enabled: false). The same settings again are fine: the job is answered as it is.

The site must have finished installing and its server be running (409 site_unavailable, 409 server_unavailable). The schedule on the server changes in the same step: when the server can't be reached (502 server_unreachable), nothing is changed.

Scopes

The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).

sites:files
Files and logins. File Manager, WordPress logins, cron jobs, backup downloads and backup storage. Full access to the sites' code and data.

Headers

FieldType and description
Idempotency-Key

string 1 to 255 characters

A key of your own for this request, like a UUID: letters, digits and _ - : . Send the request again with the same key (after a timeout, say) and it's done only once. Keys are kept for 24 hours (see Idempotency).

Path parameters

FieldType and description
siteId Required

string

The site's id.

jobId Required

string

The cron job's id.

Request body

JSON, with these fields. Fields that aren't listed are refused.

FieldType and description
name Required

string 1 to 80 characters

The job's name, up to 80 characters.

type Required

string

What the job runs: wp_cli (a WP-CLI command), php (a PHP script in the site), url (calls an address, as a visitor would) or command (a shell command).

One of: wp_cliphpurlcommand

target Required

string 1 to 2,000 characters

What it runs, on one line (up to 2,000 characters), by type: a WP-CLI command (transient delete --expired; a leading wp is left out), a PHP script's path in the site that starts with / and its arguments (/wp-content/tasks/report.php --quiet), a full address starting with https:// or http://, or a shell command. It runs as the site's own user, in the site's folder.

schedule Required

string

When it runs: a cron schedule of five fields (minute, hour, day of month, month, day of week) in UTC, with numbers, *, ranges (1-5), steps (*/15) and lists (1,15). For example */15 * * * * (every 15 minutes) or 0 3 * * 0 (Sundays at 03:00 UTC).

timeoutSeconds Required

integer 60 to 7,200

How long a run may take, in seconds, before it's stopped: 60 (1 minute) to 7,200 (2 hours).

enabled Required

boolean

Whether it runs on its schedule. false: paused.

Example request

curl -X PUT "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/cron-jobs/4c1d2e3f-5a6b-4c7d-8e9f-0a1b2c3d4e5f" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Nightly clean-up",
  "type": "wp_cli",
  "target": "transient delete --expired",
  "schedule": "30 2 * * *",
  "timeoutSeconds": 900,
  "enabled": true
}'

Response

200 OK Returns the CronJob object in data.

The CronJob object's fields 10 fields
FieldType and description
id

string

The cron job's id.

siteId

string

The site it runs on.

name

string

The job's name.

type

string

What the job runs: wp_cli (a WP-CLI command), php (a PHP script in the site), url (calls an address, as a visitor would) or command (a shell command).

Known values: wp_cliphpurlcommand More can appear.

target

string

What it runs, by type: the WP-CLI command without wp (transient delete --expired), the PHP script's path in the site and its arguments (/wp-content/tasks/report.php --quiet), the address it calls, or the shell command.

schedule

string

When it runs: a cron schedule of five fields (minute, hour, day of month, month, day of week) in UTC, like 0 3 * * * (every day at 03:00 UTC).

timeoutSeconds

integer

How long a run may take, in seconds, before it's stopped (60 to 7,200).

enabled

boolean

Whether it runs on its schedule. false: paused (it can still be run by hand).

createdAt

string An ISO 8601 time, in UTC

When the job was added.

updatedAt

string An ISO 8601 time, in UTC

When it was last changed.

Example response

200 OK
{
  "data": {
    "id": "4c1d2e3f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
    "siteId": "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
    "name": "Nightly clean-up",
    "type": "wp_cli",
    "target": "transient delete --expired",
    "schedule": "30 2 * * *",
    "timeoutSeconds": 900,
    "enabled": true,
    "createdAt": "2026-11-02T09:14:05.000Z",
    "updatedAt": "2026-11-19T10:40:00.000Z"
  }
}

Errors

The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).

Status and codeWhen, and what to do
403 trial_locked

The site's server is on the free trial: WordPress sign-in, the File Manager and Cron Jobs switch on once it's kept.

Keep the server in the control panel: they switch on by themselves.

404 not_found

The resource doesn't exist, or isn't this account's.

Check the id. Ids of other accounts' resources answer the same way.

409 site_unavailable

The site isn't in a state that allows this (for example, it's still installing).

Wait until the site is active, then try again.

409 server_unavailable

The server isn't in a state that allows this (for example, it's off or still being set up).

Start the server, or wait until it's active, then try again.

409 server_restoring

The server is being restored, and nothing else can change it or its sites until that's done.

Wait until the restore finishes (the server's pendingAction is null again), then try again. A restore that stopped partway keeps pendingAction: "restore", with the server's lastError set, until our team has checked the server.

422 validation_failed

One or more fields are missing or wrong. fields names each one with what's wrong.

Correct the fields named in fields. Unknown fields are refused too.

502 server_unreachable

The server didn't answer, or didn't finish the request.

Check that the server is running, then try again in a minute.

Rate limit

Heavy requests: 20 a minute per token, 40 per account. More in Rate limits.

Added on .

Popular

API docs