# KlaviyoAPI::ListsApi
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**create_list**](ListsApi.md#create_list) | **POST** /api/lists/ | Create List |
| [**create_list_relationships**](ListsApi.md#create_list_relationships) | **POST** /api/lists/{id}/relationships/profiles/ | Add Profile To List |
| [**delete_list**](ListsApi.md#delete_list) | **DELETE** /api/lists/{id}/ | Delete List |
| [**delete_list_relationships**](ListsApi.md#delete_list_relationships) | **DELETE** /api/lists/{id}/relationships/profiles/ | Remove Profile From List |
| [**get_list**](ListsApi.md#get_list) | **GET** /api/lists/{id}/ | Get List |
| [**get_list_profiles**](ListsApi.md#get_list_profiles) | **GET** /api/lists/{list_id}/profiles/ | Get List Profiles |
| [**get_list_relationships_profiles**](ListsApi.md#get_list_relationships_profiles) | **GET** /api/lists/{id}/relationships/profiles/ | Get List Relationships Profiles |
| [**get_list_relationships_tags**](ListsApi.md#get_list_relationships_tags) | **GET** /api/lists/{id}/relationships/tags/ | Get List Relationships Tags |
| [**get_list_tags**](ListsApi.md#get_list_tags) | **GET** /api/lists/{list_id}/tags/ | Get List Tags |
| [**get_lists**](ListsApi.md#get_lists) | **GET** /api/lists/ | Get Lists |
| [**update_list**](ListsApi.md#update_list) | **PATCH** /api/lists/{id}/ | Update List |
## create_list
> Hash<String, Object> create_list(list_create_query)
Create List
Create a new list.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
list_create_query = KlaviyoAPI::ListCreateQuery.new({data: KlaviyoAPI::ListCreateQueryResourceObject.new({type: KlaviyoAPI::ListEnum::LIST, attributes: KlaviyoAPI::ListCreateQueryResourceObjectAttributes.new({name: 'Newsletter'})})}) # ListCreateQuery |
begin
# Create List
result = api_instance.create_list(list_create_query)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->create_list: #{e}"
end
```
#### Using the create_list_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> create_list_with_http_info(list_create_query)
```ruby
begin
# Create List
data, status_code, headers = api_instance.create_list_with_http_info(list_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->create_list_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **list_create_query** | [**ListCreateQuery**](ListCreateQuery.md) | | |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## create_list_relationships
> create_list_relationships(id, list_members_add_query)
Add Profile To List
Add a profile to a list with the given list ID. It is recommended that you use the [Subscribe Profiles endpoint](https://developers.klaviyo.com/en/reference/subscribe_profiles) if you're trying to give a profile consent to receive email marketing. This endpoint accepts a maximum of 1000 profiles per call.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Write` `Profiles Write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'id_example' # String |
list_members_add_query = KlaviyoAPI::ListMembersAddQuery.new({data: [KlaviyoAPI::ListMembersAddQueryDataInner.new({type: 'profile', id: 'id_example'})]}) # ListMembersAddQuery |
begin
# Add Profile To List
api_instance.create_list_relationships(id, list_members_add_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->create_list_relationships: #{e}"
end
```
#### Using the create_list_relationships_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> create_list_relationships_with_http_info(id, list_members_add_query)
```ruby
begin
# Add Profile To List
data, status_code, headers = api_instance.create_list_relationships_with_http_info(id, list_members_add_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->create_list_relationships_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **list_members_add_query** | [**ListMembersAddQuery**](ListMembersAddQuery.md) | | |
### Return type
nil (empty response body)
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## delete_list
> delete_list(id)
Delete List
Delete a list with the given list ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'Y6nRLr' # String | Primary key that uniquely identifies this list. Generated by Klaviyo.
begin
# Delete List
api_instance.delete_list(id)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->delete_list: #{e}"
end
```
#### Using the delete_list_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> delete_list_with_http_info(id)
```ruby
begin
# Delete List
data, status_code, headers = api_instance.delete_list_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->delete_list_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | Primary key that uniquely identifies this list. Generated by Klaviyo. | |
### Return type
nil (empty response body)
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## delete_list_relationships
> delete_list_relationships(id, list_members_delete_query)
Remove Profile From List
Remove a profile from a list with the given list ID. The provided profile will no longer receive marketing from this particular list once removed. Removing a profile from a list will not impact the profile's consent status or subscription status in general. To update a profile's subscription status, please use the [Unsubscribe Profiles endpoint](https://developers.klaviyo.com/en/reference/unsubscribe_profiles). This endpoint accepts a maximum of 1000 profiles per call.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Write` `Profiles Write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'id_example' # String |
list_members_delete_query = KlaviyoAPI::ListMembersDeleteQuery.new({data: [KlaviyoAPI::ListMembersAddQueryDataInner.new({type: 'profile', id: 'id_example'})]}) # ListMembersDeleteQuery |
begin
# Remove Profile From List
api_instance.delete_list_relationships(id, list_members_delete_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->delete_list_relationships: #{e}"
end
```
#### Using the delete_list_relationships_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> delete_list_relationships_with_http_info(id, list_members_delete_query)
```ruby
begin
# Remove Profile From List
data, status_code, headers = api_instance.delete_list_relationships_with_http_info(id, list_members_delete_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->delete_list_relationships_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **list_members_delete_query** | [**ListMembersDeleteQuery**](ListMembersDeleteQuery.md) | | |
### Return type
nil (empty response body)
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## get_list
> Hash<String, Object> get_list(id, opts)
Get List
Get a list with the given list ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'Y6nRLr' # String | Primary key that uniquely identifies this list. Generated by Klaviyo.
opts = {
fields_list: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
}
begin
# Get List
result = api_instance.get_list(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list: #{e}"
end
```
#### Using the get_list_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_list_with_http_info(id, opts)
```ruby
begin
# Get List
data, status_code, headers = api_instance.get_list_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | Primary key that uniquely identifies this list. Generated by Klaviyo. | |
| **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_list_profiles
> Hash<String, Object> get_list_profiles(list_id, opts)
Get List Profiles
Get all profiles within a list with the given list ID. Filter to request a subset of all profiles. Profiles can be filtered by `email`, `phone_number`, and `push_token` fields. You can adjust the number of results per page via the `page[size]` query parameter, e.g. `?page[size]=25`. **Default**: 20. **Max**: 100.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Read` `Profiles Read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
list_id = 'Y6nRLr' # String | Primary key that uniquely identifies this list. Generated by Klaviyo.
opts = {
additional_fields_profile: ['predictive_analytics'], # Array | Request additional fields not included by default in the response. Supported values: 'predictive_analytics'
fields_profile: ['email'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#filtering
Allowed field(s)/operator(s):
`email`: `any`
`phone_number`: `any`
`push_token`: `any`
`_kx`: `equals`
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination
page_size: 56 # Integer | The number of results to return per page. Default = 20. Max = 100
}
begin
# Get List Profiles
result = api_instance.get_list_profiles(list_id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_profiles: #{e}"
end
```
#### Using the get_list_profiles_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_list_profiles_with_http_info(list_id, opts)
```ruby
begin
# Get List Profiles
data, status_code, headers = api_instance.get_list_profiles_with_http_info(list_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **list_id** | **String** | Primary key that uniquely identifies this list. Generated by Klaviyo. | |
| **additional_fields_profile** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'predictive_analytics' | [optional] |
| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets | [optional] |
| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`email`: `any`<br>`phone_number`: `any`<br>`push_token`: `any`<br>`_kx`: `equals` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | The number of results to return per page. Default = 20. Max = 100 | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_list_relationships_profiles
> Hash<String, Object> get_list_relationships_profiles(id, opts)
Get List Relationships Profiles
Get profile membership [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for a list with the given list ID. You can adjust the number of results per page via the `page[size]` query parameter, e.g. `?page[size]=25`. **Default**: 20. **Max**: 100.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Read` `Profiles Read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'id_example' # String |
opts = {
page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination
}
begin
# Get List Relationships Profiles
result = api_instance.get_list_relationships_profiles(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_relationships_profiles: #{e}"
end
```
#### Using the get_list_relationships_profiles_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_list_relationships_profiles_with_http_info(id, opts)
```ruby
begin
# Get List Relationships Profiles
data, status_code, headers = api_instance.get_list_relationships_profiles_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_relationships_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_list_relationships_tags
> Hash<String, Object> get_list_relationships_tags(id)
Get List Relationships Tags
Returns the tag IDs of all tags associated with the given list.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `List Read` `Tags Read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'id_example' # String |
begin
# Get List Relationships Tags
result = api_instance.get_list_relationships_tags(id)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_relationships_tags: #{e}"
end
```
#### Using the get_list_relationships_tags_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_list_relationships_tags_with_http_info(id)
```ruby
begin
# Get List Relationships Tags
data, status_code, headers = api_instance.get_list_relationships_tags_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_relationships_tags_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_list_tags
> Hash<String, Object> get_list_tags(list_id, opts)
Get List Tags
Return all tags associated with the given list ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `List Read` `Tags Read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
list_id = 'Y6nRLr' # String | Primary key that uniquely identifies this list. Generated by Klaviyo.
opts = {
fields_tag: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
}
begin
# Get List Tags
result = api_instance.get_list_tags(list_id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_tags: #{e}"
end
```
#### Using the get_list_tags_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_list_tags_with_http_info(list_id, opts)
```ruby
begin
# Get List Tags
data, status_code, headers = api_instance.get_list_tags_with_http_info(list_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_list_tags_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **list_id** | **String** | Primary key that uniquely identifies this list. Generated by Klaviyo. | |
| **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_lists
> Hash<String, Object> get_lists(opts)
Get Lists
Get all lists in an account. Filter to request a subset of all lists. Lists can be filtered by `id`, `name`, `created`, and `updated` fields. Returns a maximum of 10 results per page.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
opts = {
fields_list: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#filtering
Allowed field(s)/operator(s):
`name`: `any`, `equals`
`id`: `any`, `equals`
`created`: `greater-than`
`updated`: `greater-than`
page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination
}
begin
# Get Lists
result = api_instance.get_lists(opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_lists: #{e}"
end
```
#### Using the get_lists_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_lists_with_http_info(opts)
```ruby
begin
# Get Lists
data, status_code, headers = api_instance.get_lists_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->get_lists_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets | [optional] |
| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## update_list
> Hash<String, Object> update_list(id, list_partial_update_query)
Update List
Update the name of a list with the given list ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `List Write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ListsApi.new
id = 'Y6nRLr' # String | Primary key that uniquely identifies this list. Generated by Klaviyo.
list_partial_update_query = KlaviyoAPI::ListPartialUpdateQuery.new({data: KlaviyoAPI::ListPartialUpdateQueryResourceObject.new({type: KlaviyoAPI::ListEnum::LIST, id: 'Y6nRLr', attributes: KlaviyoAPI::ListCreateQueryResourceObjectAttributes.new({name: 'Newsletter'})})}) # ListPartialUpdateQuery |
begin
# Update List
result = api_instance.update_list(id, list_partial_update_query)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->update_list: #{e}"
end
```
#### Using the update_list_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> update_list_with_http_info(id, list_partial_update_query)
```ruby
begin
# Update List
data, status_code, headers = api_instance.update_list_with_http_info(id, list_partial_update_query)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ListsApi->update_list_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | Primary key that uniquely identifies this list. Generated by Klaviyo. | |
| **list_partial_update_query** | [**ListPartialUpdateQuery**](ListPartialUpdateQuery.md) | | |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json