Bot Analytics API returning 401 despite valid Multi-Org OAuth

Looking for advice on a recurring authentication failure when querying the /api/v2/analytics/conversations/details/queue endpoint via our AppFoundry integration. The standard OAuth token works for most API calls, but bot-specific analytics endpoints reject it with a 401. Is there a scope limitation for multi-org tenants that requires a separate token exchange for AI/Bot metrics? We are using SDK v4.2.

The root cause here is the OAuth token lacking the specific analytics:view scope required for bot conversation details, especially in multi-tenant environments where permissions are stricter. The standard app token often defaults to basic read permissions, which fails when hitting deeper analytics endpoints. In my recent JMeter tests against US1, I saw identical 401 responses when the token was generated without explicit bot analytics scopes. The fix involves regenerating the client credentials with the correct scope array. Ensure your OAuth client has analytics:view and bot:read scopes enabled in the Admin console under Integrations. If using a custom integration, update the token request payload to include these scopes explicitly. Here is a sample curl command to test the token generation with the correct scopes: curl -X POST https://api.mypurecloud.com/api/v2/oauth/token -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&scope=analytics:view bot:read". After getting the new token, retry the /api/v2/analytics/conversations/details/queue call. If it still fails, check if the user associated with the client has the necessary role permissions for bot analytics in the specific org. Multi-org setups sometimes require the token to be issued from the parent org or have cross-org permissions explicitly granted. Also, verify that the bot in question is actually published and has recorded conversations; querying an unpublished bot’s analytics often returns empty or unauthorized results due to data isolation. This approach resolved similar issues in my load testing scenarios where throughput was limited by authentication retries.

Is there a scope limitation for multi-org tenants that requires a separate token exchange for AI/Bot metrics?

Just add analytics:view to your OAuth scopes during the client creation step. That was the exact blocker we hit mapping Zendesk report permissions to Genesys Cloud!