NAME

Twilio::Rest::Sync::V1::Service::Document - The Document resource

SYNOPSIS

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

my $document = $client->sync->v1->services($service_sid)->documents->create(\%options);
for my $document ($client->sync->v1->services($service_sid)->documents->read({}, 20)) {
  ...
}
my $document = $client->sync->v1->services($service_sid)->documents($sid)->fetch;
$client->sync->v1->services($service_sid)->documents($sid)->update(\%options);
$client->sync->v1->services($service_sid)->documents($sid)->delete;

DESCRIPTION

Sync Document objects

This file holds DocumentList, DocumentPage, DocumentContext and DocumentInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

DocumentList

Returned by $client->sync->v1->services($service_sid)->documents. See also Twilio::ListResource.

create

my $document = $client->sync->v1->services($service_sid)->documents->create(\%options);

Returns a DocumentInstance.

The options are:

data

A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. A hash or array reference, or a string of JSON.

ttl

How long, in seconds, before the Sync Document expires and is deleted (the Sync Document's time-to-live).

unique_name

An application-defined string that uniquely identifies the Sync Document

read

my @records = $client->sync->v1->services($service_sid)->documents->read(\%options, $limit, $page_size);

Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->sync->v1->services($service_sid)->documents->stream(\%options, $limit, $page_size);

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

page

my $page = $client->sync->v1->services($service_sid)->documents->page(\%options, $page_size, $page_token, $page_number);

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

get_page

my $page = $client->sync->v1->services($service_sid)->documents->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->sync->v1->services($service_sid)->documents->get_context($sid);

Returns a DocumentContext, and makes no request.

DocumentPage

A Twilio::Page of DocumentInstance objects.

records_key

build_instance

Used by Twilio::Page.

DocumentContext

Returned by $client->sync->v1->services($service_sid)->documents($sid). It makes no request until one of these methods is called.

fetch

my $document = $client->sync->v1->services($service_sid)->documents($sid)->fetch;

Returns a DocumentInstance.

update

my $document = $client->sync->v1->services($service_sid)->documents($sid)->update(\%options);

Returns a DocumentInstance.

The options are:

data

A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. A hash or array reference, or a string of JSON.

ttl

How long, in seconds, before the Sync Document expires and is deleted (time-to-live).

if_match

The If-Match HTTP request header

delete

$client->sync->v1->services($service_sid)->documents($sid)->delete;

Returns true.

document_permissions

my $list = $object->document_permissions;

my $context = $object->document_permissions($identity);

See Twilio::Rest::Sync::V1::Service::Document::DocumentPermission.

DocumentInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_sid

The SID of the Account that created the Document resource.

created_by

The identity of the Sync Document's creator. If the Sync Document is created from the client SDK, the value matches the Access Token's identity field. If the Sync Document was created from the REST API, the value is system.

data

An arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length.

date_created

The date and time in GMT when the resource was created specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_expires

The date and time in GMT when the Sync Document expires and will be deleted, specified in ISO 8601 format. If the Sync Document does not expire, this value is null. The Document resource might not be deleted immediately after it expires. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the resource was last updated specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

The URLs of resources related to the Sync Document.

revision

The current revision of the Sync Document, represented as a string. The revision property is used with conditional updates to ensure data consistency.

service_sid

The SID of the Sync Service the resource is associated with.

sid

The unique string that we created to identify the Document resource.

unique_name

An application-defined string that uniquely identifies the resource. It can be used in place of the resource's sid in the URL to address the resource and can be up to 320 characters long.

url

The absolute URL of the Document resource.

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.