Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

List Resource


A Sync List is an ordered collection of individual items, each storing separate JSON objects. Use Lists to push JSON into an ordered list and update existing items within the list.

After you create a List, you can add, retrieve, update, and delete items from your List with the ListItem resource. (That page contains more details on how items are stored in lists, including ordering, expiration, and limitations on each item's size.)

Lists can be created, updated, subscribed to and removed via the client JavaScript SDK. Servers wishing to manage these objects can do so via the REST API using the examples below.


List properties

list-properties page anchor
Resource properties
sidtype: SID<ES>Not PII

The unique string that we created to identify the Sync List resource.


unique_nametype: stringPII MTL: 30 days

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.


service_sidtype: SID<IS>Not PII

The SID of the Sync Service(link takes you to an external page) the resource is associated with.


urltype: string<URI>Not PII

The absolute URL of the Sync List resource.


linkstype: object<URI MAP>Not PII

The URLs of the Sync List's nested resources.


revisiontype: stringNot PII

The current revision of the Sync List, represented as a string.


date_expirestype: string<DATE TIME>Not PII

The date and time in GMT when the Sync List expires and will be deleted, specified in ISO 8601(link takes you to an external page) format. If the Sync List does not expire, this value is null. The Sync List might not be deleted immediately after it expires.


date_createdtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


created_bytype: stringPII MTL: 30 days

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


POST https://sync.twilio.com/v1/Services/{ServiceSid}/Lists

Parameters

create-parameters page anchor
URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) to create the new Sync List in.


Request body parameters
UniqueNametype: stringPII MTL: 30 days

An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The unique_name value can be used as an alternative to the sid in the URL path to address the resource.


Ttltype: integerNot PII

Alias for collection_ttl. If both are provided, this value is ignored.


CollectionTtltype: integerNot PII

How long, in seconds(link takes you to an external page), before the Sync List expires (time-to-live) and is deleted.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncLists
_11
.create()
_11
.then(sync_list => console.log(sync_list.sid));

Output

_16
{
_16
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"created_by": "created_by",
_16
"date_expires": "2015-07-30T21:00:00Z",
_16
"date_created": "2015-07-30T20:00:00Z",
_16
"date_updated": "2015-07-30T20:00:00Z",
_16
"links": {
_16
"items": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items",
_16
"permissions": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Permissions"
_16
},
_16
"revision": "revision",
_16
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"sid": "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"unique_name": "unique_name",
_16
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_16
}


GET https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync List resource to fetch.


Sidtype: stringNot PII
Path Parameter

The SID of the Sync List resource to fetch. Can be the Sync List resource's sid or its unique_name.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncLists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(sync_list => console.log(sync_list.uniqueName));

Output

_16
{
_16
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"created_by": "created_by",
_16
"date_expires": "2015-07-30T21:00:00Z",
_16
"date_created": "2015-07-30T20:00:00Z",
_16
"date_updated": "2015-07-30T20:00:00Z",
_16
"links": {
_16
"items": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items",
_16
"permissions": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Permissions"
_16
},
_16
"revision": "revision",
_16
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"sid": "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"unique_name": "unique_name",
_16
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_16
}


Read multiple List resources

read-multiple-list-resources page anchor
GET https://sync.twilio.com/v1/Services/{ServiceSid}/Lists

(information)

Info

By default, this will return the first 50 Lists. Supply a PageSize parameter to fetch up to 100 items at once. See paging for more information.

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync List resources to read.


PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncLists
_11
.list({limit: 20})
_11
.then(syncLists => syncLists.forEach(s => console.log(s.sid)));

Output

_29
{
_29
"lists": [
_29
{
_29
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"created_by": "created_by",
_29
"date_expires": "2015-07-30T21:00:00Z",
_29
"date_created": "2015-07-30T20:00:00Z",
_29
"date_updated": "2015-07-30T20:00:00Z",
_29
"links": {
_29
"items": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items",
_29
"permissions": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Permissions"
_29
},
_29
"revision": "revision",
_29
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"sid": "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"unique_name": "unique_name",
_29
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_29
}
_29
],
_29
"meta": {
_29
"first_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists?PageSize=50&Page=0",
_29
"key": "lists",
_29
"next_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists?PageSize=50&Page=1",
_29
"page": 0,
_29
"page_size": 50,
_29
"previous_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists?PageSize=50&Page=0",
_29
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists?PageSize=50&Page=0"
_29
}
_29
}


POST https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync List resource to update.


Sidtype: stringNot PII
Path Parameter

The SID of the Sync List resource to update. Can be the Sync List resource's sid or its unique_name.


Request body parameters
Ttltype: integerNot PII

An alias for collection_ttl. If both are provided, this value is ignored.


CollectionTtltype: integerNot PII

How long, in seconds(link takes you to an external page), before the Sync List expires (time-to-live) and is deleted.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncLists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.update({ttl: 1})
_11
.then(sync_list => console.log(sync_list.uniqueName));

Output

_16
{
_16
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"created_by": "created_by",
_16
"date_expires": "2015-07-30T21:00:00Z",
_16
"date_created": "2015-07-30T20:00:00Z",
_16
"date_updated": "2015-07-30T20:00:00Z",
_16
"links": {
_16
"items": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items",
_16
"permissions": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Permissions"
_16
},
_16
"revision": "revision",
_16
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"sid": "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"unique_name": "unique_name",
_16
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_16
}


DELETE https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}

Permanently delete a List along with all items belonging to it.

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync List resource to delete.


Sidtype: stringNot PII
Path Parameter

The SID of the Sync List resource to delete. Can be the Sync List resource's sid or its unique_name.

Delete a List with the REST API

delete-a-list-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.syncLists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.remove();

Delete a List with the JavaScript SDK

delete-a-list-with-the-javascript-sdk page anchor

_10
syncClient.list('example_list').then(function(list) {
_10
list.removeList().then(function() {
_10
console.log('deleted list');
_10
});
_10
});


Rate this page: