Is it possible to scope an OAuth client to specific divisions for multi-tenant BPO access?
I am building an async FastAPI proxy using httpx that serves multiple BPO clients. Each client operates in a distinct Genesys Cloud division. I want to use a single service account (Client Credentials flow) but restrict its permissions to only the relevant division to prevent cross-tenant data leakage.
Currently, my token acquisition looks like this:
async def get_gc_token(client_id: str, client_secret: str):
async with httpx.AsyncClient() as client:
response = await client.post(
"https://login.mypurecloud.com/oauth/token",
data={"grant_type": "client_credentials"},
auth=(client_id, client_secret)
)
return response.json()["access_token"]
I attempted to add a division_id parameter to the POST /oauth/token request body, but I received a 400 Bad Request with the message Invalid grant parameter: division_id.
My environment details:
- Python 3.11 with FastAPI and
httpx. - Genesys Cloud US1 region.
- Service account created via Admin UI with “Read Only” permissions on Conversations.
- Target divisions are separate for each BPO client.
Does the Client Credentials grant type support division-level scoping at the token issuance level? If not, what is the recommended programmatic way to filter resources by division in the subsequent API calls without hardcoding division IDs in the proxy logic?