# KlaviyoAPI::ProfilesApi
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**create_profile**](ProfilesApi.md#create_profile) | **POST** /api/profiles/ | Create Profile |
| [**get_profile**](ProfilesApi.md#get_profile) | **GET** /api/profiles/{id}/ | Get Profile |
| [**get_profile_lists**](ProfilesApi.md#get_profile_lists) | **GET** /api/profiles/{profile_id}/lists/ | Get Profile Lists |
| [**get_profile_relationships_lists**](ProfilesApi.md#get_profile_relationships_lists) | **GET** /api/profiles/{id}/relationships/lists/ | Get Profile Relationships Lists |
| [**get_profile_relationships_segments**](ProfilesApi.md#get_profile_relationships_segments) | **GET** /api/profiles/{id}/relationships/segments/ | Get Profile Relationships Segments |
| [**get_profile_segments**](ProfilesApi.md#get_profile_segments) | **GET** /api/profiles/{profile_id}/segments/ | Get Profile Segments |
| [**get_profiles**](ProfilesApi.md#get_profiles) | **GET** /api/profiles/ | Get Profiles |
| [**subscribe_profiles**](ProfilesApi.md#subscribe_profiles) | **POST** /api/profile-subscription-bulk-create-jobs/ | Subscribe Profiles |
| [**suppress_profiles**](ProfilesApi.md#suppress_profiles) | **POST** /api/profile-suppression-bulk-create-jobs/ | Suppress Profiles |
| [**unsubscribe_profiles**](ProfilesApi.md#unsubscribe_profiles) | **POST** /api/profile-unsubscription-bulk-create-jobs/ | Unsubscribe Profiles |
| [**unsuppress_profiles**](ProfilesApi.md#unsuppress_profiles) | **POST** /api/profile-unsuppression-bulk-create-jobs/ | Unsuppress Profiles |
| [**update_profile**](ProfilesApi.md#update_profile) | **PATCH** /api/profiles/{id}/ | Update Profile |
## create_profile
> Hash<String, Object> create_profile(profile_create_query, opts)
Create Profile
Create a new profile. If you use a phone number as the profile identifier and SMS is not set up in the Klaviyo account, you'll need to include at least one other identifier attribute (`email` or `external_id`) in addition to the `phone_number` attribute for the API call to work.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `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::ProfilesApi.new
profile_create_query = KlaviyoAPI::ProfileCreateQuery.new({data: KlaviyoAPI::ProfileCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::ProfileCreateQueryResourceObjectAttributes.new})}) # ProfileCreateQuery |
opts = {
additional_fields_profile: ['predictive_analytics'] # Array | Request additional fields not included by default in the response. Supported values: 'predictive_analytics'
}
begin
# Create Profile
result = api_instance.create_profile(profile_create_query, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->create_profile: #{e}"
end
```
#### Using the create_profile_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> create_profile_with_http_info(profile_create_query, opts)
```ruby
begin
# Create Profile
data, status_code, headers = api_instance.create_profile_with_http_info(profile_create_query, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->create_profile_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **profile_create_query** | [**ProfileCreateQuery**](ProfileCreateQuery.md) | | |
| **additional_fields_profile** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'predictive_analytics' | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## get_profile
> Hash<String, Object> get_profile(id, opts)
Get Profile
Get the profile with the given profile ID. Include parameters can be provided to get the following related resource data: `lists` memberships, `segments` memberships\"
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `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::ProfilesApi.new
id = 'id_example' # String |
opts = {
additional_fields_profile: ['predictive_analytics'], # Array | Request additional fields not included by default in the response. Supported values: 'predictive_analytics'
fields_list: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
fields_profile: ['email'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
fields_segment: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
include: ['lists'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#relationships
}
begin
# Get Profile
result = api_instance.get_profile(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile: #{e}"
end
```
#### Using the get_profile_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_profile_with_http_info(id, opts)
```ruby
begin
# Get Profile
data, status_code, headers = api_instance.get_profile_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_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: 'predictive_analytics' | [optional] |
| **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] |
| **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] |
| **fields_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets | [optional] |
| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/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_profile_lists
> Hash<String, Object> get_profile_lists(profile_id, opts)
Get Profile Lists
Get list memberships for a profile with the given profile ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/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::ProfilesApi.new
profile_id = 'profile_id_example' # String |
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 Profile Lists
result = api_instance.get_profile_lists(profile_id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_lists: #{e}"
end
```
#### Using the get_profile_lists_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_profile_lists_with_http_info(profile_id, opts)
```ruby
begin
# Get Profile Lists
data, status_code, headers = api_instance.get_profile_lists_with_http_info(profile_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_lists_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **profile_id** | **String** | | |
| **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_profile_relationships_lists
> Hash<String, Object> get_profile_relationships_lists(id)
Get Profile Relationships Lists
Get list memberships for a profile with the given profile ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/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::ProfilesApi.new
id = 'id_example' # String |
begin
# Get Profile Relationships Lists
result = api_instance.get_profile_relationships_lists(id)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_relationships_lists: #{e}"
end
```
#### Using the get_profile_relationships_lists_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_profile_relationships_lists_with_http_info(id)
```ruby
begin
# Get Profile Relationships Lists
data, status_code, headers = api_instance.get_profile_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 ProfilesApi->get_profile_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_profile_relationships_segments
> Hash<String, Object> get_profile_relationships_segments(id)
Get Profile Relationships Segments
Get segment membership relationships for a profile with the given profile ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `Profiles Read` `Segments 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::ProfilesApi.new
id = 'id_example' # String |
begin
# Get Profile Relationships Segments
result = api_instance.get_profile_relationships_segments(id)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_relationships_segments: #{e}"
end
```
#### Using the get_profile_relationships_segments_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_profile_relationships_segments_with_http_info(id)
```ruby
begin
# Get Profile Relationships Segments
data, status_code, headers = api_instance.get_profile_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 ProfilesApi->get_profile_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_profile_segments
> Hash<String, Object> get_profile_segments(profile_id, opts)
Get Profile Segments
Get segment memberships for a profile with the given profile ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `Profiles Read` `Segments 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::ProfilesApi.new
profile_id = 'profile_id_example' # String |
opts = {
fields_segment: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
}
begin
# Get Profile Segments
result = api_instance.get_profile_segments(profile_id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_segments: #{e}"
end
```
#### Using the get_profile_segments_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_profile_segments_with_http_info(profile_id, opts)
```ruby
begin
# Get Profile Segments
data, status_code, headers = api_instance.get_profile_segments_with_http_info(profile_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profile_segments_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **profile_id** | **String** | | |
| **fields_segment** | [**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_profiles
> Hash<String, Object> get_profiles(opts)
Get Profiles
Get all profiles in an account. Profiles can be sorted by the following fields in ascending and descending order: `id`, `created`, `updated`, `email` 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:** `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::ProfilesApi.new
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):
`id`: `any`, `equals`
`email`: `any`, `equals`
`phone_number`: `any`, `equals`
`external_id`: `any`, `equals`
`_kx`: `equals`
`created`: `greater-than`, `less-than`
`updated`: `greater-than`, `less-than`
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination
sort: 'created', # String | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sorting
page_size: 56 # Integer | The number of results to return per page. Default = 20. Max = 100
}
begin
# Get Profiles
result = api_instance.get_profiles(opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profiles: #{e}"
end
```
#### Using the get_profiles_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_profiles_with_http_info(opts)
```ruby
begin
# Get Profiles
data, status_code, headers = api_instance.get_profiles_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **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>`id`: `any`, `equals`<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`external_id`: `any`, `equals`<br>`_kx`: `equals`<br>`created`: `greater-than`, `less-than`<br>`updated`: `greater-than`, `less-than` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#pagination | [optional] |
| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sorting | [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
## subscribe_profiles
> subscribe_profiles(subscription_create_job_create_query)
Subscribe Profiles
Subscribe one or more profiles to email marketing, SMS marketing, or both. If the list has double opt-in enabled, profiles will receive a message requiring their confirmation before subscribing. Otherwise, profiles will be immediately subscribed without receiving a confirmation message. To add someone to a list without changing their subscription status, use [Add Profile to List](https://developers.klaviyo.com/en/reference/create_list_relationships). This API will remove any `UNSUBSCRIBE`, `SPAM_REPORT` or `USER_SUPPRESSED` suppressions from the provided profiles. Learn more about suppressed profiles in [this document](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1). Maximum number of profile can be submitted for subscription: 100
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `List Write` `Profiles Write` `Subscriptions 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::ProfilesApi.new
subscription_create_job_create_query = KlaviyoAPI::SubscriptionCreateJobCreateQuery.new({data: KlaviyoAPI::SubscriptionCreateJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileSubscriptionBulkCreateJobEnum::PROFILE_SUBSCRIPTION_BULK_CREATE_JOB, attributes: KlaviyoAPI::SubscriptionCreateJobCreateQueryResourceObjectAttributes.new({list_id: 'Y6nRLr', subscriptions: [KlaviyoAPI::Subscription.new]})})}) # SubscriptionCreateJobCreateQuery | Subscribes one or more profiles to marketing. Currently, supports email and SMS only. All profiles will be added to the provided list. Either email or phone number is required. Both may be specified to subscribe to both channels. If a profile cannot be found matching the given identifier(s), a new profile will be created and then subscribed.
begin
# Subscribe Profiles
api_instance.subscribe_profiles(subscription_create_job_create_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->subscribe_profiles: #{e}"
end
```
#### Using the subscribe_profiles_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> subscribe_profiles_with_http_info(subscription_create_job_create_query)
```ruby
begin
# Subscribe Profiles
data, status_code, headers = api_instance.subscribe_profiles_with_http_info(subscription_create_job_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->subscribe_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **subscription_create_job_create_query** | [**SubscriptionCreateJobCreateQuery**](SubscriptionCreateJobCreateQuery.md) | Subscribes one or more profiles to marketing. Currently, supports email and SMS only. All profiles will be added to the provided list. Either email or phone number is required. Both may be specified to subscribe to both channels. If a profile cannot be found matching the given identifier(s), a new profile will be created and then subscribed. | |
### 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
## suppress_profiles
> suppress_profiles(suppression_create_job_create_query)
Suppress Profiles
Manually suppress one or more profiles. Such profiles will have `USER_SUPPRESSED` as their suppression reason. Manually suppressed profiles _will not_ receive email marketing. Learn more about suppressed profiles [in this document](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1). Not supported for SMS marketing. Maximum number of profile can be submitted for suppression: 100
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `Profiles Write` `Subscriptions 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::ProfilesApi.new
suppression_create_job_create_query = KlaviyoAPI::SuppressionCreateJobCreateQuery.new({data: KlaviyoAPI::SuppressionCreateJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileSuppressionBulkCreateJobEnum::PROFILE_SUPPRESSION_BULK_CREATE_JOB, attributes: KlaviyoAPI::SuppressionCreateJobCreateQueryResourceObjectAttributes.new({suppressions: [KlaviyoAPI::Suppression.new({email: 'matt-kemp@klaviyo-demo.com'})]})})}) # SuppressionCreateJobCreateQuery | Suppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, one will be created and immediately suppressed.
begin
# Suppress Profiles
api_instance.suppress_profiles(suppression_create_job_create_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->suppress_profiles: #{e}"
end
```
#### Using the suppress_profiles_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> suppress_profiles_with_http_info(suppression_create_job_create_query)
```ruby
begin
# Suppress Profiles
data, status_code, headers = api_instance.suppress_profiles_with_http_info(suppression_create_job_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->suppress_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **suppression_create_job_create_query** | [**SuppressionCreateJobCreateQuery**](SuppressionCreateJobCreateQuery.md) | Suppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, one will be created and immediately suppressed. | |
### 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
## unsubscribe_profiles
> unsubscribe_profiles(unsubscription_create_job_create_query)
Unsubscribe Profiles
Unsubscribe one or more profiles to email marketing, SMS marketing, or both. To remove someone from a list without changing their subscription status, use [Remove Profile from List](https://developers.klaviyo.com/en/reference/delete_list_relationships). Maximum number of profile can be submitted for unsubscription: 100
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `List Write` `Profiles Write` `Subscriptions 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::ProfilesApi.new
unsubscription_create_job_create_query = KlaviyoAPI::UnsubscriptionCreateJobCreateQuery.new({data: KlaviyoAPI::UnsubscriptionCreateJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileUnsubscriptionBulkCreateJobEnum::PROFILE_UNSUBSCRIPTION_BULK_CREATE_JOB, attributes: KlaviyoAPI::UnsubscriptionCreateJobCreateQueryResourceObjectAttributes.new})}) # UnsubscriptionCreateJobCreateQuery | Unsubscribes one or more profiles from marketing. Currently, supports email and SMS only. All profiles will be removed from the provided list. Either email or phone number is required. If a profile cannot be found matching the given identifier(s), a new profile will be created and then unsubscribed.
begin
# Unsubscribe Profiles
api_instance.unsubscribe_profiles(unsubscription_create_job_create_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->unsubscribe_profiles: #{e}"
end
```
#### Using the unsubscribe_profiles_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> unsubscribe_profiles_with_http_info(unsubscription_create_job_create_query)
```ruby
begin
# Unsubscribe Profiles
data, status_code, headers = api_instance.unsubscribe_profiles_with_http_info(unsubscription_create_job_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->unsubscribe_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **unsubscription_create_job_create_query** | [**UnsubscriptionCreateJobCreateQuery**](UnsubscriptionCreateJobCreateQuery.md) | Unsubscribes one or more profiles from marketing. Currently, supports email and SMS only. All profiles will be removed from the provided list. Either email or phone number is required. If a profile cannot be found matching the given identifier(s), a new profile will be created and then unsubscribed. | |
### 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
## unsuppress_profiles
> unsuppress_profiles(unsuppression_create_job_create_query)
Unsuppress Profiles
Unsuppress one or more profiles, this will remove any Manual Suppressions (USER_SUPPRESSED) on these profiles. A profile may receive email marketing after a manual suppression is removed so long as they have not revoked consent, i.e. unsubscribed. Not supported for SMS marketing. Only manual suppressions (USER_SUPPRESSED) will be removed. `UNSUBSCRIBE` and `SPAM_REPORT` suppressions are removed whenever a [profile resubscribes](https://developers.klaviyo.com/en/reference/subscribe_profiles). `INVALID_EMAIL` and `HARD_BOUNCE` suppressions cannot be removed by the API. Maximum number of profile can be submitted for unsuppression: 100
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `Subscriptions 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::ProfilesApi.new
unsuppression_create_job_create_query = KlaviyoAPI::UnsuppressionCreateJobCreateQuery.new({data: KlaviyoAPI::UnsuppressionCreateJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileUnsuppressionBulkCreateJobEnum::PROFILE_UNSUPPRESSION_BULK_CREATE_JOB, attributes: KlaviyoAPI::UnsuppressionCreateJobCreateQueryResourceObjectAttributes.new({suppressions: [KlaviyoAPI::Suppression.new({email: 'matt-kemp@klaviyo-demo.com'})]})})}) # UnsuppressionCreateJobCreateQuery | Unsuppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, no action will be taken.
begin
# Unsuppress Profiles
api_instance.unsuppress_profiles(unsuppression_create_job_create_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->unsuppress_profiles: #{e}"
end
```
#### Using the unsuppress_profiles_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> unsuppress_profiles_with_http_info(unsuppression_create_job_create_query)
```ruby
begin
# Unsuppress Profiles
data, status_code, headers = api_instance.unsuppress_profiles_with_http_info(unsuppression_create_job_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->unsuppress_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **unsuppression_create_job_create_query** | [**UnsuppressionCreateJobCreateQuery**](UnsuppressionCreateJobCreateQuery.md) | Unsuppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, no action will be taken. | |
### 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_profile
> Hash<String, Object> update_profile(id, profile_partial_update_query, opts)
Update Profile
Update the profile with the given profile ID. If you use a phone number as the profile identifier and SMS is not set up in the Klaviyo account, you'll need to include at least one other identifier attribute (`email` or `external_id`) in addition to the `phone_number` attribute for the API call to work.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `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::ProfilesApi.new
id = '01GDDKASAP8TKDDA2GRZDSVP4H' # String | Primary key that uniquely identifies this profile. Generated by Klaviyo.
profile_partial_update_query = KlaviyoAPI::ProfilePartialUpdateQuery.new({data: KlaviyoAPI::ProfilePartialUpdateQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, id: '01GDDKASAP8TKDDA2GRZDSVP4H', attributes: KlaviyoAPI::OnsiteProfileCreateQueryResourceObjectAttributes.new})}) # ProfilePartialUpdateQuery |
opts = {
additional_fields_profile: ['predictive_analytics'] # Array | Request additional fields not included by default in the response. Supported values: 'predictive_analytics'
}
begin
# Update Profile
result = api_instance.update_profile(id, profile_partial_update_query, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->update_profile: #{e}"
end
```
#### Using the update_profile_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> update_profile_with_http_info(id, profile_partial_update_query, opts)
```ruby
begin
# Update Profile
data, status_code, headers = api_instance.update_profile_with_http_info(id, profile_partial_update_query, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->update_profile_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | Primary key that uniquely identifies this profile. Generated by Klaviyo. | |
| **profile_partial_update_query** | [**ProfilePartialUpdateQuery**](ProfilePartialUpdateQuery.md) | | |
| **additional_fields_profile** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'predictive_analytics' | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json