Python Quickstart: Viewing Call Records

The last component of this quickstart is retrieving your call logs using the Twilio REST API. You can find your logs by going to the the Logs page of your account on the Twilio web site, but getting access to this data programmatically is useful for automated reporting, or building other fully-featured systems like a voicemail application.

To get a list of recent calls, perform an HTTP GET request to the Calls resource URI.


Here is all the code you need to retrieve your list of calls.

This tutorial assumes you have a Python development environment with pip and the twilio-python helper library. Please see our post on [setting up your environment][devenvironment] if you need help installing those programs.
from import Client

# To find these visit

client = Client(account_sid, auth_token)

for call in client.api.account.calls.list():
    print("From: " + call.from_formatted + " To: " + call.to_formatted)

Then open the Terminal and run the above script to retrieve your list of calls:

$ python

For more information, check out the Twilio REST API documentation. If you have questions, comments, or suggestions about this quickstart, then give us a howl in the forums.

Next: Turn your browser into a phone with Twilio Client »

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.