Recordings

A Recording resource represents an individually recorded call. Recordings are generated when you use the Record TwiML verb. For more information, see the Recordings REST Resource documentation.

Audio Formats

Each Recording has a formats dictionary which lists the audio formats available for each recording. Below is an example formats dictionary.

{
    "mp3": "https://api.twilio.com/cowbell.mp3",
    "wav": "http://www.dailywav.com/0112/noFateButWhatWeMake.wav",
}

Listing Your Recordings

The following code will print out the duration for each Recording.

from twilio.rest import TwilioRestClient

# To find these visit https://www.twilio.com/user/account
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
for recording in client.recordings.list():
    print recording.duration

You can filter recordings by CallSid by passing the Sid as call. Filter recordings using before and after dates.

The following will only show recordings made before January 1, 2011.

from datetime import date
from twilio.rest import TwilioRestClient

# To find these visit https://www.twilio.com/user/account
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
for recording in client.recordings.list(before=date(2011,1,1)):
    print recording.duration

Deleting Recordings

The Recordings resource allows you to delete unnecessary recordings.

from twilio.rest import TwilioRestClient

# To find these visit https://www.twilio.com/user/account
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
client.recordings.delete("RC123")