Menu

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?

Assets

BETA


This Twilio product is currently available as a beta release. Some features are not yet implemented and others may be changed before the product is declared as Generally Available. Beta products are not covered by a Twilio SLA.

See this article for more information on beta product support.

Twilio Assets is a static file hosting service that allows developers to quickly upload and serve the files needed to support their applications. With Twilio Assets you can host files that support web, voice, and messaging applications. Twilio Assets is frequently to used to host .mp3 audio files used in TwiML, to serve images sent through MMSes, or store configuration used by Twilio Functions.

How Assets Work

Twilio Assets provides you with two different types of Assets: public and private. The primary difference between the two types is how they are accessed. Public Assets are made available over the public internet. Private Assets are not publicly available, instead they are packaged with your Twilio Functions.

Warning about use of Public Assets

Anyone with the URL to a public asset will be able to access it. Therefore, customers should be thoughtful about what data they include in a public asset.

Private Assets

When Twilio builds your Function for deployment it will include any and all Private Assets you have uploaded. This makes Private Assets perfect for storing configuration files, templates and other sensitive data that supports your application.

        
        
        
        
        Example of how to read the contents of a Private Asset

        Read the content of a Private Asset

        Example of how to read the contents of a Private Asset

        Public Assets

        Public Assets are served over HTTPS from the Twilio CDN to ensure it is highly available and secure. Typically, Public Assets are used to store static files that support an application. For example, Public Assets are perfect for hosting .mp3 audio files used in TwiML or serve images sent through MMSes.

        HTTP Request Flow

        Asset Retrival

        1. Every Asset Request begins with an HTTP Client issuing a request to your Twilio Asset. For most Assets, the HTTP client is the Twilio Voice or Messaging API responding to an incoming phone call or text message
        2. Twilio Asset Gateway receives this request and attempts to validate it. If the request or Twilio Signature is invalid the request is rejected with the appropriate HTTP 400 response.
        3. After Twilio Asset Gateway has accepted the HTTP request, it will locate where your Asset has been stored on the Twilio CDN.
        4. Once the Twilio Asset Gateway has located the Asset it will request the content from the Twilio CDN
        5. Upon receiving the result from the Twilio CDN, the Twilio Asset Gateway will construct an HTTP Response and return it to the HTTP Client. In the background, the Twilio Asset Gateway will also cache the content of the Asset to ensure subsequent requests are faster.

        Get Started with Assets

        Assets provides a simple drag-and-drop interface that makes getting started easy. Start by opening Assets in the Console. To upload a file to Assets, simply drag and drop the file onto the Assets list. Once the file has finished uploading, it will be available at the URL listed.

        Assets also supports the standard file upload dialogue available in all major browsers. To open the file upload dialogue click the plus button ('+') in the top left corner of the Assets list.

        Limitations

        Both public and private Assets have limitations on the maximum file size and quantity of each.

        Asset Type Maximum Size Quantity
        Public 100 MB 100 Assets
        Private 5 MB 20 Assets

        Get Help with Assets

        To send feedback and discuss implementation details, please join our Google group and let us know how things are going!

        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.