Skip to main content

Media

The Media object represents a single attachment or media file that is associated with a Message.

To simplify sharing of the media files with external applications, the URLs to the files themselves are made publicly accessible. These URLs are random, long and hard to guess, so the contents of the media should stay private unless you choose to distribute the URL. This means that these URLs can be included in any web application to access the files without needing your credentials.

A media object is created when an incoming message is received, or an outgoing message is created, that contain one or more attachments.

The Media Object

AttributeType
account_sidstringThe unique identifier of the project that sent or received this message.
content_typestringThe mime-type of the media file, for example image/gif.
date_createddatetimeThe date and time the message was sent in RFC 2822 format.
date_updateddatetimeThe date and time the message was sent in RFC 2822 format.
parent_sidstringThe unique identifier of the resource that created this media resource.
sidstringA unique identifier for this media resource.
uristringThe URI for this resource, relative to your base URL.

A sample media object from the API:

{
"sid": "b51dc3c6-df20-4af6-b774-a99de20d3fd8",
"date_created": "Fri, 15 Jun 2018 17:59:25 +0000",
"date_updated": "Fri, 15 Jun 2018 17:59:25 +0000",
"account_sid": "446e9986-0848-4d46-a617-48793c5f5e07",
"parent_sid": "3338f508-c98c-45a1-b2e3-1a2c345477a8",
"content_type": "image/jpeg",
"uri": "/api/laml/2010-04-01/Accounts/446e9986-0848-4d46-a617-48793c5f5e07/Messages/3338f508-c98c-45a1-b2e3-1a2c345477a8/Media/b51dc3c6-df20-4af6-b774-a99de20d3fd8.json"
}

Media Size Restrictions

All messages, both incoming and outgoing, are limited to 5 MB of associated media files.

Incoming messages with more than 5 MB of media are not accepted.

Outgoing messages are allowed a maximum of 10 Media files. If the total size of all Media is greater than 5 MB, the message will return an error code.