Menu

Expand
Rate this page:

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. Learn more about 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 your files that support web, voice, and messaging applications. Twilio Assets is frequently 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.

Metadata warning

Please note that asset files are uploaded as is with all metadata persisted. If your asset files contain metadata, that will be stored with the file. An example would be exif metadata stored with an image. If you are making files available, please note that metadata is persisted and not removed/changed by the Assets product in anyway.

Protected Assets

A protected Function or Asset requires a valid Twilio request signature to be accessed. This means that the Function or Asset is only accessible if the request to access it contains the X-Twilio-Signature header and the signature is valid. This means you can limit your Functions and Assets only to be accessible to Twilio webhooks, such as on an incoming call or SMS message. Configure a phone number on the Twilio console to set a Function as the response to a webhook.

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
              
              
              
              Example of how to serve an audio file from a Private Asset

              Serve an audio file from a Private Asset

              Example of how to serve an audio file from 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

              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 25 MB 1000 Assets
              Private 10 MB 50 Assets
              Protected 25 MB 1000 Assets
              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 by visiting our Twilio Community forums or browsing the Twilio tag on Stack Overflow.

                    
                    
                    

                    Thank you for your feedback!

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

                    Sending your feedback...
                    🎉 Thank you for your feedback!
                    Something went wrong. Please try again.

                    Thanks for your feedback!

                    Refer us and get $10 in 3 simple steps!

                    Step 1

                    Get link

                    Get a free personal referral link here

                    Step 2

                    Give $10

                    Your user signs up and upgrade using link

                    Step 3

                    Get $10

                    1,250 free SMSes
                    OR 1,000 free voice mins
                    OR 12,000 chats
                    OR more