• Docs
  • Analyze
  • Observe and Analyze
  • Programmatic Access to Choreo Insights API

Programmatic Access to Insights API

The Insights page in the Choreo Console displays data fetched from the Insights API exposed over the Internet. However, in some scenarios, you may need to fetch data from external systems and implement custom dashboards to display this data.

Choreo provides a secure and user-friendly method to achieve this requirement. The steps are outlined below:

Become a member of the Choreo System organization

  1. Access the Developer Portal of the Choreo System organization via https://devportal.choreo.dev/choreosystem and proceed to sign in using your credentials.

  2. Click on Applications.

  3. To get access to the Choreo System organization, click Request Access.


Once you request access, you are automatically added as a member of the Choreo System organization.

Verify this by checking whether the Choreo System organization appears in your list of organizations.


Create an application and generate keys

To create an application and generate keys, follow the steps below:

  1. Click on the Applications link to create a new application in the Choreo System organization. Create-Application

  2. Enter a suitable name and create the application.


  3. To subscribe to the Insights API via the newly created application, click Subscriptions in the left navigator, and then click Add for the Insights API.


  4. To generate credentials for the application, click Production Keys -> OAuth 2.0 Tokens in the left navigator, and then click Generate Credentials. This generates a consumer key and secret for the created application.


  5. Specify a suitable token expiry time and click Update.


  6. Execute the following curl command to generate an access token:

    curl --location --request POST 'https://sts.choreo.dev/oauth2/token' \
    --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'


    To get your organization handle name, you must sign in to https://console.choreo.dev, go to Settings, and click Copy Handle.

    This token can then be used to access the Insights API exposed via https://choreocontrolplane.choreo.dev/93tu/insights/1.0.0/query-api.

    A sample curl command to invoke the Insights API is shown below.

    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>"}}}'


    When the token expires, you can generate a new token programmatically by making an API call to the token endpoint via the client credentials grant.

    If a token theft occurs, the relevant token can be revoked by making an API call to the revoke-endpoint.