Skip to main content

Getting a summary of your most recent backup run with the Backup API

Written by Valerio Chang

Once a backup job has run, you can ask the API what it actually backed up: for every object in the backup, how many records are stored and how many were added, changed, and deleted in that run. That's useful for confirming a run captured what you expected - for example, as an automated check after triggering a run in your release process.

This article walks through fetching the object breakdown for a job's latest run.

Before you start

You'll need two things to hand:

  • An API token

  • The ID of the backup job you're interested in

If you haven't run the job yet, see Running a backup job with the Backup API for how to start a run.

Getting the breakdown

Ask the job for the object breakdown of its most recent run. Copy the following and run it, replacing the token and job ID with your own:

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

You should get a response like this:

{
"RunId":"5872d0a8-bc64-4766-bbee-8aefd4ee1e97",
"JobId":"263ba833-0bd6-4361-ab22-6ef7ca20b6e8",
"Status":"Succeeded",
"StartTime":"2026-07-23T09:00:00Z",
"Objects":[
{
"ObjectName":"Account",
"TotalRecordCount":120455,
"NewRecordCount":12,
"ChangedRecordCount":40,
"DeletedRecordCount":3
},
{
"ObjectName":"Contact",
"TotalRecordCount":341092,
"NewRecordCount":0,
"ChangedRecordCount":0,
"DeletedRecordCount":0
}
]
}

Each entry in Objects describes one object that was backed up in the run:

Field

Meaning

ObjectName

The API name of the Salesforce object.

TotalRecordCount

How many records are stored for this object after the run.

NewRecordCount

Records added for this object in this run.

ChangedRecordCount

Records changed for this object in this run.

DeletedRecordCount

Records deleted for this object in this run.

Objects that were part of the backup but had no changes still appear, with zeros for new, changed, and deleted.

Waiting for the breakdown

The breakdown is only available once a run has finished backing up its data, so the Status field tells you whether the numbers are ready yet:

Status

What it means for the breakdown

InProgress

The run is still backing up. Objects isn't included, check again shortly.

Succeeded

The run completed and Objects contains the breakdown.

Failed

The run didn't complete, so there's no breakdown and Objects isn't included. Check the job's run history for details.

Cancelling

The run is being cancelled. Objects isn't included.

Cancelled

The run was cancelled before it completed. Objects isnt'

While a run is in progress or if it failed, the response has no Objects field at all - so check Status before reading it.

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

And that's it

You've now used the Backup API to see exactly what your most recent backup run captured, object by object.

Did this answer your question?