SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site,, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to, 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 Do I Retrieve Image Files from MMS Messages?

Image files in MMS messages are stored as media in Twilio’s API. To retrieve such files, you need to first find out the Message SID the media is associated with, and you can use the Media List Resource and the Media Instance Resource to retrieve the files.

For incoming MMS, Twilio sends the “MediaUrl” parameter to your webhook which you can use to retrieve media files easily. See How do I retrieve the MediaUrl parameter for an MMS I received? to learn more.
For outbound MMS,
there is no direct MediaUrl field in the API response or status callbacks. You will instead need to follow the below steps to retrieve the media.

Getting the Message SIDs

Use the list of Message SIDs associated with your project. To check if a particular MMS message has more than one image file, please check the NumMedia resource property that indicates the number of media files associated with a message. Subsequently, you can also filter your list by providing certain query string parameters to the listing resource. Please gather the Message SIDs that you would like to retrieve the image files from.


Getting the Media SIDs

With the Message SIDs, you can use the Media List Resource to return a list of media associated with a specific message.


Retrieving the Image Files

Use the Media Instance Resourceto retrieve an individual image file associated with a message. Please note that you do not need to append an extension at the end of this resource. Without an extension, the image is returned using the mime-type provided (jpeg, gif, png) when the media was generated.


Formatting the URL to Retrieve Media in a Browser or Application

The returned URI above is not a direct http address you can use to access the file. You'll first need to append to the beginning of the URI, and remove the .json or .xml extension from it to use as a direct media URL in a browser or application.{AccountSid}/Messages/{MessageSid}/Media/{MediaSid}
Have more questions? Submit a request
Powered by Zendesk