To use the API on behalf of your own organisation's Metry account, your can use a private access token. This token will provide read only access to the account for listing meters and getting consumption. It is also possible to manage streams and exports with this token.
It is suitable for the these scenarios:
- You are building an application only meant to be used internally.
- You are building an application for external customers but take care of setting up the collection in Metry for all your customers in your own Metry account.
- You want to quickly create an integration to demo it for a single customer with a less scalable and user friendly on-boarding.
Where to find the token
The token can be found when signed in to Metry by going to Settings ↠ Access token. If it has not already been created, click the button to create a new token.
Using a private access token
Provide the access token in the Authorization HTTP header when making a request. This is illustrated below using Curl.
curl -H "Authorization: Bearer YOUR_PRIVATE_ACCESS_TOKEN" https://app.metry.io/api/v2/meters
When not to use the private access token
If you are developing an application for third parties using Metry, asking the user to copy and paste their private access tokens should be avoided. Instead, read more here about integrating Metry for a third party application.