# Update a list

> **PUT** `https://api.us.nylas.com/v3/lists/{list_id}`

Source: https://developer.nylas.com/docs/reference/api/lists/update-list/

Updates the specified list. Only `name` and `description` can be updated. The list `type` is immutable after
creation.

**Authentication:** NYLAS_API_KEY

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | Yes | The ID of the list to access. |

## Request body

Content-Type: application/json

- `name` (string)
- `description` (string)

## Responses

### 200 - OK

- `request_id` (string) - ID of the request.
- `data` (object)
  - `id` (string) - Globally unique identifier for the list (UUID).
  - `name` (string) - A human-readable name for the list. 1–256 characters. Required on create.
  - `description` (string) - An optional description of the list's purpose.
  - `type` (string) - The kind of values the list holds and which rule condition fields it can be used with. Required on create and
immutable after creation. `domain` holds domain names (matched against `from.domain` or `recipient.domain`),
`tld` holds top-level domains (matched against `from.tld` or `recipient.tld`), and `address` holds full email
addresses (matched against `from.address` or `recipient.address`).
  - `items_count` (integer) - The number of items currently in the list. Read-only; maintained by the system.
  - `application_id` (string) - The ID of the application that owns the list. Read-only; derived from the authenticated API key.
  - `organization_id` (string) - The ID of the Nylas organization that owns the list. Read-only; derived from the authenticated API key.
  - `created_at` (integer) - When the list was created, in seconds using the Unix timestamp format.
  - `updated_at` (integer) - When the list was last updated, in seconds using the Unix timestamp format.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 404 - Not Found

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The raw error from the provider, if available
    - `code` (string)
    - `message` (string)

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl -X PUT "https://api.us.nylas.com/v3/lists/<LIST_ID>" \
  -H "Authorization: Bearer <NYLAS_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Blocked domains (updated)",
    "description": "Updated description."
  }'

```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function updateList() {
  try {
    const list = await nylas.lists.update({
      listId: "<LIST_ID>",
      requestBody: {
        name: "Updated list name",
        description: "Updated description.",
      },
    });

    console.log("Updated list:", list);
  } catch (error) {
    console.error("Error updating list:", error);
  }
}

updateList();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>",
)

nylas_list = nylas.lists.update(
    list_id="<LIST_ID>",
    request_body={
        "name": "Blocked domains (updated)",
        "description": "Updated description.",
    },
)

print(nylas_list)

```
