Skip to content

Run a cron job now

POST /v1/sites/{siteId}/cron-jobs/{jobId}/actions/run

Starts a run of the job at once, besides its schedule (a paused job too). The answer is 202 while the run goes on (running: true), or 200 when it already ended; either way it's the first of the job's runs (GET /sites/{siteId}/cron-jobs/{jobId}/runs), with trigger: "manual".

One run of a job at a time: while one runs, from its schedule or by hand, this answers 409 already_running. The site must have finished installing and its server be running.

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.

Example request

curl -X POST "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/cron-jobs/4c1d2e3f-5a6b-4c7d-8e9f-0a1b2c3d4e5f/actions/run" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN"

Response

202 Accepted Returns the CronJobRunStarted object in data. It can also answer 200 OK.

The CronJobRunStarted object's fields 1 fields
FieldType and description
running

boolean

Whether the run is still going. false: it already ended, and it's the first of the job's runs.

Example response

202 Accepted
{
  "data": {
    "running": true
  }
}

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 already_running

The cron job is running now, so it wasn't started again.

Wait until it finishes (running is false in GET /v1/sites/{siteId}/cron-status), 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.

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