Genesys API 429 on bulk user updates

Running a script to update 500 users via POST /api/v2/users/{id}. Hitting 429 Too Many Requests after about 20 calls. How do I implement exponential backoff in Python requests without blocking the whole script?

You don’t actually need to write your own backoff logic for this. The genesys-cloud-nodejs-client SDK has a built-in retry mechanism that handles 429s and 503s automatically. It respects the Retry-After header sent by the Genesys Cloud API, which is crucial because the wait time can vary. If you’re stuck in Python, requests doesn’t have this out of the box, but urllib3 does.

Here is how you handle it in Node.js, which is where I spend most of my time. You just need to configure the PureCloudPlatformClientV2 with the right settings.

const { PureCloudPlatformClientV2 } = require('@genesyscloud/genesyscloud-nodejs-client');

const platformClient = PureCloudPlatformClientV2.create();

// Configure retries globally
platformClient.setRetryConfig({
 maxRetries: 5,
 initialRetryDelay: 1000, // 1 second
 maxRetryDelay: 30000, // 30 seconds
 retryOn429: true, // This is the key part
 retryOn5xx: true
});

// Then execute your bulk update logic
// Example:
// await platformClient.Users.updateUser(userId, body);

If you must use Python with requests, you’ll need to wrap your calls in a helper function using tenacity or manual loops. Don’t just sleep for a fixed time. Parse the Retry-After header. Genesys might tell you to wait 5 seconds or 60 seconds. Ignoring that header is a fast track to getting your IP throttled harder.

Also, consider batching. POST /api/v2/users is for single creation. For updates, PATCH is better, but there’s no bulk endpoint for user attributes. You’re stuck with serial calls. If you hit 20 calls and then 429, the API is telling you to slow down. The SDK handles this gracefully. If you’re doing this in a webhook or external service, make sure your OAuth token has the user:write scope. Missing scopes cause 403s, not 429s, but it’s a common mix-up when debugging auth issues.

The retry config above works for most SDKs too. Check the Python SDK docs for set_retry_config or similar. It’s usually there.

Stop hitting the API in a tight loop. Use the /api/v2/users/bulkupdate endpoint instead. It handles the batching server-side so you don’t have to manage retries or sleep timers in your script.