Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Track usage, costs, and application health for Twilio Programmable Voice


Learn how to track usage, costs, and application health for Twilio Programmable Voice by using the Twilio Console, making a GET request to the Twilio API's UsageRecord resource, or integrating with Datadog. You can use this guide to send notifications and track calls.

See Related reference documentation to learn more about the API resources used in this guide.

To learn how to track health and quality of your Twilio calls, see Voice Insights and the Reports API.


Track Twilio Programmable Voice usage and costs

track-twilio-programmable-voice-usage-and-costs page anchor

You can track the usage and costs for your Twilio Programmable Voice applications in the Twilio Console, with the Twilio API's UsageRecord resource, or with the Twilio Datadog integration. Check Resolving call log and call usage discrepancies for common issues and solutions.

Track usage and costs in the Twilio Console

track-usage-and-costs-in-the-twilio-console page anchor

To track the usage and costs for your Programmable Voice application in the Twilio Console, view the Usage and Spend section:

Twilio ConsoleLegacy Console
  1. In the left navigation of the Twilio Console, go to the Billing and Usage section.
  2. Click Usage and Spend.
  3. In the Usage Summary tab, expand Programmable Voice to see a breakdown of your usage and costs for your voice applications. You can use the filters to narrow results.

You can also set alert triggers to notify you by email or webhook when your application reaches a certain usage threshold:

Twilio ConsoleLegacy Console
  1. In the left navigation of the Twilio Console, go to the Billing and Usage section.
  2. Click Usage and Spend.
  3. Click the Usage Triggers tab.
  4. Click the Create Usage Trigger button.
  5. Complete the Create Usage Trigger form. Set the usage threshold and select the notification method (email or webhook).
  6. Click the Submit button to save your usage trigger.

Track usage and costs with the Twilio API

track-usage-and-costs-with-the-twilio-api page anchor

To pull usage and cost data for your voice applications programmatically, you can use the UsageRecords resource:

  1. Find your Account SID and Auth Token:

    Twilio ConsoleLegacy Console
    1. On the Twilio Console landing page(link takes you to an external page), under Let's get building, click API keys and Auth tokens.
    2. Click the Auth Tokens tab to find your Account SID and Auth Token. Copy these values for the next step.
  2. Set the environment variables for your Account SID and Auth Token.

    (warning)

    Improve security with API keys

    To better control access, use API keys instead of the Account SID and Auth Token when you deploy to production. To learn more, see Why you should use API keys.

    On Mac or Linux:

    1. Run the following commands to add your credentials as environment variables in a twilio.env file and source them. Replace ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with your Account SID and replace your_auth_token with your Auth Token.

      1
      echo "export TWILIO_ACCOUNT_SID='ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'" > twilio.env
      2
      echo "export TWILIO_AUTH_TOKEN='your_auth_token'" >> twilio.env
      3
      source ./twilio.env
    2. If you're committing code with Git, run the following command to add the twilio.env file to .gitignore to avoid uploading your credentials in plain text:

      echo "twilio.env" >> .gitignore

    On Windows command line (cmd.exe), run the following commands. Replace ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with your Account SID and replace your_auth_token with your Auth Token.

    1
    set TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    2
    set TWILIO_AUTH_TOKEN=your_auth_token

    To learn more, see Store your Twilio credentials safely.

  3. Make a GET request to the API endpoint for the desired time period and filters to retrieve usage and cost data for your voice applications. For example, to retrieve voice usage and cost data for the current month using cURL, you can make the following request:

    1
    curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Usage/Records/LastMonth.json?Category=calls&PageSize=20" \
    2
    -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

    For more info and examples, see Read multiple UsageRecord resources.

Track usage and costs with Datadog

track-usage-and-costs-with-datadog page anchor

To view Twilio usage and cost data alongside your other business metrics, you can use the Twilio Datadog integration to pull usage and cost data into your Datadog dashboard:

  1. Generate an API key and find your Account SID:

    Twilio ConsoleLegacy Console
    1. On the Twilio Console landing page(link takes you to an external page), under Let's get building, click API keys and Auth tokens.
    2. Click the API Keys tab.
    3. Click the Create API Key button and follow the prompts to generate a new API key. Copy the generated API key and secret and paste them in a temporary local file for use when you connect to Datadog.
    4. Copy your Account SID in the Twilio Console landing page(link takes you to an external page) under Let's get building. Paste it in the temporary local file.
  2. Follow the steps in the Twilio Datadog integration documentation(link takes you to an external page) to connect your Twilio account to Datadog using your Account SID, API key, and secret from the temporary local file.

After you connect your Twilio account to Datadog, you can view your Twilio usage and cost data in your Datadog Cloud Cost Management dashboard alongside your other business metrics.


Track Twilio Programmable Voice application health

track-twilio-programmable-voice-application-health page anchor

To track the health of your Twilio Programmable Voice applications, you can set alert triggers to notify you by email or webhook when application errors occur.

Twilio ConsoleLegacy Console
  1. In the left navigation of the Twilio Console, go to the Develop section.
  2. Click Troubleshoot > Alarms.
  3. Click the Create Alarm button.
  4. Complete the Create Alarm form. Set the alarm conditions and select the notification method (email or webhook).
  5. Click the Create alarm button to save your alarm.

Use cases for tracking usage, costs, and health with Twilio Programmable Voice

use-cases-for-tracking-usage-costs-and-health-with-twilio-programmable-voice page anchor

This guide applies to the following use cases:

Send voice notifications with Twilio Programmable Voice

send-voice-notifications-with-twilio-programmable-voice page anchor

You can use this guide to track the delivery costs and performance metrics of your voice notifications. For example, you can monitor billing thresholds to ensure your alert systems remain cost-effective.

To learn more advanced features that you can use with voice notifications, see Voice notifications.

Track calls with Twilio Programmable Voice

track-calls-with-twilio-programmable-voice page anchor

You can use this guide to analyze and break down phone call usage and operational expenses across your campaigns. This helps you identify which numbers or tracking resources generate the highest ROI or call volume.

To learn more advanced features that you can use with call tracking, see Voice call tracking.


After following this guide, you can monitor your Twilio Programmable Voice metrics programmatically and through external dashboards. You might also have created alert triggers to immediately notify your team by email or webhook when unexpected usage spikes or application errors occur.


Explore the following guides to build on what you've learned in this guide: