# 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/{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/{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:** `lists: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](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api) to receive email marketing, SMS marketing, or both. This endpoint accepts a maximum of 1000 profiles per call.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists: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: KlaviyoAPI::ProfileEnum::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:** `lists: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](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api) 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:** `lists: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: KlaviyoAPI::ProfileEnum::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: `75/s`
Steady: `700/m`

Rate limits when using the `additional-fields[list]=profile_count` parameter in your API request:
Burst: `1/s`
Steady: `15/m`

To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-06-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `lists: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 = 'Y6nRLr' # String | Primary key that uniquely identifies this list. Generated by Klaviyo. opts = { additional_fields_list: ['profile_count'], # Array | Request additional fields not included by default in the response. Supported values: 'profile_count' fields_list: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets fields_tag: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets include: ['tags'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships } 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. | | | **additional_fields_list** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'profile_count' | [optional] | | **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] | | **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] | | **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships | [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(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`, `push_token`, and `joined_group_at` fields. Profiles can be sorted by the following fields, in ascending and descending order: `joined_group_at`

*Rate limits*:
Burst: `75/s`
Steady: `700/m`

Rate limits when using the `additional-fields[profile]=predictive_analytics` parameter in your API request:
Burst: `10/s`
Steady: `150/m`

To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-06-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `lists: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 = { additional_fields_profile: ['subscriptions'], # Array | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' fields_profile: ['email'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`email`: `any`, `equals`
`phone_number`: `any`, `equals`
`push_token`: `any`, `equals`
`_kx`: `equals`
`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination page_size: 56, # Integer | Default: 20. Min: 1. Max: 100. sort: 'joined_group_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting } begin # Get List Profiles result = api_instance.get_list_profiles(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(id, opts) ```ruby begin # Get List Profiles data, status_code, headers = api_instance.get_list_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_profiles_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **additional_fields_profile** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' | [optional] | | **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] | | **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] | | **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination | [optional] | | **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] | | **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting | [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.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `lists: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 = { filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`email`: `any`, `equals`
`phone_number`: `any`, `equals`
`push_token`: `any`, `equals`
`_kx`: `equals`
`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination page_size: 56, # Integer | Default: 20. Min: 1. Max: 1000. sort: 'joined_group_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting } 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** | | | | **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] | | **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination | [optional] | | **page_size** | **Integer** | Default: 20. Min: 1. Max: 1000. | [optional][default to 20] | | **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting | [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:** `lists: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(id, opts) Get List Tags Return all tags associated with the given list ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `lists: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 | opts = { fields_tag: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets } begin # Get List Tags result = api_instance.get_list_tags(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(id, opts) ```ruby begin # Get List Tags data, status_code, headers = api_instance.get_list_tags_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_tags_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/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: `75/s`
Steady: `700/m` **Scopes:** `lists: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/v2024-06-15/reference/api-overview#sparse-fieldsets fields_tag: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`name`: `any`, `equals`
`id`: `any`, `equals`
`created`: `greater-than`
`updated`: `greater-than` include: ['tags'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination sort: 'created' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting } 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/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] | | **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] | | **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/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] | | **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships | [optional] | | **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination | [optional] | | **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting | [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:** `lists: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