Skip to main content

Running a backup job with the Backup API

Start a backup run on demand and check it's status.

O
Written by Omar Bashir

As well as running to their schedule, backup jobs can be started on demand through the API. That's handy if you want to take a backup at a particular point in your release process, rather than waiting for the next scheduled run.

This article walks through starting a run of a backup job and following it through to completion.

Before you start

You'll need two things to hand:

  • An API token

  • The ID of the backup job you want to run

Starting a run

First, ask Gearset to run the job now. Copy the following and run it, replacing the token and job ID with your own:

curl -X POST \
-H "Authorization: token <APIToken>" \
https://api.gearset.com/public/backup/jobs/<jobID>/backup-now

If all's well you'll get a 202 back with an empty response body. The 202 means we've accepted your request. The run hasn't necessarily started yet, so the next step is to go and check its status.

Checking the status of the run

To find out what became of your request, ask the job for its most recent run. Copy the following, replacing the token and job ID as before:

curl -H "Authorization: token <APIToken>" \
https://api.gearset.com/public/backup/jobs/<jobID>/runs/latest

You should get a response like this:

{"RunId":"5872d0a8-bc64-4766-bbee-8aefd4ee1e97",
"JobId":"263ba833-0bd6-4361-ab22-6ef7ca20b6e8",
"Status":"InProgress",
"StartTime":"2026-07-23T09:00:00Z"}

One thing to watch for: if you've only just asked us to run the job, this may still be describing the previous run, because the new one hasn't started yet. Check again after a few seconds delay.

The possible statuses are:

Status

Meaning

InProgress

The run is currently backing up your data.

Cancelling

The run is being cancelled.

Succeeded

The run completed. Binary data such as attachments may still be being backed up.

Failed

The run didn't complete. Check the job's run history for details

Cancelled

The run was cancelled before it completed.

And that's it

You've now used the Backup API to start a backup run and follow it through to completion.

Did this answer your question?