Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sync REST: Lists

A list is an ordered collection of individual items, each storing separate JSON objects.

  • Items can be appended, updated, removed and iterated, but not inserted at random position.
  • Each item is limited to 16KB of data.
  • Item read or update access is performed using item index that is internally generated.
  • Index is not guaranteed to be contiguous.
  • Full list modification history is maintained with every change triggering new revision.
  • Strict ordering of all list mutation events and all contained items is guaranteed.
  • Expires and gets deleted automatically, if eviction is configured via TTL parameter. By default, List and its items are persisted permanently.

List Root Properties

Each List object root resource has the following properties. Unique name and expiration date attributes are optional and allowed to be null.

account_sid
sid<AC> Not PII

The unique SID identifier of the Twilio Account.

created_by

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

date_created
date_time<iso8601> Not PII

The date this List was created, given in UTC ISO 8601 format.

date_expires
date_time<iso8601> Not PII

Contains the date this List expires and gets deleted automatically. Contains null if the List persists permanently.

date_updated
date_time<iso8601> Not PII

Specifies the date this List was last updated, given in UTC ISO 8601 format.

links
uri_map Not PII

A dictionary of URL links to nested resources of this List.

revision
string Not PII

Contains the current revision of this List, represented by a string identifier.

service_sid
sid<IS> Not PII

The unique SID identifier of the Service Instance that hosts this List object.

sid
sid<ES> Not PII

The unique 34-character SID identifier of the List.

unique_name

The unique and addressable name of this List. Optional, up to 256 characters long.

url
url Not PII

The absolute URL for this List.

Example

{
  "account_sid": "ACxx",
  "service_sid": "ISxx",
  "sid": "ESxx",
  "unique_name": "MyList",
  "revision": "1a",
  "date_created": "2015-11-24T22:18:57Z",
  "date_updated": "2015-11-24T22:19:58Z",
  "date_expires": null,
  "created_by": "system",
  "url": "https://sync.twilio.com/v1/Services/ISxx/Lists/ESxx",
  "links": {
    "items": "https://sync.twilio.com/v1/Services/ISxx/Lists/ESxx/Items",
    "permissions": "https://sync.twilio.com/v1/Services/ISxx/Lists/ESxx/Permissions"
  }
}

List Item Properties

Each List Item resource is nested under the parent List root resource and has the following properties.

account_sid
sid<AC> Not PII

The unique SID identifier of the Twilio Account.

created_by

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

data

Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB.

date_created
date_time<iso8601> Not PII

The date this item was created, given in UTC ISO 8601 format.

date_expires
date_time<iso8601> Not PII

Contains the date this item expires and gets deleted automatically. Contains null if the List persists permanently.

date_updated
date_time<iso8601> Not PII

Specifies the date this item was last updated, given in UTC ISO 8601 format.

index
integer Not PII

Contains the automatically generated index of this List Item. Positive integer or zero, guaranteed to be always incrementing. Not guaranteed to be contiguous; the list may have gaps as items are deleted.

list_sid
sid<ES> Not PII

The unique 34-character SID identifier of the List containing this Item.

revision
string Not PII

Contains the current revision of this item, represented by a string identifier.

service_sid
sid<IS> Not PII

The unique SID identifier of the Service Instance that hosts this List object.

url
url Not PII

The absolute URL for this item.

Example

{
  "account_sid": "ACxx",
  "service_sid": "ISxx",
  "list_sid": "ESxx",
  "index": 7,
  "revision": "1b",
  "date_created": "2015-11-24T22:19:58Z",
  "date_updated": "2015-11-24T22:19:58Z",
  "date_expires": null,
  "created_by": "system",
  "url": "https://sync.twilio.com/v1/Services/ISxx/Lists/ESxx/Items/7",
  "data": {
      <user-defined List Item content>
  }
}

Actions


List All Lists

GET /v1/Services/ISxx/Lists

Retrieve a list of all Lists belonging to this Service Instance.

Note: 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.

Example

Loading Code Sample...
      
      
          
          
          
          
        

      Create a List

      POST /v1/Services/ISxx/List
      

      Create a new List in this Service Instance, optionally giving it a unique name and assigning an expiration deadline.

      Parameters

      Ttl
      Optional
      post integer Not PII

      Time-to-live of this List in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity.

      UniqueName
      Optional
      post string Not PII

      Human-readable name for this list

      Loading Code Sample...
          
          
              
              
              
              
            

          Retrieve a List

          GET /v1/Services/ISxx/Lists/ESxx|UniqueName
          

          Fetch information about a specific List by its SID or unique name.

          Example

          Loading Code Sample...
              
              
                  
                  
                  
                  
                

              Update a List

              POST /v1/Services/ISxx/Lists/ESxx|UniqueName
              

              Update the List expiration deadline, addressed by its SID or unique name.

              Parameters

              Ttl
              Optional
              post integer Not PII

              Time-to-live of this List in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity.

              Loading Code Sample...
                  
                  
                      
                      
                      
                      
                    

                  Push Item Into List

                  POST /v1/Services/ISxx/Lists/ESxx|UniqueName/Items
                  

                  Append a new item to this List, supplying its payload, and optionally providing an item expiration deadline.

                  Data
                  Required
                  post object Not PII

                  Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB.

                  Ttl
                  Optional
                  post integer Not PII

                  Time-to-live of this item in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity. Upon expiry, the list item will be cleaned up at least in a matter of hours, and often within seconds, making this a good tool for garbage management.

                  Loading Code Sample...
                      
                      
                          
                          
                          
                          
                        

                      Get Item From List

                      GET /v1/Services/ISxx/Lists/ESxx|UniqueName/Items/<INDEX>
                      

                      Fetch data of a specific item in the current List, addressed by List SID (or unique name) and item index.

                      Example

                      Loading Code Sample...
                          
                          
                              
                              
                              
                              
                            

                          Query Items From List

                          GET /v1/Services/ISxx/Lists/ESxx|UniqueName/Items
                          

                          Retrieve a list of all items belonging to this List.

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

                          Parameters

                          From
                          Optional
                          get string Not PII

                          An integer representing Item index offset (inclusive). If not present, query is performed from the start or end, depending on the Order query parameter.

                          Order
                          Optional
                          get enum:query_result_order Not PII

                          A string; asc or desc

                          Loading Code Sample...
                              
                              
                                  
                                  
                                  
                                  
                                

                              Update Item In List

                              POST /v1/Services/ISxx/Lists/ESxx|UniqueName/Items/<INDEX>
                              

                              Update data and/or expiration deadline of a specific item in the current List, addressed by SID (or unique name) and item index.

                              Parameters

                              Data
                              Optional
                              post object Not PII

                              Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB.

                              Ttl
                              Optional
                              post integer Not PII

                              Time-to-live of this item in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity. Upon expiry, the list item will be cleaned up at least in a matter of hours, and often within seconds, making this a good tool for garbage management.

                              Loading Code Sample...
                                  
                                  
                                      
                                      
                                      
                                      
                                    

                                  Remove Item From List

                                  DELETE /v1/Services/ISxx/Lists/ESxx|UniqueName/Items/<INDEX>
                                  

                                  Permanently delete a specific item from the current List, addressed by SID (or unique name) and item index.

                                  Example

                                  Loading Code Sample...
                                      
                                      
                                          
                                          
                                          
                                          
                                        

                                      Delete a List

                                      DELETE /v1/Services/ISxx/Lists/ESxx|UniqueName
                                      

                                      Permanently delete a specific List along with all items belonging to it from current Service Instance, addressed by SID or unique name.

                                      Example

                                      Loading Code Sample...
                                          
                                          
                                              
                                              
                                              
                                              
                                            

                                          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 browsing the Twilio tag on Stack Overflow.

                                          Loading Code Sample...