403 on /api/v2/routing/queues with admin scope

Getting a 403 on GET /api/v2/routing/queues despite having routing:queue:view and routing:queue:edit. Auth token is fresh, curl works fine. What specific scope am I missing or is this a known API bug?

The issue isn’t the scope itself, but how you’re passing the token in the request. If curl works but your SDK doesn’t, you’re likely hitting a subtle difference in how the OAuth header is formatted or cached. Genesys Cloud’s API is strict about the Authorization: Bearer <token> header. Make sure there are no extra spaces or newlines in the token string before attaching it.

If you’re using the Python SDK, don’t manually construct the header. Let the PureCloudPlatformClientV2 handle it. Here’s the clean way to do it:

from purecloudplatformclientv2 import PureCloudPlatformClientV2, Configuration

# Initialize client with client_id and client_secret
config = Configuration(host="https://api.mypurecloud.com")
client = PureCloudPlatformClientV2(config)

# This handles the OAuth2 flow internally
client.login_client_credentials(
 client_id="your_client_id",
 client_secret="your_client_secret",
 grant_type="client_credentials"
)

routing_api = client.RoutingApi()
queues = routing_api.get_routing_queues()

for queue in queues.entities:
 print(f"{queue.id}: {queue.name}")

Also, check your Terraform state if you’re managing roles. Sometimes a role gets updated in the UI, but the Terraform config hasn’t been refreshed, leading to a mismatch in permissions for the service account. Run terraform plan to see if there’s drift in the genesyscloud_routing_userrole resource. If the service account is part of a group, ensure the group hasn’t been removed from a queue’s member list recently. That can cause weird 403s even if the user has the right scopes globally.

One more thing: if you’re using a custom role, verify that routing:queue:view is actually attached to it in the Genesys Cloud admin console. Sometimes the API returns a 403 if the role exists but the scope assignment is stale. Re-saving the role in the UI can kick the cache.