Error Medic

How to Fix REQUEST_LIMIT_EXCEEDED and API Limits in Salesforce

Resolve the Salesforce REQUEST_LIMIT_EXCEEDED error. Learn to diagnose total API limits, fix concurrent request bottlenecks, and optimize bulk batch items.

Last updated:
Last verified:
1,336 words
Key Takeaways
  • The REQUEST_LIMIT_EXCEEDED error typically triggers when your org surpasses its 24-hour API limit or hits concurrent request thresholds.
  • Polling Salesforce too frequently from external systems is the leading root cause of rapid API limit exhaustion.
  • Quick fix: Implement exponential backoff in your API clients and migrate from REST API to the Bulk API 2.0 for data loads exceeding 2,000 records.
  • Combining multiple API calls into a single composite request can instantly slash your daily API usage and prevent concurrent request bottlenecks.
Salesforce API Limit Fix Approaches Compared
MethodWhen to UseImplementation TimeRisk Level
Composite API MigrationWhen making multiple related REST calls (e.g., creating Account and Contacts)Hours to DaysLow
Switch to Bulk API 2.0For large data migrations, batch jobs, or syncing >2,000 recordsDays to WeeksMedium
Implement Caching LayerRead-heavy integrations querying static or slow-changing dataWeeksMedium
Purchase Additional LimitsImmediate business blockage with no quick code-fix availableHours (via Account Exec)High (Financial)

Understanding the Error

Salesforce operates on a multi-tenant architecture, meaning resources are shared across many organizations. To ensure fair usage and prevent any single organization from monopolizing system resources, Salesforce enforces strict governor limits. One of the most common and disruptive limits encountered by enterprise integrations is the API request limit.

When you exceed these limits, Salesforce abruptly halts your integrations, throwing the dreaded REQUEST_LIMIT_EXCEEDED error. Depending on the exact limit breached, your application might receive variations of this error, such as TotalRequests Limit exceeded, Concurrent requests limit exceeded, or API batch items limit exceeded.

Exact Error Messages

Developers integrating with Salesforce typically encounter one of the following JSON responses when hitting a limit bottleneck:

1. Total 24-Hour Request Limit Exceeded:

[
  {
    "message": "TotalRequests Limit exceeded.",
    "errorCode": "REQUEST_LIMIT_EXCEEDED"
  }
]

This indicates that your organization has exhausted its rolling 24-hour allocation of API calls. Every API request counts against this limit, from REST to SOAP and Bulk API calls.

2. Concurrent Requests Limit Exceeded:

[
  {
    "message": "Concurrent requests limit exceeded.",
    "errorCode": "CONCURRENT_REQUESTS_LIMIT_EXCEEDED"
  }
]

This error occurs when you have too many long-running API requests executing simultaneously. For example, if you have multiple complex SOQL queries taking longer than 20 seconds to execute, Salesforce will throttle your connection to protect database performance.

3. API Batch Items Limit Exceeded:

[
  {
    "message": "Batch items limit exceeded. Maximum number of batch items is 2000.",
    "errorCode": "API_BATCH_ITEMS_LIMIT_EXCEEDED"
  }
]

This happens when using the Bulk API or Composite API and you attempt to process more records in a single batch than the platform allows.

Step 1: Diagnose the Root Cause

Before refactoring code, you must identify which system is consuming your API limits. In an enterprise environment, multiple integrations (ERP, Marketing Automation, custom web portals) connect to Salesforce simultaneously.

Check API Usage Reports: Navigate to Setup > Environments > System Overview in Salesforce. Here, you will see your API Usage for the last 24 hours. For a granular view, use the "API Usage Last 7 Days" report located in the Administrative Reports folder. This report breaks down API usage by user and client ID, allowing you to pinpoint the noisy neighbor.

Monitor the Sforce-Limit-Info Header: Salesforce includes a helpful HTTP header in every REST API response. You should log this header in your integration middleware to track consumption proactively: Sforce-Limit-Info: api-usage=25000/100000 This header tells you that you have used 25,000 out of your 100,000 daily limit.

Step 2: Fix Total Request Limit Exceeded

If you are hitting the daily REQUEST_LIMIT_EXCEEDED ceiling, you are fundamentally making too many network calls.

Actionable Fix A: Use the Composite API Instead of making five separate REST calls to create an Account, two Contacts, and an Opportunity, combine them into a single Composite API call. A composite request counts as a single API call against your daily limit, even if it contains up to 25 sub-requests.

Actionable Fix B: Stop Polling, Start Listening If your external application polls Salesforce every 5 minutes asking, "Are there new records?", you are burning through limits unnecessarily. Switch to an event-driven architecture using Salesforce Platform Events, Change Data Capture (CDC), or Outbound Messages. This shifts the paradigm: Salesforce will push data to your application only when a change occurs, reducing API usage to near zero for read operations.

Step 3: Fix Concurrent Requests Limit Exceeded

The CONCURRENT_REQUESTS_LIMIT_EXCEEDED error is distinct from daily limits. It indicates a performance bottleneck, usually caused by unoptimized SOQL queries or locked database rows.

Actionable Fix A: Optimize SOQL Queries If your API call executes a SOQL query that scans millions of records without a selective index, the request will remain open for an extended period. Ensure your WHERE clauses filter on indexed fields (like Id, Name, or fields explicitly marked as External IDs).

Actionable Fix B: Implement Retry Logic with Exponential Backoff When you receive a concurrent limit error, your application should not immediately retry the request. Immediate retries will only exacerbate the gridlock. Implement exponential backoff (e.g., wait 1 second, then 2 seconds, then 4 seconds) with jitter to gracefully handle traffic spikes.

Step 4: Fix API Batch Items Limit Exceeded

When you encounter API_BATCH_ITEMS_LIMIT_EXCEEDED in Salesforce, you are trying to stuff too much data into a single transaction.

Actionable Fix A: Respect Bulk API Chunking If using the standard REST API for collections, the limit is strictly 200 records per request. If using the Composite API, you are limited to 200 records per subrequest. Ensure your integration middleware slices data arrays into chunks of 200 before initiating the HTTP POST.

Actionable Fix B: Migrate to Bulk API 2.0 For data volumes exceeding a few thousand records, abandon the synchronous REST API entirely. Bulk API 2.0 handles chunking automatically. You simply upload a CSV file containing up to 100 million records, and Salesforce asynchronously processes the data, entirely bypassing standard synchronous governor limits and batch item bottlenecks.

Frequently Asked Questions

bash
#!/bin/bash
# Diagnostic script to check current Salesforce API Limits
# Requires a valid Salesforce Session ID / Access Token

SF_INSTANCE_URL="https://your-domain.my.salesforce.com"
ACCESS_TOKEN="your_oauth_access_token"
API_VERSION="v58.0"

echo "Fetching Salesforce Org Limits..."

curl -X GET "${SF_INSTANCE_URL}/services/data/${API_VERSION}/limits" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -H "Content-Type: application/json" | jq '.DailyApiRequests'

# Expected JSON output:
# {
#   "Max": 100000,
#   "Remaining": 98500
# }
E

Error Medic Editorial

Error Medic Editorial is a specialized team of Senior DevOps engineers, SREs, and Salesforce Architects dedicated to solving enterprise-grade integration bottlenecks and platform errors.

Sources

Related Guides