Monitor your API Limits

Monitor your API limits

One Salesforce CLI command prints over 50 org limits — daily API requests, async Apex executions, bulk API batches, storage — with the maximum and remaining allocation for each.

bash
sf org list limits --json

Simple, yet powerful command for displaying limits in your org. It returns over 50 different limits like: Daily Api Requests, Daily Async Apex Executions, Daily Bulk Api Batches, Daily Scratch Orgs, Single Email, Package 2 Version Creates, File Storage MB and Data Storage MB.

This is how sample output looks like

json
{
  "status": 0,
  "result": [
    {
      "name": "ActiveOrgSnapshots",
      "max": 80,
      "remaining": 79
    },
    {
      "name": "ActiveScratchOrgs",
      "max": 80,
      "remaining": 36
    },
    {
      "name": "AnalyticsExternalDataSizeMB",
      "max": 40960,
      "remaining": 40960
    }
  ],
  "warnings": []
}

What can you do with it?

Because the output is JSON, it is easy to script. A quick win is a scheduled job that formats the result as a usage report and posts it to a team channel:

Resource Usage Report — ActiveOrgSnapshots 79 / 80 (1%), ActiveScratchOrgs 36 / 80 (55%), AnalyticsExternalDataSizeMB 40960 / 40960 (0%), and so on for every limit the org reports.

Run it against production regularly — hitting the daily API request limit is one of the more disruptive ways to find out you were close to it.

Transcribed by hand from the original slide. Plain-text version of the whole catalog