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.
Messages Export file format
Day files are stored and returned as compressed (gzip) JSON files with one record per line. Records are similar to the Message resource. The differences are:
price_units
will not be presentapi_version
will not be presenterror message
will not be present (buterror_code
is)uri
andsubresource_uris
will not be present.- timestamps like
date created
,date updated
anddate sent
are in UTC and ISO 8601 format.
Calls Export file format
Day files are stored and returned as compressed (gzip) JSON files with one record per line. Records are similar to the Calls resource. The differences are:
- timestamps are in UTC and ISO 8601 format.
- Price data may not be present on all messages in BulkExport
uri
andsubresource_uris
will not be present.
Conferences Export file format
Day files are stored and returned as compressed (gzip) JSON files with one record per line. Records are similar to the Conferences resource. The differences are:
- timestamps are in UTC and ISO 8601 format.
api_version
will not be presenturi
andsubresource_uris
will not be present.
Participants BulkExport file format
Day files are stored and returned as compressed (gzip) JSON files with one record per line. Records are similar to the Participants resource. The differences are:
- timestamps are in UTC and ISO 8601 format.
uri
will not be presentlabel
will not be present
Day properties
Resource Properties in REST API format | |
---|---|
day
|
The ISO 8601 format date of the resources in the file, for a UTC day |
size
|
The size of the day's data file in bytes |
create_date
|
The ISO 8601 format date when resources is created |
friendly_name
|
The friendly name specified when creating the job |
resource_type
|
The type of communication – Messages, Calls, Conferences, and Participants |
Instance Properties in REST API format | |
redirect_to
|
|
Fetch a single day file
https://bulkexports.twilio.com/v1/Exports/{ResourceType}/Days/{Day}
Parameters
Parameters in REST API format | |
---|---|
resource_type
Path
|
The type of communication – Messages, Calls, Conferences, and Participants |
day
Path
|
The ISO 8601 format date of the resources in the file, for a UTC day |
Example 1
Once you have the redirection, you can fetch the file. The redirection is of the format:
https://documentation-example-twilio-bucket/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
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
|
The type of communication – Messages, Calls, Conferences, and Participants |
Example 1
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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.