Common mistake here is assuming the OAuth client itself holds the division logic. It doesn’t. The client just gets the token. The division scoping happens when you actually make the API call.
You don’t restrict the client’s effective access by changing the client config. You restrict it by passing the divisionId in the header of every request. If you want to lock it down tighter, you’d need a middleware service or API Gateway policy to enforce that header, because Genesys Cloud won’t stop a valid token from hitting a different division if you pass the wrong ID.
Here’s how you do it with the Node.js SDK. You have to set the division ID on the request config, not the client creation:
const { PlatformClient } = require('@genesyscloud/genesyscloud');
const client = PlatformClient.create()
.setAccessToken('your_access_token_here');
// This is the key part. You specify the division ID per-request or globally for the client instance
const divisionId = 'div_1';
try {
// Fetching users in div_1 only
const users = await client.UsersApi.getUser({
divisionId: divisionId,
pageSize: 25
});
console.log(`Found ${users.entities.length} users in ${divisionId}`);
} catch (error) {
console.error('Failed to fetch users:', error);
}
If you’re using raw HTTP, just add x-gcc-divisions header:
curl -X GET "https://api.mypurecloud.com/api/v2/users?divisionId=div_1" \
-H "Authorization: Bearer your_access_token_here" \
-H "x-gcc-divisions: div_1"
The docs can be a bit light on the “why” here, but the pattern is consistent across almost all resource endpoints. Users, Queues, Wrappers-they all respect the divisionId parameter or header.
Be careful with global resources like users vs users?divisionId=.... If you omit the division, you might get a 403 if the token isn’t global admin. Even if the token is global admin, you’ll get data from all divisions unless you filter. So for your BPO isolation, you really want that middleware layer checking the divisionId before it even hits Genesys. Otherwise, a dev with a global token can accidentally pull data from div_2 while working on div_1.
Also check the x-gcc-request-id header in your responses. Sometimes the division filter fails silently if the ID is malformed or doesn’t exist. The request ID helps you trace that in the support case if something acts up.