Getting a 403 Forbidden response when trying to fetch analytics data for a specific conversation ID, while the standard conversation endpoint returns the data just fine. This is confusing because both endpoints require the same conversations:view permission according to the docs.
Here’s the code snippet using the Python SDK:
from genesyscloud.analytics import AnalyticsApi
from genesyscloud.rest import ApiException
analytics_api = AnalyticsApi(api_client)
try:
# This works
conv = api_instance.get_conversation(conversation_id)
print(f"Found conversation: {conv.id}")
# This fails with 403
analytics_body = {
"groupBy": ["conversationId"],
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-10-31T23:59:59.999Z",
"queryType": "summary",
"filter": {
"conversationId": conv.id
}
}
analytics_result = analytics_api.post_analytics_conversations_details_query(body=analytics_body)
except ApiException as e:
print(f"Status: {e.status}, Reason: {e.reason}")
The error log shows:
Status: 403, Reason: Forbidden
I’ve checked the OAuth token scopes and they include analytics:query. The user account has the Analytics View role.
- Tried switching to the REST API directly using
curlwith the same token and got the same 403 error. - Verified the
dateFromanddateTofields are in ISO 8601 format and within the last 30 days.
The /api/v2/conversations endpoint returns the metadata instantly, but the analytics endpoint refuses to play nice. Is there a hidden permission or a specific queue association required for analytics queries? The docs don’t mention it. I’m stuck on this for two days.