NAME

Twilio::Rest::Api::V2010::Account::Message::Media - The Media resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

for my $media ($client->messages($message_sid)->media->read({}, 20)) {
  ...
}
my $media = $client->messages($message_sid)->media($sid)->fetch;
$client->messages($message_sid)->media($sid)->delete;

DESCRIPTION

The Media subresource of a Message resource represents a piece of media, such as an image, that is associated with the Message.

This file holds MediaList, MediaPage, MediaContext and MediaInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

MediaList

Returned by $client->messages($message_sid)->media. See also Twilio::ListResource.

read

my @records = $client->messages($message_sid)->media->read(\%options, $limit, $page_size);

Read a list of Media resources associated with a specific Message resource. Returns the records as a list, fetching as many pages as it needs.

The options are:

date_created

Only include Media resources that were created on this date. Specify a date as YYYY-MM-DD in GMT, for example: 2009-07-06, to read Media that were created on this date. You can also specify an inequality, such as StartTime<=YYYY-MM-DD, to read Media that were created on or before midnight of this date, and StartTime>=YYYY-MM-DD to read Media that were created on or after midnight of this date. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_created_before

Only include Media resources that were created on this date. Specify a date as YYYY-MM-DD in GMT, for example: 2009-07-06, to read Media that were created on this date. You can also specify an inequality, such as StartTime<=YYYY-MM-DD, to read Media that were created on or before midnight of this date, and StartTime>=YYYY-MM-DD to read Media that were created on or after midnight of this date. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_created_after

Only include Media resources that were created on this date. Specify a date as YYYY-MM-DD in GMT, for example: 2009-07-06, to read Media that were created on this date. You can also specify an inequality, such as StartTime<=YYYY-MM-DD, to read Media that were created on or before midnight of this date, and StartTime>=YYYY-MM-DD to read Media that were created on or after midnight of this date. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

stream

my $stream = $client->messages($message_sid)->media->stream(\%options, $limit, $page_size);

Takes the same arguments as "read", and returns a Twilio::Stream.

page

my $page = $client->messages($message_sid)->media->page(\%options, $page_size, $page_token, $page_number);

Fetches one page, and returns a Twilio::Page.

get_page

my $page = $client->messages($message_sid)->media->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->messages($message_sid)->media->get_context($sid);

Returns a MediaContext, and makes no request.

MediaPage

A Twilio::Page of MediaInstance objects.

records_key

build_instance

Used by Twilio::Page.

MediaContext

Returned by $client->messages($message_sid)->media($sid). It makes no request until one of these methods is called.

fetch

my $media = $client->messages($message_sid)->media($sid)->fetch;

Fetch a single Media resource associated with a specific Message resource. Returns a MediaInstance.

delete

$client->messages($message_sid)->media($sid)->delete;

Delete the Media resource. Returns true.

MediaInstance

See also Twilio::InstanceResource.

It has fetch and delete, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account associated with this Media resource.

content_type

The default MIME type of the media, for example image/jpeg, image/png, or image/gif.

date_created

The date and time in GMT when this Media resource was created, specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when this Media resource was last updated, specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

parent_sid

The SID of the Message resource that is associated with this Media resource.

sid

The unique string that identifies this Media resource.

uri

The URI of this Media resource, relative to https://api.twilio.com.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.