Our APIs use an industry-standard authorization protocol known as the OAuth 2.0 specification. OAuth2 supports several grant types, each designed for a specific use case. m3ter uses the following two grant types:Documentation Index
Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt
Use this file to discover all available pages before exploring further.
- Authorization Code: Used for human login access via the m3ter Console.
- Client Credentials: Used for machine-to-machine communication and API access.
Create a Service User and add Permissions
Log in to the m3ter Console, go to Settings, Access then Service Users tab, and create a Service User. To enable API calls, grant the user Administrator permissions.
Generate Access Keys
In the Console, open the Overview page for the Service User by clicking on the name. Generate an Access Key id and Api Secret. Make sure you copy the Api Secret because it is only visible at the time of creation. See Service Authentication for detailed instructions and an example.
Obtain a Bearer Token using Basic Auth
We implement the OAuth 2.0 Client Credentials Grant authentication flow for Service User Authentication. Submit a request to the m3ter OAuth Client Credentials authentication flow, using your concatenated Access Key id and Api Secret to obtain a Bearer Token for your Service User. See examples below.
cURL Example
- Open your terminal or command prompt.
- Use the following
cURLcommand to obtain a Bearer Token:
your_access_key_id and your_api_secret with your actual Access Key id and Api Secret.
- Run the command, and if successful, it will return a JSON response containing the Bearer Token. The response will look like this:
"access_token") for subsequent API calls to m3ter.
Python Example
- Install the
requestslibrary if you haven’t already:
- Use the following Python script to obtain a Bearer Token:
your_access_key_id and your_api_secret with your actual Access Key id and Api Secret.
- Run the script, and if successful, it will print the Bearer Token. You can then use this Bearer Token for subsequent API calls to m3ter.