Multi Account Level API Access
Members of our Agency Plan have a the ability to access all of their sub accounts through Calltrackingmetrics API. In this walkthrough we will show you how to integrate with our api and query multiple accounts using curl.
To get started you will first need to enable api access on your agency account by clicking on the settings tab in the top heading bar. Under the settings tab, click on Agency Settings.
Under Agency Access, click the button that says Enable API Access under the API Access group. Once clicked, the screen will reveal a settings panel as shown below:
Here you will be given access credentials for your api request as an agency plan. By clicking the ‘show secret key’ link, it will reveal an additional key to be used with your access key. Both will be needed to make requests and access multiple accounts as an agency plan member.
There are two ways of authorizing API requests. The first is by passing both the access and secret key per request as shown below:
The second is by first authorizing your agency account then returning a session token. This session token will be used in place of passing your agency Access and Secret keys. This approach is preferable when you would like to share access for a limited time (30 days).
To do this we will need to create a session token that will allow us to access our accounts. You can try this out in your terminal using curl like so:
Hit enter and you should see a response similar to what is posted below:
Notice above we have outlined the token parameter to the JSON response. The value to this key pair will allow you to access multiple accounts without having to provide account level credentials per request.
Let’s try out this requests to see if we are able to access our accounts through the API. Cut and paste the curl command into your terminal after filling in the account related sections.
After running this command, you should see a JSON structure with a list off of all our sub accounts. Within this array list, you can iterate and display the results onto a web page. When a user clicks the web page individual calls can be made per account by taking the account id and passing your auth_token with each request.
Below is a curl example of how to do such: