Recording Storage minutes are charged directly to a parent account and the recording minutes are not shown in a subaccount's billing breakdown. Other nuances of recording storage billing include:
- The first 10,000 minutes of recording of a parent account(including recording from subaccounts) are free.
- The charge is $0.0005 per minute above 10,000 minutes.
- The total minutes are calculated as an average over a month across all subaccounts. Since the charge is calculated using the average recording durations across the entire month, the value will not be available in console until the end of the month.
These nuances make it challenging to find an exact value to charge a specific subaccount. You can however calculate the current recording usage for a subaccount by following these steps:
- Pull data from the Recordings List resource of the subaccount
- Filter by the "Completed" status
- Round all recording minutes up to the next minute
- Sum the number of minutes of all of the recordings
Example NodeJS Script
Below is an example Node.js script that incorporates the above 4 steps and displays the total minutes used by a specific account.
// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
let count = 0
client.recordings.list({status:"completed" })
.then(recordings => recordings.forEach(function(r){
let minutes = Math.ceil(parseInt(r.duration, 10)/60)
count= count + minutes
}))
.then(r => console.log("Recordings total minutes: ", count))
*Note: Make sure to use the account sid and auth token for the specific subaccount
If you've never run a NodeJS script before, here's a few articles to help get you started: