Sugam Manocha avatar image
Sugam Manocha asked Sugam Manocha answered

staying authenticated on multiple extensions in python to avoid rate limits

I'm trying to make create an internal data warehouse that collects every one of our user's call data on a nightly basis. My initial attempt took an absurd amount of time as I had to throttle the rate of API calls to avoid rate limits. I contacted dev support and was told I could make multiple API calls without encountering limits by staying authenticated on multiple extensions. I'm not sure how to stay authenticated on multiple extensions in python... using the python ringcentral module requires logging in with a username and pw, is there any way around this?

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered Phong Vu commented

To read all users' call data on a single API call, you can login (authenticate) your app with a super admin user (e.g. the default 101 extension), then read the call log at the account level (see the reference)

Now, if you need to login every time you call an API, you can implement the authentication this way:

from ringcentral import SDK
import json
from os import path

platform = rcsdk.platform()

def login():
    file = open("access-tokens.json",'w')

def read_calllog():
    platform = rcsdk.platform()
    file = open("access-tokens.json",'r')
    tokens =
    if platform.logged_in() == False:
        print ("token expired. Relogin")
        params = {
            'dateFrom': "2019-01-01T00:00:00.000Z",
            'type': ['Voice'],
            'direction': ['Outbound']
        resp = platform.get('/restapi/v1.0/account/~/call-log', params)
        for record in resp.json().records:
            print "Call type: " + record.type

if path.exists("access-tokens.json"):
    print("has token")
    print ("must login")

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Sugam Manocha avatar image Sugam Manocha commented ·

I have compiled data using the company call log API, but noticed it does not have specific user call logs. The call logs I'm looking for can be obtained on a user-by-user basis using the 'Get User Call Log Records' API call. The data recieved by this api call is much more thorough and has data points that cannot be found in the company call logs. However, doing it user- by-user through the super admin leads to me hitting the API limits.

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Sugam Manocha commented ·

In that case, either you can submit a support ticket to ask for increasing the rate limit. Or implement a timer to cause some delay to make sure you make 10 API calls per min. Let me know if you need help with using a timer.

0 Likes 0 ·
Sugam Manocha avatar image
Sugam Manocha answered

Thanks so much for your help @Phong Vu. If anyone is interested in an alternative solution, you can generate access tokens for multiple users, store these tokens in a database and use the tokens to make multiple simultaneous calls. That method worked beautifully for me. Hope it helps!

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys