SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How To Upload an Asset as Private

Objective

Uploading a private asset isn’t supported in the Assets Plugin, uploads are public by default. This article explains how to upload an asset as private using the Functions & Assets Twilio Console.

 

Product

Twilio Assets

 

Environment

legacy Twilio Console

 

Procedure 

To upload an asset as private,  one first needs to create the asset and then create a corresponding asset version where its visibility is set to private. For example, to upload a file named Twilio.png as a private asset, one would perform the following steps:

 

Create an Asset

curl -X POST "https://serverless.twilio.com/v1/Services/ZSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Assets" \
--data-urlencode "FriendlyName=FriendlyName" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
  • This first step returns a response that includes your asset SID (ZSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).


Create a Corresponding Asset Version

curl -X POST "https://serverless-upload.twilio.com/v1/Services/ZSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Assets/ZHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Versions" \
-F "Content=@my-asset.png; type=image/png" \
-F "Path=/my-asset.png" \
-F "Visibility=private" \
-u "TWILIO_API_KEY:TWILIO_API_SECRET"

Note: Please make sure to execute the above command in the same folder where the asset is located. Otherwise, a curl: (26) Failed to open/read local data from file/application error will be given.

 

Additional Information 

More information about assets can be found at the following links:

 

Have more questions? Submit a request
Powered by Zendesk