Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Day Resource

The Day resource allows you to download the export file containing a single day's data for your account and the requested data type.

Export File Format

Day files are stored and returned as compressed (gzip) JSON files with one record per line. The properties of the JSON objects will match those of the corresponding resource in the Twilio REST API with the following exceptions:

  • price_units will not be present
  • api_version will not be present
  • error message will not be present (but error_code is)
  • uri and subresource_uris will not be present.
  • timestamps like date created, date updated and date sent are in UTC and ISO 8601 format.

Day properties

Resource Properties in REST API format
day
string Not PII

The ISO 8601 format date of the resources in the file, for a UTC day

size
integer Not PII

The size of the day's data file in bytes

create_date
string Not PII

The ISO 8601 format date when resources is created

friendly_name
string Not PII

The friendly name specified when creating the job

resource_type
string Not PII

The type of communication – Messages, Calls

Instance Properties in REST API format
redirect_to
url Not PII

Fetch a single day file

get
https://bulkexports.twilio.com/v1/Exports/{ResourceType}/Days/{Day}
Parameters
Parameters in REST API format
resource_type
Path
get string Not PII

The type of communication – Messages, Calls

day
Path
get string Not PII

The ISO 8601 format date of the resources in the file, for a UTC day

Example 1
        
        
        
        
        This will get a redirection to the day's file, once you know what days are available from the list of exported days.

        Fetch a single file for an exported day

        This will get a redirection to the day's file, once you know what days are available from the list of exported days.

        Once you have the redirection, you can fetch the file. The redirection is of the format:

        https://com-twilio-exports.s3.amazonaws.com/daily/day%3D2020-02-02/type%3DMessages/account%3DACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/created_time%3D20200202000014/part-0XXXXXXXXXX0.json.gz?X-Amz-Security-Token=IQoXXXXXXXXH1GQ%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200202T012341Z&X-Amz-SignedHeaders=host&X-Amz-Expires=240&X-Amz-Credential=AXXXXXXXXXXX22%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=bXXXXXXXXX9
        

        This link is a one-time use signed S3 link to the file. You can request these links multiple times from the API above, but each link can only be used once.

        The file in compressed using gzip. You can use a command line tool to gunzip the file, or utilities in your language like Java's GZIPInputStream or GZipStream in C#.

        Inside the file, messages are contained, with JSON equivalent to the Message Resource. These are of the format

        {
        "date_updated": "2020-01-013T03:57:34Z",
        "date_sent": "2020-01-01T03:57:33Z",
        "date_created": "2020-01-01T03:57:32Z",
        "body": "Sent from your Twilio trial account - woot woot!!!!",
        "num_segments": 1,
        "sid": "SM32743c2e9c251806c2317dee566f6d7b",
        "num_media": 0,
        "messaging_service_sid": "MG1ef70550624e8b354860a98d787ee1f1",
        "account_sid": "ACa674802ceae35ad19498be749e085991",
        "from": "+14155551212",
        "error_code": null,
        "to": "+14155552389",
        "status": "delivered",
        "direction": "outbound-api"
        }
        

        This will be repeated per message for that day.

        Read multiple Day resources

        get
        https://bulkexports.twilio.com/v1/Exports/{ResourceType}/Days

        {ResourceType} is the type of Twilio resource, one of Calls or Messages. The Developer Preview release of Day supports exporting Messages only.

        Parameters
        Parameters in REST API format
        resource_type
        Path
        get string Not PII

        The type of communication – Messages, Calls

        next_token
        Optional
        get string Not PII

        previous_token
        Optional
        get string Not PII

        Example 1
              
              
              
              
              This will get the list of the exported days. There will be one day json block per day of exported data.

              Fetch a list of exported days

              This will get the list of the exported days. There will be one day json block per day of exported data.
              Rate this page:

              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.