# 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](/docs/sync/api/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](/docs/sync/javascript/changelog). Servers wishing to manage these objects can do so via the REST API using the examples below.

## List properties

```json
{"type":"object","refName":"sync.v1.service.sync_list","modelName":"sync_v1_service_sync_list","properties":{"sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^ES[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string that we created to identify the Sync List resource."},"unique_name":{"type":"string","nullable":true,"description":"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.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the [Account](/docs/iam/api/account) that created the Sync List resource."},"service_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the [Sync Service](/docs/sync/api/service) the resource is associated with."},"url":{"type":"string","format":"uri","nullable":true,"description":"The absolute URL of the Sync List resource."},"links":{"type":"object","format":"uri-map","nullable":true,"description":"The URLs of the Sync List's nested resources."},"revision":{"type":"string","nullable":true,"description":"The current revision of the Sync List, represented as a string."},"date_expires":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the Sync List expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/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":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."},"date_updated":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."},"created_by":{"type":"string","nullable":true,"description":"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`.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}}}}
```

## Create a List resource

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

### Path parameters

```json
[{"name":"ServiceSid","in":"path","description":"The SID of the [Sync Service](/docs/sync/api/service) to create the new Sync List in.","schema":{"type":"string"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"CreateSyncListRequest","properties":{"UniqueName":{"type":"string","description":"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.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"Ttl":{"type":"integer","description":"Alias for collection_ttl. If both are provided, this value is ignored."},"CollectionTtl":{"type":"integer","description":"How long, [in seconds](/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted."}}},"examples":{"create":{"value":{"lang":"json","value":"{\n  \"UniqueName\": \"unique_name\",\n  \"Ttl\": 3600\n}","meta":"","code":"{\n  \"UniqueName\": \"unique_name\",\n  \"Ttl\": 3600\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"UniqueName\"","#7EE787"],[":","#C9D1D9"]," ",["\"unique_name\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"Ttl\"","#7EE787"],[":","#C9D1D9"]," ",["3600","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Create a List

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createSyncList() {
  const syncList = await client.sync.v1
    .services("ServiceSid")
    .syncLists.create();

  console.log(syncList.sid);
}

createSyncList();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

sync_list = client.sync.v1.services("ServiceSid").sync_lists.create()

print(sync_list.sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Sync.V1.Service;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var syncList = await SyncListResource.CreateAsync(pathServiceSid: "ServiceSid");

        Console.WriteLine(syncList.Sid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.sync.v1.service.SyncList;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SyncList syncList = SyncList.creator("ServiceSid").create();

        System.out.println(syncList.getSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	sync "github.com/twilio/twilio-go/rest/sync/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &sync.CreateSyncListParams{}

	resp, err := client.SyncV1.CreateSyncList("ServiceSid",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.Sid != nil {
			fmt.Println(*resp.Sid)
		} else {
			fmt.Println(resp.Sid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$sync_list = $twilio->sync->v1->services("ServiceSid")->syncLists->create();

print $sync_list->sid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

sync_list = @client
            .sync
            .v1
            .services('ServiceSid')
            .sync_lists
            .create

puts sync_list.sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:sync:v1:services:lists:create \
   --service-sid ServiceSid
```

```bash
curl -X POST "https://sync.twilio.com/v1/Services/ServiceSid/Lists" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "created_by": "created_by",
  "date_expires": "2015-07-30T21:00:00Z",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "links": {
    "items": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items",
    "permissions": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Permissions"
  },
  "revision": "revision",
  "service_sid": "ServiceSid",
  "sid": "ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "unique_name": "unique_name",
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

## Fetch a List resource

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

### Path parameters

```json
[{"name":"ServiceSid","in":"path","description":"The SID of the [Sync Service](/docs/sync/api/service) with the Sync List resource to fetch.","schema":{"type":"string"},"required":true},{"name":"Sid","in":"path","description":"The SID of the Sync List resource to fetch. Can be the Sync List resource's `sid` or its `unique_name`.","schema":{"type":"string"},"required":true}]
```

Fetch a List

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchSyncList() {
  const syncList = await client.sync.v1
    .services("ServiceSid")
    .syncLists("Sid")
    .fetch();

  console.log(syncList.sid);
}

fetchSyncList();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

sync_list = client.sync.v1.services("ServiceSid").sync_lists("Sid").fetch()

print(sync_list.sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Sync.V1.Service;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var syncList =
            await SyncListResource.FetchAsync(pathServiceSid: "ServiceSid", pathSid: "Sid");

        Console.WriteLine(syncList.Sid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.sync.v1.service.SyncList;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SyncList syncList = SyncList.fetcher("ServiceSid", "Sid").fetch();

        System.out.println(syncList.getSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	resp, err := client.SyncV1.FetchSyncList("ServiceSid",
		"Sid")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.Sid != nil {
			fmt.Println(*resp.Sid)
		} else {
			fmt.Println(resp.Sid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$sync_list = $twilio->sync->v1
    ->services("ServiceSid")
    ->syncLists("Sid")
    ->fetch();

print $sync_list->sid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

sync_list = @client
            .sync
            .v1
            .services('ServiceSid')
            .sync_lists('Sid')
            .fetch

puts sync_list.sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:sync:v1:services:lists:fetch \
   --service-sid ServiceSid \
   --sid Sid
```

```bash
curl -X GET "https://sync.twilio.com/v1/Services/ServiceSid/Lists/Sid" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "created_by": "created_by",
  "date_expires": "2015-07-30T21:00:00Z",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "links": {
    "items": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items",
    "permissions": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Permissions"
  },
  "revision": "revision",
  "service_sid": "ServiceSid",
  "sid": "Sid",
  "unique_name": "unique_name",
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

## Read multiple List resources

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

> \[!NOTE]
>
> By default, this will return the first 50 Lists. Supply a PageSize parameter to fetch up to 100 items at once. See [paging](/docs/usage/twilios-response#pagination) for more information.

### Path parameters

```json
[{"name":"ServiceSid","in":"path","description":"The SID of the [Sync Service](/docs/sync/api/service) with the Sync List resources to read.","schema":{"type":"string"},"required":true}]
```

### Query parameters

```json
[{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 100.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":100}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

List multiple Lists

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listSyncList() {
  const syncLists = await client.sync.v1
    .services("ServiceSid")
    .syncLists.list({ limit: 20 });

  syncLists.forEach((s) => console.log(s.sid));
}

listSyncList();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

sync_lists = client.sync.v1.services("ServiceSid").sync_lists.list(limit=20)

for record in sync_lists:
    print(record.sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Sync.V1.Service;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var syncLists = await SyncListResource.ReadAsync(pathServiceSid: "ServiceSid", limit: 20);

        foreach (var record in syncLists) {
            Console.WriteLine(record.Sid);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.sync.v1.service.SyncList;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<SyncList> syncLists = SyncList.reader("ServiceSid").limit(20).read();

        for (SyncList record : syncLists) {
            System.out.println(record.getSid());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	sync "github.com/twilio/twilio-go/rest/sync/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &sync.ListSyncListParams{}
	params.SetLimit(20)

	resp, err := client.SyncV1.ListSyncList("ServiceSid",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].Sid != nil {
				fmt.Println(*resp[record].Sid)
			} else {
				fmt.Println(resp[record].Sid)
			}
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$syncLists = $twilio->sync->v1->services("ServiceSid")->syncLists->read(20);

foreach ($syncLists as $record) {
    print $record->sid;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

sync_lists = @client
             .sync
             .v1
             .services('ServiceSid')
             .sync_lists
             .list(limit: 20)

sync_lists.each do |record|
   puts record.sid
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:sync:v1:services:lists:list \
   --service-sid ServiceSid
```

```bash
curl -X GET "https://sync.twilio.com/v1/Services/ServiceSid/Lists?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "lists": [],
  "meta": {
    "first_page_url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists?PageSize=50&Page=0",
    "key": "lists",
    "next_page_url": null,
    "page": 0,
    "page_size": 50,
    "previous_page_url": null,
    "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists?PageSize=50&Page=0"
  }
}
```

## Update a List resource

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

### Path parameters

```json
[{"name":"ServiceSid","in":"path","description":"The SID of the [Sync Service](/docs/sync/api/service) with the Sync List resource to update.","schema":{"type":"string"},"required":true},{"name":"Sid","in":"path","description":"The SID of the Sync List resource to update. Can be the Sync List resource's `sid` or its `unique_name`.","schema":{"type":"string"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateSyncListRequest","properties":{"Ttl":{"type":"integer","description":"An alias for `collection_ttl`. If both are provided, this value is ignored."},"CollectionTtl":{"type":"integer","description":"How long, [in seconds](/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"Ttl\": 3600\n}","meta":"","code":"{\n  \"Ttl\": 3600\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"Ttl\"","#7EE787"],[":","#C9D1D9"]," ",["3600","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Update a List

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function updateSyncList() {
  const syncList = await client.sync.v1
    .services("ServiceSid")
    .syncLists("Sid")
    .update({ ttl: 42 });

  console.log(syncList.sid);
}

updateSyncList();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

sync_list = (
    client.sync.v1.services("ServiceSid").sync_lists("Sid").update(ttl=42)
)

print(sync_list.sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Sync.V1.Service;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var syncList = await SyncListResource.UpdateAsync(
            ttl: 42, pathServiceSid: "ServiceSid", pathSid: "Sid");

        Console.WriteLine(syncList.Sid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.sync.v1.service.SyncList;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SyncList syncList = SyncList.updater("ServiceSid", "Sid").setTtl(42).update();

        System.out.println(syncList.getSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	sync "github.com/twilio/twilio-go/rest/sync/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &sync.UpdateSyncListParams{}
	params.SetTtl(42)

	resp, err := client.SyncV1.UpdateSyncList("ServiceSid",
		"Sid",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.Sid != nil {
			fmt.Println(*resp.Sid)
		} else {
			fmt.Println(resp.Sid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$sync_list = $twilio->sync->v1
    ->services("ServiceSid")
    ->syncLists("Sid")
    ->update(["ttl" => 42]);

print $sync_list->sid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

sync_list = @client
            .sync
            .v1
            .services('ServiceSid')
            .sync_lists('Sid')
            .update(ttl: 42)

puts sync_list.sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:sync:v1:services:lists:update \
   --service-sid ServiceSid \
   --sid Sid \
   --ttl 42
```

```bash
curl -X POST "https://sync.twilio.com/v1/Services/ServiceSid/Lists/Sid" \
--data-urlencode "Ttl=42" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "created_by": "created_by",
  "date_expires": "2015-07-30T21:00:00Z",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "links": {
    "items": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items",
    "permissions": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Permissions"
  },
  "revision": "revision",
  "service_sid": "ServiceSid",
  "sid": "Sid",
  "unique_name": "unique_name",
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

## 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.

### Path parameters

```json
[{"name":"ServiceSid","in":"path","description":"The SID of the [Sync Service](/docs/sync/api/service) with the Sync List resource to delete.","schema":{"type":"string"},"required":true},{"name":"Sid","in":"path","description":"The SID of the Sync List resource to delete. Can be the Sync List resource's `sid` or its `unique_name`.","schema":{"type":"string"},"required":true}]
```

Delete a List with the REST API

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function deleteSyncList() {
  await client.sync.v1
    .services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    .syncLists("ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    .remove();
}

deleteSyncList();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

client.sync.v1.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").sync_lists(
    "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
).delete()
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Sync.V1.Service;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        await SyncListResource.DeleteAsync(
            pathServiceSid: "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            pathSid: "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.sync.v1.service.SyncList;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete();
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	err := client.SyncV1.DeleteSyncList("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
		"ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$twilio->sync->v1
    ->services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    ->syncLists("ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    ->delete();
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client
  .sync
  .v1
  .services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
  .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
  .delete
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:sync:v1:services:lists:remove \
   --service-sid ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
   --sid ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

```bash
curl -X DELETE "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```js title="Delete a List with the JavaScript SDK"
syncClient.list('example_list').then(function(list) {
  list.removeList().then(function() {
    console.log('deleted list');
  });
});
```
