I'm working with Dialogflow CX and need to access analytics data from outside Google Cloud, such as from Postman or a backend service.
While inspecting the Dialogflow CX Console network traffic, I found the following request being made:
https://europe-west3-dialogflow.clients6.google.com/v3alpha1/projects/{projectId}/locations/{location}/agents/{agentId}/analytics?endTime=2025年05月18日T07%3A00%3A00.000Z&pageSize=1680&startTime=2025年05月06日T07%3A00%3A00.000Z&trimOutputFields=true&key={key}
I tried replicating this request by generating a service account and using its credentials to obtain an access token. However, when I make the request (including the API key), I receive the following error:
{
"error": {
"code": 400,
"message": "The API key and the authentication credential are from different projects"
}
}
It seems the problem is related to the key parameter and that this endpoint may be restricted to use only from the Dialogflow Console.
My questions are:
Is there a supported way to access Dialogflow CX Analytics programmatically from outside Google Cloud (for example, using service account credentials)?
Can I get the same analytics data from BigQuery instead, and if so, how do I set that up?
Is there any configuration I need to adjust (like permissions) to make this work?
Thanks in advance for any guidance!
1 Answer 1
To answer your questions:
Is there a supported way to access Dialogflow CX Analytics programmatically from outside Google Cloud (for example, using service account credentials)?
No, there is no official, publicly documented API for directly accessing the aggregated analytics metrics shown in the Dialogflow CX console. The request URL you found is using v3alpha1 that can only be used by allowlisted projects.
Can I get the same analytics data from BigQuery instead, and if so, how do I set that up?
Yes, exporting Dialogflow CX interaction logs to Google BigQuery is the recommended and supported method. This provides raw, detailed conversation data (including full request/response JSONs) for custom analysis.
See this link for more details on how to set up.
Is there any configuration I need to adjust (like permissions) to make this work?
Yes, here are the permission you need:
For Dialogflow CX to export: The Dialogflow CX service agent needs the
Dialogflow Service Agentrole (roles/dialogflow.serviceAgent).For your external application to query BigQuery: Your service account needs
BigQuery Data ViewerandBigQuery Job Userroles. Ensure billing is enabled for your project.You may also try using a different version of the Dialogflow CX API since v3alpha1 only works in allowlisted projects.
1 Comment
Explore related questions
See similar questions with these tags.