API rate limit exceeded when updating territory assignments via bulk operations

We’re running into 429 Too Many Requests errors when trying to update territory assignments for our sales team via the REST API after our cloud deployment last month. The bulk updates to territory assignments are failing consistently, causing significant delays in our territory updates. We need to reassign approximately 2,500 accounts across 15 territories weekly.

Our current approach uses a simple loop making individual API calls for each account update. We’re hitting API rate limit thresholds much faster than expected. The documentation mentions bulk update strategies, but we’re unclear on the optimal approach for territory management. Here’s our current failing code:

for account in accounts:
    response = requests.put(
        f"https://www.zohoapis.com/crm/v3/Accounts/{account['id']}",
        json={"Territory": new_territory_id}
    )

We’ve tried adding delays between calls, but that makes the process take hours. Has anyone implemented efficient retry logic for bulk territory updates in the cloud environment?

Consider using Zoho’s asynchronous bulk API for large operations. You submit the bulk job, get a job ID, then poll for completion status. This approach doesn’t count against your synchronous API rate limits and can process thousands of records efficiently. We use it for weekly territory realignments and it’s been rock solid.

Make sure you’re tracking your rate limit consumption. The API response headers include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. Monitor these values and implement throttling before you hit zero remaining calls. We built a rate limiter class that pauses execution when remaining calls drop below 10%.

You’re hitting rate limits because you’re making individual API calls. Zoho’s bulk API can handle up to 100 records per request. Switch to the bulk update endpoint and batch your 2,500 accounts into groups of 100. That reduces your API calls from 2,500 to 25, well within rate limits.

The 429 error includes a Retry-After header that tells you when to retry. Implement exponential backoff in your retry logic - start with the Retry-After value, then double it for each subsequent failure. Also check your API plan limits in Setup > Developer Space > API. Different Zoho editions have different rate limits.