# KlaviyoAPI::TagsApi All URIs are relative to *https://a.klaviyo.com* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**create_tag**](TagsApi.md#create_tag) | **POST** /api/tags/ | Create Tag | | [**create_tag_group**](TagsApi.md#create_tag_group) | **POST** /api/tag-groups/ | Create Tag Group | | [**create_tag_relationships_campaigns**](TagsApi.md#create_tag_relationships_campaigns) | **POST** /api/tags/{id}/relationships/campaigns/ | Create Tag Relationships Campaigns | | [**create_tag_relationships_flows**](TagsApi.md#create_tag_relationships_flows) | **POST** /api/tags/{id}/relationships/flows/ | Create Tag Relationships Flows | | [**create_tag_relationships_lists**](TagsApi.md#create_tag_relationships_lists) | **POST** /api/tags/{id}/relationships/lists/ | Create Tag Relationships Lists | | [**create_tag_relationships_segments**](TagsApi.md#create_tag_relationships_segments) | **POST** /api/tags/{id}/relationships/segments/ | Create Tag Relationships Segments | | [**delete_tag**](TagsApi.md#delete_tag) | **DELETE** /api/tags/{id}/ | Delete Tag | | [**delete_tag_group**](TagsApi.md#delete_tag_group) | **DELETE** /api/tag-groups/{id}/ | Delete Tag Group | | [**delete_tag_relationships_campaigns**](TagsApi.md#delete_tag_relationships_campaigns) | **DELETE** /api/tags/{id}/relationships/campaigns/ | Delete Tag Relationships Campaigns | | [**delete_tag_relationships_flows**](TagsApi.md#delete_tag_relationships_flows) | **DELETE** /api/tags/{id}/relationships/flows/ | Delete Tag Relationships Flows | | [**delete_tag_relationships_lists**](TagsApi.md#delete_tag_relationships_lists) | **DELETE** /api/tags/{id}/relationships/lists/ | Delete Tag Relationships Lists | | [**delete_tag_relationships_segments**](TagsApi.md#delete_tag_relationships_segments) | **DELETE** /api/tags/{id}/relationships/segments/ | Delete Tag Relationships Segments | | [**get_tag**](TagsApi.md#get_tag) | **GET** /api/tags/{id}/ | Get Tag | | [**get_tag_group**](TagsApi.md#get_tag_group) | **GET** /api/tag-groups/{id}/ | Get Tag Group | | [**get_tag_group_relationships_tags**](TagsApi.md#get_tag_group_relationships_tags) | **GET** /api/tag-groups/{id}/relationships/tags/ | Get Tag Group Relationships Tags | | [**get_tag_group_tags**](TagsApi.md#get_tag_group_tags) | **GET** /api/tag-groups/{id}/tags/ | Get Tag Group Tags | | [**get_tag_groups**](TagsApi.md#get_tag_groups) | **GET** /api/tag-groups/ | Get Tag Groups | | [**get_tag_relationships_campaigns**](TagsApi.md#get_tag_relationships_campaigns) | **GET** /api/tags/{id}/relationships/campaigns/ | Get Tag Relationships Campaigns | | [**get_tag_relationships_flows**](TagsApi.md#get_tag_relationships_flows) | **GET** /api/tags/{id}/relationships/flows/ | Get Tag Relationships Flows | | [**get_tag_relationships_lists**](TagsApi.md#get_tag_relationships_lists) | **GET** /api/tags/{id}/relationships/lists/ | Get Tag Relationships Lists | | [**get_tag_relationships_segments**](TagsApi.md#get_tag_relationships_segments) | **GET** /api/tags/{id}/relationships/segments/ | Get Tag Relationships Segments | | [**get_tag_relationships_tag_group**](TagsApi.md#get_tag_relationships_tag_group) | **GET** /api/tags/{id}/relationships/tag-group/ | Get Tag Relationships Tag Group | | [**get_tag_tag_group**](TagsApi.md#get_tag_tag_group) | **GET** /api/tags/{id}/tag-group/ | Get Tag Tag Group | | [**get_tags**](TagsApi.md#get_tags) | **GET** /api/tags/ | Get Tags | | [**update_tag**](TagsApi.md#update_tag) | **PATCH** /api/tags/{id}/ | Update Tag | | [**update_tag_group**](TagsApi.md#update_tag_group) | **PATCH** /api/tag-groups/{id}/ | Update Tag Group | ## create_tag > Hash<String, Object> create_tag(tag_create_query) Create Tag Create a tag. An account cannot have more than **500** unique tags. A tag belongs to a single tag group. If the `tag_group_id` is not specified, the tag is added to the account's default tag group.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags: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::TagsApi.new tag_create_query = KlaviyoAPI::TagCreateQuery.new({data: KlaviyoAPI::TagCreateQueryResourceObject.new({type: KlaviyoAPI::TagEnum::TAG, attributes: KlaviyoAPI::TagCreateQueryResourceObjectAttributes.new({name: 'My Tag'})})}) # TagCreateQuery | begin # Create Tag result = api_instance.create_tag(tag_create_query) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag: #{e}" end ``` #### Using the create_tag_with_http_info variant This returns an Array which contains the response data, status code and headers. > create_tag_with_http_info(tag_create_query) ```ruby begin # Create Tag data, status_code, headers = api_instance.create_tag_with_http_info(tag_create_query) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **tag_create_query** | [**TagCreateQuery**](TagCreateQuery.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_tag_group > Hash<String, Object> create_tag_group(tag_group_create_query) Create Tag Group Create a tag group. An account cannot have more than **50** unique tag groups. If `exclusive` is not specified `true` or `false`, the tag group defaults to non-exclusive. If a tag group is non-exclusive, any given related resource (campaign, flow, etc.) can be linked to multiple tags from that tag group. If a tag group is exclusive, any given related resource can only be linked to one tag from that tag group.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags: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::TagsApi.new tag_group_create_query = KlaviyoAPI::TagGroupCreateQuery.new({data: KlaviyoAPI::TagGroupCreateQueryResourceObject.new({type: KlaviyoAPI::TagGroupEnum::TAG_GROUP, attributes: KlaviyoAPI::TagGroupCreateQueryResourceObjectAttributes.new({name: 'My Tag Group'})})}) # TagGroupCreateQuery | begin # Create Tag Group result = api_instance.create_tag_group(tag_group_create_query) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_group: #{e}" end ``` #### Using the create_tag_group_with_http_info variant This returns an Array which contains the response data, status code and headers. > create_tag_group_with_http_info(tag_group_create_query) ```ruby begin # Create Tag Group data, status_code, headers = api_instance.create_tag_group_with_http_info(tag_group_create_query) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_group_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **tag_group_create_query** | [**TagGroupCreateQuery**](TagGroupCreateQuery.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_tag_relationships_campaigns > create_tag_relationships_campaigns(id, tag_campaign_op) Create Tag Relationships Campaigns Associate a tag with one or more campaigns. Any campaign cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the campaign(s) that will be associated with the tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `campaigns:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_campaign_op = KlaviyoAPI::TagCampaignOp.new({data: [KlaviyoAPI::TagCampaignOpDataInner.new({type: KlaviyoAPI::CampaignEnum::CAMPAIGN, id: 'id_example'})]}) # TagCampaignOp | begin # Create Tag Relationships Campaigns api_instance.create_tag_relationships_campaigns(id, tag_campaign_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_campaigns: #{e}" end ``` #### Using the create_tag_relationships_campaigns_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > create_tag_relationships_campaigns_with_http_info(id, tag_campaign_op) ```ruby begin # Create Tag Relationships Campaigns data, status_code, headers = api_instance.create_tag_relationships_campaigns_with_http_info(id, tag_campaign_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_campaigns_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_campaign_op** | [**TagCampaignOp**](TagCampaignOp.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 ## create_tag_relationships_flows > create_tag_relationships_flows(id, tag_flow_op) Create Tag Relationships Flows Associate a tag with one or more flows. Any flow cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the flow(s) that will be associated with the tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_flow_op = KlaviyoAPI::TagFlowOp.new({data: [KlaviyoAPI::TagFlowOpDataInner.new({type: KlaviyoAPI::FlowEnum::FLOW, id: 'id_example'})]}) # TagFlowOp | begin # Create Tag Relationships Flows api_instance.create_tag_relationships_flows(id, tag_flow_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_flows: #{e}" end ``` #### Using the create_tag_relationships_flows_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > create_tag_relationships_flows_with_http_info(id, tag_flow_op) ```ruby begin # Create Tag Relationships Flows data, status_code, headers = api_instance.create_tag_relationships_flows_with_http_info(id, tag_flow_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_flows_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_flow_op** | [**TagFlowOp**](TagFlowOp.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 ## create_tag_relationships_lists > create_tag_relationships_lists(id, tag_list_op) Create Tag Relationships Lists Associate a tag with one or more lists. Any list cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the lists(s) that will be associated with the tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `list:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_list_op = KlaviyoAPI::TagListOp.new({data: [KlaviyoAPI::TagListOpDataInner.new({type: KlaviyoAPI::ListEnum::LIST, id: 'id_example'})]}) # TagListOp | begin # Create Tag Relationships Lists api_instance.create_tag_relationships_lists(id, tag_list_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_lists: #{e}" end ``` #### Using the create_tag_relationships_lists_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > create_tag_relationships_lists_with_http_info(id, tag_list_op) ```ruby begin # Create Tag Relationships Lists data, status_code, headers = api_instance.create_tag_relationships_lists_with_http_info(id, tag_list_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_lists_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_list_op** | [**TagListOp**](TagListOp.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 ## create_tag_relationships_segments > create_tag_relationships_segments(id, tag_segment_op) Create Tag Relationships Segments Associate a tag with one or more segments. Any segment cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the segments(s) that will be associated with the tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_segment_op = KlaviyoAPI::TagSegmentOp.new({data: [KlaviyoAPI::TagSegmentOpDataInner.new({type: KlaviyoAPI::SegmentEnum::SEGMENT, id: 'id_example'})]}) # TagSegmentOp | begin # Create Tag Relationships Segments api_instance.create_tag_relationships_segments(id, tag_segment_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_segments: #{e}" end ``` #### Using the create_tag_relationships_segments_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > create_tag_relationships_segments_with_http_info(id, tag_segment_op) ```ruby begin # Create Tag Relationships Segments data, status_code, headers = api_instance.create_tag_relationships_segments_with_http_info(id, tag_segment_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->create_tag_relationships_segments_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_segment_op** | [**TagSegmentOp**](TagSegmentOp.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_tag > delete_tag(id) Delete Tag Delete the tag with the given tag ID. Any associations between the tag and other resources will also be removed.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags: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::TagsApi.new id = 'abcd1234-ef56-gh78-ij90-abcdef123456' # String | The Tag ID begin # Delete Tag api_instance.delete_tag(id) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag: #{e}" end ``` #### Using the delete_tag_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > delete_tag_with_http_info(id) ```ruby begin # Delete Tag data, status_code, headers = api_instance.delete_tag_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The Tag ID | | ### 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_tag_group > Hash<String, Object> delete_tag_group(id) Delete Tag Group Delete the tag group with the given tag group ID. Any tags inside that tag group, and any associations between those tags and other resources, will also be removed. The default tag group cannot be deleted.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags: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::TagsApi.new id = 'zyxw9876-vu54-ts32-rq10-zyxwvu654321' # String | The Tag Group ID begin # Delete Tag Group result = api_instance.delete_tag_group(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_group: #{e}" end ``` #### Using the delete_tag_group_with_http_info variant This returns an Array which contains the response data, status code and headers. > delete_tag_group_with_http_info(id) ```ruby begin # Delete Tag Group data, status_code, headers = api_instance.delete_tag_group_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_group_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The Tag Group ID | | ### Return type **Hash<String, Object>** ### Authorization [Klaviyo-API-Key](../README.md#Klaviyo-API-Key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## delete_tag_relationships_campaigns > delete_tag_relationships_campaigns(id, tag_campaign_op) Delete Tag Relationships Campaigns Remove a tag's association with one or more campaigns. Use the request body to pass in the ID(s) of the campaign(s) whose association with the tag will be removed.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `campaigns:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_campaign_op = KlaviyoAPI::TagCampaignOp.new({data: [KlaviyoAPI::TagCampaignOpDataInner.new({type: KlaviyoAPI::CampaignEnum::CAMPAIGN, id: 'id_example'})]}) # TagCampaignOp | begin # Delete Tag Relationships Campaigns api_instance.delete_tag_relationships_campaigns(id, tag_campaign_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_campaigns: #{e}" end ``` #### Using the delete_tag_relationships_campaigns_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > delete_tag_relationships_campaigns_with_http_info(id, tag_campaign_op) ```ruby begin # Delete Tag Relationships Campaigns data, status_code, headers = api_instance.delete_tag_relationships_campaigns_with_http_info(id, tag_campaign_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_campaigns_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_campaign_op** | [**TagCampaignOp**](TagCampaignOp.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_tag_relationships_flows > delete_tag_relationships_flows(id, tag_flow_op) Delete Tag Relationships Flows Remove a tag's association with one or more flows. Use the request body to pass in the ID(s) of the flows(s) whose association with the tag will be removed.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_flow_op = KlaviyoAPI::TagFlowOp.new({data: [KlaviyoAPI::TagFlowOpDataInner.new({type: KlaviyoAPI::FlowEnum::FLOW, id: 'id_example'})]}) # TagFlowOp | begin # Delete Tag Relationships Flows api_instance.delete_tag_relationships_flows(id, tag_flow_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_flows: #{e}" end ``` #### Using the delete_tag_relationships_flows_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > delete_tag_relationships_flows_with_http_info(id, tag_flow_op) ```ruby begin # Delete Tag Relationships Flows data, status_code, headers = api_instance.delete_tag_relationships_flows_with_http_info(id, tag_flow_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_flows_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_flow_op** | [**TagFlowOp**](TagFlowOp.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_tag_relationships_lists > delete_tag_relationships_lists(id, tag_list_op) Delete Tag Relationships Lists Remove a tag's association with one or more lists. Use the request body to pass in the ID(s) of the list(s) whose association with the tag will be removed.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `list:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_list_op = KlaviyoAPI::TagListOp.new({data: [KlaviyoAPI::TagListOpDataInner.new({type: KlaviyoAPI::ListEnum::LIST, id: 'id_example'})]}) # TagListOp | begin # Delete Tag Relationships Lists api_instance.delete_tag_relationships_lists(id, tag_list_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_lists: #{e}" end ``` #### Using the delete_tag_relationships_lists_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > delete_tag_relationships_lists_with_http_info(id, tag_list_op) ```ruby begin # Delete Tag Relationships Lists data, status_code, headers = api_instance.delete_tag_relationships_lists_with_http_info(id, tag_list_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_lists_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_list_op** | [**TagListOp**](TagListOp.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_tag_relationships_segments > delete_tag_relationships_segments(id, tag_segment_op) Delete Tag Relationships Segments Remove a tag's association with one or more segments. Use the request body to pass in the ID(s) of the segments(s) whose association with the tag will be removed.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:write` `tags: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::TagsApi.new id = 'id_example' # String | tag_segment_op = KlaviyoAPI::TagSegmentOp.new({data: [KlaviyoAPI::TagSegmentOpDataInner.new({type: KlaviyoAPI::SegmentEnum::SEGMENT, id: 'id_example'})]}) # TagSegmentOp | begin # Delete Tag Relationships Segments api_instance.delete_tag_relationships_segments(id, tag_segment_op) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_segments: #{e}" end ``` #### Using the delete_tag_relationships_segments_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > delete_tag_relationships_segments_with_http_info(id, tag_segment_op) ```ruby begin # Delete Tag Relationships Segments data, status_code, headers = api_instance.delete_tag_relationships_segments_with_http_info(id, tag_segment_op) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->delete_tag_relationships_segments_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **tag_segment_op** | [**TagSegmentOp**](TagSegmentOp.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_tag > Hash<String, Object> get_tag(id, opts) Get Tag Retrieve the tag with the given tag ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new id = 'abcd1234-ef56-gh78-ij90-abcdef123456' # String | The Tag ID opts = { fields_tag_group: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets fields_tag: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets include: ['tag-group'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#relationships } begin # Get Tag result = api_instance.get_tag(id, opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag: #{e}" end ``` #### Using the get_tag_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_with_http_info(id, opts) ```ruby begin # Get Tag data, status_code, headers = api_instance.get_tag_with_http_info(id, opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The Tag ID | | | **fields_tag_group** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets | [optional] | | **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets | [optional] | | **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-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_tag_group > Hash<String, Object> get_tag_group(id, opts) Get Tag Group Retrieve the tag group with the given tag group ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new id = 'zyxw9876-vu54-ts32-rq10-zyxwvu654321' # String | The Tag Group ID opts = { fields_tag_group: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets } begin # Get Tag Group result = api_instance.get_tag_group(id, opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_group: #{e}" end ``` #### Using the get_tag_group_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_group_with_http_info(id, opts) ```ruby begin # Get Tag Group data, status_code, headers = api_instance.get_tag_group_with_http_info(id, opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_group_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The Tag Group ID | | | **fields_tag_group** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-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_tag_group_relationships_tags > Hash<String, Object> get_tag_group_relationships_tags(id) Get Tag Group Relationships Tags Returns the tag IDs of all tags inside the given tag group.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new id = 'id_example' # String | begin # Get Tag Group Relationships Tags result = api_instance.get_tag_group_relationships_tags(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_group_relationships_tags: #{e}" end ``` #### Using the get_tag_group_relationships_tags_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_group_relationships_tags_with_http_info(id) ```ruby begin # Get Tag Group Relationships Tags data, status_code, headers = api_instance.get_tag_group_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 TagsApi->get_tag_group_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_tag_group_tags > Hash<String, Object> get_tag_group_tags(id, opts) Get Tag Group Tags Return the tags for a given tag group ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new id = 'id_example' # String | opts = { fields_tag: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets } begin # Get Tag Group Tags result = api_instance.get_tag_group_tags(id, opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_group_tags: #{e}" end ``` #### Using the get_tag_group_tags_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_group_tags_with_http_info(id, opts) ```ruby begin # Get Tag Group Tags data, status_code, headers = api_instance.get_tag_group_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 TagsApi->get_tag_group_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/v2023-08-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_tag_groups > Hash<String, Object> get_tag_groups(opts) Get Tag Groups List all tag groups in an account. Every account has one default tag group. Tag groups can be filtered by `name`, `exclusive`, and `default`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 25 tag groups per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new opts = { fields_tag_group: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`name`: `contains`, `ends-with`, `equals`, `starts-with`
`exclusive`: `equals`
`default`: `equals` page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#pagination sort: 'id' # String | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sorting } begin # Get Tag Groups result = api_instance.get_tag_groups(opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_groups: #{e}" end ``` #### Using the get_tag_groups_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_groups_with_http_info(opts) ```ruby begin # Get Tag Groups data, status_code, headers = api_instance.get_tag_groups_with_http_info(opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_groups_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **fields_tag_group** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets | [optional] | | **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`<br>`exclusive`: `equals`<br>`default`: `equals` | [optional] | | **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#pagination | [optional] | | **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-08-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_tag_relationships_campaigns > Hash<String, Object> get_tag_relationships_campaigns(id) Get Tag Relationships Campaigns Returns the IDs of all campaigns associated with the given tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `campaigns: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::TagsApi.new id = 'id_example' # String | begin # Get Tag Relationships Campaigns result = api_instance.get_tag_relationships_campaigns(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_campaigns: #{e}" end ``` #### Using the get_tag_relationships_campaigns_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_relationships_campaigns_with_http_info(id) ```ruby begin # Get Tag Relationships Campaigns data, status_code, headers = api_instance.get_tag_relationships_campaigns_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_campaigns_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_tag_relationships_flows > Hash<String, Object> get_tag_relationships_flows(id) Get Tag Relationships Flows Returns the IDs of all flows associated with the given tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows: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::TagsApi.new id = 'id_example' # String | begin # Get Tag Relationships Flows result = api_instance.get_tag_relationships_flows(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_flows: #{e}" end ``` #### Using the get_tag_relationships_flows_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_relationships_flows_with_http_info(id) ```ruby begin # Get Tag Relationships Flows data, status_code, headers = api_instance.get_tag_relationships_flows_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_flows_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_tag_relationships_lists > Hash<String, Object> get_tag_relationships_lists(id) Get Tag Relationships Lists Returns the IDs of all lists associated with the given tag.

*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::TagsApi.new id = 'id_example' # String | begin # Get Tag Relationships Lists result = api_instance.get_tag_relationships_lists(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_lists: #{e}" end ``` #### Using the get_tag_relationships_lists_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_relationships_lists_with_http_info(id) ```ruby begin # Get Tag Relationships Lists data, status_code, headers = api_instance.get_tag_relationships_lists_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_lists_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_tag_relationships_segments > Hash<String, Object> get_tag_relationships_segments(id) Get Tag Relationships Segments Returns the IDs of all segments associated with the given tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments: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::TagsApi.new id = 'id_example' # String | begin # Get Tag Relationships Segments result = api_instance.get_tag_relationships_segments(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_segments: #{e}" end ``` #### Using the get_tag_relationships_segments_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_relationships_segments_with_http_info(id) ```ruby begin # Get Tag Relationships Segments data, status_code, headers = api_instance.get_tag_relationships_segments_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_segments_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_tag_relationships_tag_group > Hash<String, Object> get_tag_relationships_tag_group(id) Get Tag Relationships Tag Group Returns the id of the tag group related to the given tag.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new id = 'id_example' # String | begin # Get Tag Relationships Tag Group result = api_instance.get_tag_relationships_tag_group(id) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_tag_group: #{e}" end ``` #### Using the get_tag_relationships_tag_group_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_relationships_tag_group_with_http_info(id) ```ruby begin # Get Tag Relationships Tag Group data, status_code, headers = api_instance.get_tag_relationships_tag_group_with_http_info(id) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_relationships_tag_group_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_tag_tag_group > Hash<String, Object> get_tag_tag_group(id, opts) Get Tag Tag Group Returns the tag group resource for a given tag ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new id = 'id_example' # String | opts = { fields_tag_group: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets } begin # Get Tag Tag Group result = api_instance.get_tag_tag_group(id, opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_tag_group: #{e}" end ``` #### Using the get_tag_tag_group_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tag_tag_group_with_http_info(id, opts) ```ruby begin # Get Tag Tag Group data, status_code, headers = api_instance.get_tag_tag_group_with_http_info(id, opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tag_tag_group_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **fields_tag_group** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-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_tags > Hash<String, Object> get_tags(opts) Get Tags List all tags in an account. Tags can be filtered by `name`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 50 tags per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `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::TagsApi.new opts = { fields_tag_group: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets fields_tag: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`name`: `contains`, `ends-with`, `equals`, `starts-with` include: ['tag-group'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#relationships page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#pagination sort: 'id' # String | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sorting } begin # Get Tags result = api_instance.get_tags(opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tags: #{e}" end ``` #### Using the get_tags_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_tags_with_http_info(opts) ```ruby begin # Get Tags data, status_code, headers = api_instance.get_tags_with_http_info(opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->get_tags_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **fields_tag_group** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets | [optional] | | **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#sparse-fieldsets | [optional] | | **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `contains`, `ends-with`, `equals`, `starts-with` | [optional] | | **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#relationships | [optional] | | **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-08-15/reference/api-overview#pagination | [optional] | | **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-08-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_tag > update_tag(id, tag_update_query) Update Tag Update the tag with the given tag ID. Only a tag's `name` can be changed. A tag cannot be moved from one tag group to another.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags: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::TagsApi.new id = 'abcd1234-ef56-gh78-ij90-abcdef123456' # String | The Tag ID tag_update_query = KlaviyoAPI::TagUpdateQuery.new({data: KlaviyoAPI::TagUpdateQueryResourceObject.new({type: KlaviyoAPI::TagEnum::TAG, id: 'abcd1234-ef56-gh78-ij90-abcdef123456', attributes: KlaviyoAPI::TagCreateQueryResourceObjectAttributes.new({name: 'My Tag'})})}) # TagUpdateQuery | begin # Update Tag api_instance.update_tag(id, tag_update_query) rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->update_tag: #{e}" end ``` #### Using the update_tag_with_http_info variant This returns an Array which contains the response data (`nil` in this case), status code and headers. > update_tag_with_http_info(id, tag_update_query) ```ruby begin # Update Tag data, status_code, headers = api_instance.update_tag_with_http_info(id, tag_update_query) p status_code # => 2xx p headers # => { ... } p data # => nil rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->update_tag_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The Tag ID | | | **tag_update_query** | [**TagUpdateQuery**](TagUpdateQuery.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 ## update_tag_group > Hash<String, Object> update_tag_group(id, tag_group_update_query) Update Tag Group Update the tag group with the given tag group ID. Only a tag group's `name` can be changed. A tag group's `exclusive` or `default` value cannot be changed.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags: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::TagsApi.new id = 'zyxw9876-vu54-ts32-rq10-zyxwvu654321' # String | The Tag Group ID tag_group_update_query = KlaviyoAPI::TagGroupUpdateQuery.new({data: KlaviyoAPI::TagGroupUpdateQueryResourceObject.new({type: KlaviyoAPI::TagGroupEnum::TAG_GROUP, id: 'zyxw9876-vu54-ts32-rq10-zyxwvu654321', attributes: KlaviyoAPI::TagGroupUpdateQueryResourceObjectAttributes.new({name: 'My Tag Group'})})}) # TagGroupUpdateQuery | begin # Update Tag Group result = api_instance.update_tag_group(id, tag_group_update_query) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->update_tag_group: #{e}" end ``` #### Using the update_tag_group_with_http_info variant This returns an Array which contains the response data, status code and headers. > update_tag_group_with_http_info(id, tag_group_update_query) ```ruby begin # Update Tag Group data, status_code, headers = api_instance.update_tag_group_with_http_info(id, tag_group_update_query) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling TagsApi->update_tag_group_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The Tag Group ID | | | **tag_group_update_query** | [**TagGroupUpdateQuery**](TagGroupUpdateQuery.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