Access the WSO2 Developer Platform Insights API¶
The Usage Insights page in the WSO2 Developer Platform Console displays data retrieved from the Insights API exposed over the Internet. However, in some scenarios, you may need to retrieve data from external systems and implement custom dashboards to display the data.
WSO2 Developer Platform provides a secure and user-friendly approach to accomplish this requirement. Follow the steps given below:
Become a member of the WSO2 Developer Platform System organization¶
-
Access the Developer Portal of the
WSO2 Developer Platform Systemorganization via the WSO2 Developer Platform Developer Portal and sign in using your preferred method. -
To obtain access to the
WSO2 Developer Platform Systemorganization, click Request Access.
Create an application and generate keys¶
To create an application and generate keys, follow the steps below:
-
To create a new application in the
WSO2 Developer Platform Systemorganization, click + Create Application. -
Enter a name for the application and click Create. This creates the application and takes you to the Overview page.
-
To subscribe to the Insights API via the newly created application, follow the steps below:
- In the left navigation menu, click Subscriptions.
- In the Subscription Management pane, click + Add APIs.
- Search for
Insightsand click Add.
-
To generate credentials for the application, follow the steps given below:
- In the left navigation menu, click Production under Credentials.
- Click Generate Credentials. WSO2 Developer Platform generates tokens and populates the Consumer Key and Consumer Secret fields in the Application Keys pane.
-
To specify an appropriate token expiry time for the application, follow the steps given below:
-
Execute the following cURL command to generate an access token:
curl --location --request POST 'https://sts.choreo.dev/oauth2/token' \ --header 'Authorization: Basic <BASE64_ENCODED_CONSUMER_KEY_AND_CONSUMER_SECRET_OF_YOUR_APP_HERE>' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'orgHandle=<YOUR_ORG_HANDLE_HERE>' \ --data-urlencode 'scope=apim:api_manage'Info
To obtain your organization handle, follow the steps given below:
- Go to the WSO2 Developer Platform Console and sign in using your preferred method.
- In the WSO2 Developer Platform Console, click your username in the top right corner.
- In the drop-down menu, click Settings.
- In the Organization pane, click Copy Handle.
You can use the generated token to access the Insights API exposed via https://choreocontrolplane.choreo.dev/93tu/insights/1.0.0/query-api.
The following is a sample cURL command to invoke the Insights API:
curl --location --request POST 'https://choreocontrolplane.choreo.dev/93tu/insights/1.0.0/query-api' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <TOKEN_HERE>' \ --data-raw '{"query":"query ($org: OrgFilter!) {listEnvironments(org: $org){id\n name}}","variables":{"org":{"orgId":"<ORG_UUID_HERE>"}}}'


