Search code examples
twiliotwilio-apiusage-statistics

In Twilio how could I get the usage of only active phones


I was just wondering if there is any endpoint in the Twilio API to get the usage filtered by Active Phone Numbers.

I've been going through the docs but can't seem to find a solution other than checking the calls endpoint for each one of the phone numbers in my account which is not ideal.

If I check the usage endpoint and filter by category phone numbers since the account was opened it says I've had 300 phones so far, but I can't seem to find how many of those are active or not.

Updated

Also, is there a way to filter the usage per phone number? For example I'd like to see the usage for a specific phone number but I don't want to call the Calls endpoint I just want the Usage.


Solution

  • Twilio developer evangelist here.

    You can check how many currently active phone numbers you have with the Incoming Phone Numbers resource.

    I'm afraid there's no way to separate your usage records by phone number within the one account.

    However, you can do this by subaccount. If you are trying to measure different users' usage within your system then the best thing to do is to create subaccounts for each of those users. Your main account can still view usage records for all subaccounts, but the subaccounts can also be viewed individually.

    Let me know if that helps at all.