Menu

Expand
Rate 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

Resource Properties in REST API format
sid
sid<ES> Not PII

The unique string that we created to identify the Sync List 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.

account_sid
sid<AC> Not PII

The SID of the Account that created the Sync List resource.

service_sid
sid<IS> Not PII

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

url
url Not PII

The absolute URL of the Sync List resource.

links
uri_map Not PII

The URLs of the Sync List's nested resources.

revision
string Not PII

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

date_expires
date_time<iso8601> Not PII

The date and time in GMT when the Sync List expires and will be deleted, specified in ISO 8601 format. If the Sync List does not expire, this value is null. The Sync List might not be deleted immediately after it expires.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601 format.

created_by

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.

Create a List resource

post
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists
Parameters
Parameters in REST API format
service_sid
Path
post sid_like<IS> Not PII

The SID of the Sync Service to create the new Sync List in.

unique_name
Optional
post string PII 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.

ttl
Optional
post integer Not PII

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

collection_ttl
Optional
post integer Not PII

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

Example 1
Loading Code Sample...
        
        

        Create Sync List

        Fetch a List resource

        get
        https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}
        Parameters
        Parameters in REST API format
        service_sid
        Path
        get sid_like<IS> Not PII

        The SID of the Sync Service with the Sync List resource to fetch.

        sid
        Path
        get sid_like<ES> Not PII

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

        Example 1
        Loading Code Sample...
              
              

              Fetch Sync List

              Read multiple List resources

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

              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.

              Parameters
              Parameters in REST API format
              service_sid
              Path
              get sid_like<IS> Not PII

              The SID of the Sync Service with the Sync List resources to read.

              Example 1
              Loading Code Sample...
                    
                    

                    Read Sync List

                    Update a List resource

                    post
                    https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}
                    Parameters
                    Parameters in REST API format
                    service_sid
                    Path
                    post sid_like<IS> Not PII

                    The SID of the Sync Service with the Sync List resource to update.

                    sid
                    Path
                    post sid_like<ES> Not PII

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

                    ttl
                    Optional
                    post integer Not PII

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

                    collection_ttl
                    Optional
                    post integer Not PII

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

                    Example 1
                    Loading Code Sample...
                          
                          

                          Update Sync List

                          Delete a List resource

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

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

                          Parameters
                          Parameters in REST API format
                          service_sid
                          Path
                          delete sid_like<IS> Not PII

                          The SID of the Sync Service with the Sync List resource to delete.

                          sid
                          Path
                          delete sid_like<ES> Not PII

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

                          Example 1
                          Loading Code Sample...
                                
                                

                                Delete a List with the REST API

                                Example 2
                                Loading Code Sample...
                                      
                                      

                                      Delete a List with the JavaScript SDK

                                      Rate this page:

                                      Need some help?

                                      We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                      Loading Code Sample...
                                            
                                            
                                            

                                            Thank you for your feedback!

                                            Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                            Sending your feedback...
                                            🎉 Thank you for your feedback!
                                            Something went wrong. Please try again.

                                            Thanks for your feedback!

                                            thanks-feedback-gif