# KlaviyoAPI::ProfilesApi
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**create_or_update_profile**](ProfilesApi.md#create_or_update_profile) | **POST** /api/profile-import/ | Create or Update Profile |
| [**create_profile**](ProfilesApi.md#create_profile) | **POST** /api/profiles/ | Create Profile |
| [**create_push_token**](ProfilesApi.md#create_push_token) | **POST** /api/push-tokens/ | Create or Update Push Token |
| [**get_bulk_profile_import_job**](ProfilesApi.md#get_bulk_profile_import_job) | **GET** /api/profile-bulk-import-jobs/{job_id}/ | Get Bulk Profile Import Job |
| [**get_bulk_profile_import_job_import_errors**](ProfilesApi.md#get_bulk_profile_import_job_import_errors) | **GET** /api/profile-bulk-import-jobs/{id}/import-errors/ | Get Bulk Profile Import Job Errors |
| [**get_bulk_profile_import_job_lists**](ProfilesApi.md#get_bulk_profile_import_job_lists) | **GET** /api/profile-bulk-import-jobs/{id}/lists/ | Get Bulk Profile Import Job Lists |
| [**get_bulk_profile_import_job_profiles**](ProfilesApi.md#get_bulk_profile_import_job_profiles) | **GET** /api/profile-bulk-import-jobs/{id}/profiles/ | Get Bulk Profile Import Job Profiles |
| [**get_bulk_profile_import_job_relationships_lists**](ProfilesApi.md#get_bulk_profile_import_job_relationships_lists) | **GET** /api/profile-bulk-import-jobs/{id}/relationships/lists/ | Get Bulk Profile Import Job Relationships Lists |
| [**get_bulk_profile_import_job_relationships_profiles**](ProfilesApi.md#get_bulk_profile_import_job_relationships_profiles) | **GET** /api/profile-bulk-import-jobs/{id}/relationships/profiles/ | Get Bulk Profile Import Job Relationships Profiles |
| [**get_bulk_profile_import_jobs**](ProfilesApi.md#get_bulk_profile_import_jobs) | **GET** /api/profile-bulk-import-jobs/ | Get Bulk Profile Import Jobs |
| [**get_profile**](ProfilesApi.md#get_profile) | **GET** /api/profiles/{id}/ | Get Profile |
| [**get_profile_lists**](ProfilesApi.md#get_profile_lists) | **GET** /api/profiles/{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/{id}/segments/ | Get Profile Segments |
| [**get_profiles**](ProfilesApi.md#get_profiles) | **GET** /api/profiles/ | Get Profiles |
| [**merge_profiles**](ProfilesApi.md#merge_profiles) | **POST** /api/profile-merge/ | Merge Profiles |
| [**spawn_bulk_profile_import_job**](ProfilesApi.md#spawn_bulk_profile_import_job) | **POST** /api/profile-bulk-import-jobs/ | Spawn Bulk Profile Import Job |
| [**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-subscription-bulk-delete-jobs/ | Unsubscribe Profiles |
| [**unsuppress_profiles**](ProfilesApi.md#unsuppress_profiles) | **POST** /api/profile-suppression-bulk-delete-jobs/ | Unsuppress Profiles |
| [**update_profile**](ProfilesApi.md#update_profile) | **PATCH** /api/profiles/{id}/ | Update Profile |
## create_or_update_profile
> Hash<String, Object> create_or_update_profile(profile_upsert_query)
Create or Update Profile
Given a set of profile attributes and optionally an ID, create or update a profile. Returns 201 if a new profile was created, 200 if an existing profile was updated. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged.
*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_upsert_query = KlaviyoAPI::ProfileUpsertQuery.new({data: KlaviyoAPI::ProfileUpsertQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::ProfileUpsertQueryResourceObjectAttributes.new})}) # ProfileUpsertQuery |
begin
# Create or Update Profile
result = api_instance.create_or_update_profile(profile_upsert_query)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->create_or_update_profile: #{e}"
end
```
#### Using the create_or_update_profile_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> create_or_update_profile_with_http_info(profile_upsert_query)
```ruby
begin
# Create or Update Profile
data, status_code, headers = api_instance.create_or_update_profile_with_http_info(profile_upsert_query)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->create_or_update_profile_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **profile_upsert_query** | [**ProfileUpsertQuery**](ProfileUpsertQuery.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_profile
> Hash<String, Object> create_profile(profile_create_query)
Create Profile
Create a new profile.
*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 |
begin
# Create Profile
result = api_instance.create_profile(profile_create_query)
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)
```ruby
begin
# Create Profile
data, status_code, headers = api_instance.create_profile_with_http_info(profile_create_query)
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) | | |
### 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_push_token
> create_push_token(push_token_create_query)
Create or Update Push Token
Create or update a push token. This endpoint can be used to migrate push tokens from another platform to Klaviyo. Please use our mobile SDKs ([iOS](https://github.com/klaviyo/klaviyo-swift-sdk) and [Android](https://github.com/klaviyo/klaviyo-android-sdk)) to create push tokens from users' devices.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:write` `push-tokens: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
push_token_create_query = KlaviyoAPI::PushTokenCreateQuery.new({data: KlaviyoAPI::PushTokenCreateQueryResourceObject.new({type: KlaviyoAPI::PushTokenEnum::PUSH_TOKEN, attributes: KlaviyoAPI::PushTokenCreateQueryResourceObjectAttributes.new({token: '1234567890', platform: 'android', vendor: 'apns', profile: KlaviyoAPI::PushTokenCreateQueryResourceObjectAttributesProfile.new({data: KlaviyoAPI::PushProfileUpsertQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::PushProfileUpsertQueryResourceObjectAttributes.new})})})})}) # PushTokenCreateQuery |
begin
# Create or Update Push Token
api_instance.create_push_token(push_token_create_query)
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->create_push_token: #{e}"
end
```
#### Using the create_push_token_with_http_info variant
This returns an Array which contains the response data (`nil` in this case), status code and headers.
> create_push_token_with_http_info(push_token_create_query)
```ruby
begin
# Create or Update Push Token
data, status_code, headers = api_instance.create_push_token_with_http_info(push_token_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->create_push_token_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **push_token_create_query** | [**PushTokenCreateQuery**](PushTokenCreateQuery.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_bulk_profile_import_job
> Hash<String, Object> get_bulk_profile_import_job(job_id, opts)
Get Bulk Profile Import Job
Get a bulk profile import job with the given job ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read` `profiles:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ProfilesApi.new
job_id = '01GSQPBF74KQ5YTDEPP41T1BZH' # String | ID of the job to retrieve.
opts = {
fields_list: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
fields_profile_bulk_import_job: ['status'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
include: ['lists'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships
}
begin
# Get Bulk Profile Import Job
result = api_instance.get_bulk_profile_import_job(job_id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job: #{e}"
end
```
#### Using the get_bulk_profile_import_job_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_job_with_http_info(job_id, opts)
```ruby
begin
# Get Bulk Profile Import Job
data, status_code, headers = api_instance.get_bulk_profile_import_job_with_http_info(job_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **job_id** | **String** | ID of the job to retrieve. | |
| **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **fields_profile_bulk_import_job** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-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_bulk_profile_import_job_import_errors
> Hash<String, Object> get_bulk_profile_import_job_import_errors(id, opts)
Get Bulk Profile Import Job Errors
Get import errors for the bulk profile import job with the given ID.
*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
id = 'id_example' # String |
opts = {
fields_import_error: ['code'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56 # Integer | Default: 20. Min: 1. Max: 100.
}
begin
# Get Bulk Profile Import Job Errors
result = api_instance.get_bulk_profile_import_job_import_errors(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_import_errors: #{e}"
end
```
#### Using the get_bulk_profile_import_job_import_errors_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_job_import_errors_with_http_info(id, opts)
```ruby
begin
# Get Bulk Profile Import Job Errors
data, status_code, headers = api_instance.get_bulk_profile_import_job_import_errors_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_bulk_profile_import_job_import_errors_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **fields_import_error** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
### 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_bulk_profile_import_job_lists
> Hash<String, Object> get_bulk_profile_import_job_lists(id, opts)
Get Bulk Profile Import Job Lists
Get list for the bulk profile import job with the given ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ProfilesApi.new
id = 'id_example' # String |
opts = {
fields_list: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Bulk Profile Import Job Lists
result = api_instance.get_bulk_profile_import_job_lists(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_lists: #{e}"
end
```
#### Using the get_bulk_profile_import_job_lists_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_job_lists_with_http_info(id, opts)
```ruby
begin
# Get Bulk Profile Import Job Lists
data, status_code, headers = api_instance.get_bulk_profile_import_job_lists_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_bulk_profile_import_job_lists_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-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_bulk_profile_import_job_profiles
> Hash<String, Object> get_bulk_profile_import_job_profiles(id, opts)
Get Bulk Profile Import Job Profiles
Get profiles for the bulk profile import job with the given ID.
*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
id = 'id_example' # String |
opts = {
additional_fields_profile: ['subscriptions'], # Array | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics'
fields_profile: ['email'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56 # Integer | Default: 20. Min: 1. Max: 100.
}
begin
# Get Bulk Profile Import Job Profiles
result = api_instance.get_bulk_profile_import_job_profiles(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_profiles: #{e}"
end
```
#### Using the get_bulk_profile_import_job_profiles_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_job_profiles_with_http_info(id, opts)
```ruby
begin
# Get Bulk Profile Import Job Profiles
data, status_code, headers = api_instance.get_bulk_profile_import_job_profiles_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **additional_fields_profile** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' | [optional] |
| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
### 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_bulk_profile_import_job_relationships_lists
> Hash<String, Object> get_bulk_profile_import_job_relationships_lists(id)
Get Bulk Profile Import Job Relationships Lists
Get list relationship for the bulk profile import job with the given ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ProfilesApi.new
id = 'id_example' # String |
begin
# Get Bulk Profile Import Job Relationships Lists
result = api_instance.get_bulk_profile_import_job_relationships_lists(id)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_relationships_lists: #{e}"
end
```
#### Using the get_bulk_profile_import_job_relationships_lists_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_job_relationships_lists_with_http_info(id)
```ruby
begin
# Get Bulk Profile Import Job Relationships Lists
data, status_code, headers = api_instance.get_bulk_profile_import_job_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_bulk_profile_import_job_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_bulk_profile_import_job_relationships_profiles
> Hash<String, Object> get_bulk_profile_import_job_relationships_profiles(id, opts)
Get Bulk Profile Import Job Relationships Profiles
Get profile relationships for the bulk profile import job with the given ID.
*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
id = 'id_example' # String |
opts = {
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56 # Integer | Default: 20. Min: 1. Max: 100.
}
begin
# Get Bulk Profile Import Job Relationships Profiles
result = api_instance.get_bulk_profile_import_job_relationships_profiles(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_relationships_profiles: #{e}"
end
```
#### Using the get_bulk_profile_import_job_relationships_profiles_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_job_relationships_profiles_with_http_info(id, opts)
```ruby
begin
# Get Bulk Profile Import Job Relationships Profiles
data, status_code, headers = api_instance.get_bulk_profile_import_job_relationships_profiles_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_job_relationships_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
### 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_bulk_profile_import_jobs
> Hash<String, Object> get_bulk_profile_import_jobs(opts)
Get Bulk Profile Import Jobs
Get all bulk profile import jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read` `profiles:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ProfilesApi.new
opts = {
fields_profile_bulk_import_job: ['status'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`status`: `any`, `equals`
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56, # Integer | Default: 20. Min: 1. Max: 100.
sort: 'created_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting
}
begin
# Get Bulk Profile Import Jobs
result = api_instance.get_bulk_profile_import_jobs(opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->get_bulk_profile_import_jobs: #{e}"
end
```
#### Using the get_bulk_profile_import_jobs_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_bulk_profile_import_jobs_with_http_info(opts)
```ruby
begin
# Get Bulk Profile Import Jobs
data, status_code, headers = api_instance.get_bulk_profile_import_jobs_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_bulk_profile_import_jobs_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **fields_profile_bulk_import_job** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `any`, `equals` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-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_profile
> Hash<String, Object> get_profile(id, opts)
Get Profile
Get the profile with the given profile ID.
*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: ['subscriptions'], # Array | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics'
fields_list: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
fields_profile: ['email'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
fields_segment: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
include: ['lists'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/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: 'subscriptions', 'predictive_analytics' | [optional] |
| **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **fields_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-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_profile_lists
> Hash<String, Object> get_profile_lists(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:** `lists:read` `profiles:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ProfilesApi.new
id = 'id_example' # String |
opts = {
fields_list: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Profile Lists
result = api_instance.get_profile_lists(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(id, opts)
```ruby
begin
# Get Profile Lists
data, status_code, headers = api_instance.get_profile_lists_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_lists_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **fields_list** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-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_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:** `lists:read` `profiles:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::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(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
id = 'id_example' # String |
opts = {
fields_segment: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Profile Segments
result = api_instance.get_profile_segments(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(id, opts)
```ruby
begin
# Get Profile Segments
data, status_code, headers = api_instance.get_profile_segments_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_segments_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **fields_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-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_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`, `subscriptions.email.marketing.suppression.timestamp`, `subscriptions.email.marketing.list_suppressions.timestamp`
*Rate limits*:
Burst: `75/s`
Steady: `700/m`
Rate limits when using the `additional-fields[profile]=predictive_analytics` parameter in your API request:
Burst: `10/s`
Steady: `150/m`
To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-07-15/docs/rate_limits_and_error_handling) guide. **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: ['subscriptions'], # Array | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics'
fields_profile: ['email'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/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`
`subscriptions.email.marketing.suppression.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal`
`subscriptions.email.marketing.suppression.reason` : `equals`
`subscriptions.email.marketing.list_suppressions.list_id` : `equals`
`subscriptions.email.marketing.list_suppressions.reason` : `equals`
`subscriptions.email.marketing.list_suppressions.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal`
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56, # Integer | Default: 20. Min: 1. Max: 100.
sort: 'created' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting
}
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: 'subscriptions', 'predictive_analytics' | [optional] |
| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/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`<br>`subscriptions.email.marketing.suppression.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal`<br>`subscriptions.email.marketing.suppression.reason` : `equals`<br>`subscriptions.email.marketing.list_suppressions.list_id` : `equals`<br>`subscriptions.email.marketing.list_suppressions.reason` : `equals`<br>`subscriptions.email.marketing.list_suppressions.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-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
## merge_profiles
> Hash<String, Object> merge_profiles(profile_merge_query)
Merge Profiles
Merge a given related profile into a profile with the given profile ID. The profile provided under `relationships` (the \"source\" profile) will be merged into the profile provided by the ID in the base data object (the \"destination\" profile). This endpoint queues an asynchronous task which will merge data from the source profile into the destination profile, deleting the source profile in the process. This endpoint accepts only one source profile. To learn more about how profile data is preserved or overwritten during a merge, please [visit our Help Center](https://help.klaviyo.com/hc/en-us/articles/115005073847#merge-2-profiles3).
*Rate limits*:
Burst: `10/s`
Steady: `150/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_merge_query = KlaviyoAPI::ProfileMergeQuery.new({data: KlaviyoAPI::ProfileMergeQueryResourceObject.new({type: KlaviyoAPI::ProfileMergeEnum::PROFILE_MERGE, id: '01GDDKASAP8TKDDA2GRZDSVP4H'})}) # ProfileMergeQuery |
begin
# Merge Profiles
result = api_instance.merge_profiles(profile_merge_query)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->merge_profiles: #{e}"
end
```
#### Using the merge_profiles_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> merge_profiles_with_http_info(profile_merge_query)
```ruby
begin
# Merge Profiles
data, status_code, headers = api_instance.merge_profiles_with_http_info(profile_merge_query)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->merge_profiles_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **profile_merge_query** | [**ProfileMergeQuery**](ProfileMergeQuery.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
## spawn_bulk_profile_import_job
> Hash<String, Object> spawn_bulk_profile_import_job(profile_import_job_create_query)
Spawn Bulk Profile Import Job
Create a bulk profile import job to create or update a batch of profiles. Accepts up to 10,000 profiles per request. The maximum allowed payload size is 5MB. To learn more, see our [Bulk Profile Import API guide](https://developers.klaviyo.com/en/docs/use_klaviyos_bulk_profile_import_api).
*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:write` `profiles:write`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::ProfilesApi.new
profile_import_job_create_query = KlaviyoAPI::ProfileImportJobCreateQuery.new({data: KlaviyoAPI::ProfileImportJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileBulkImportJobEnum::PROFILE_BULK_IMPORT_JOB, attributes: KlaviyoAPI::ProfileImportJobCreateQueryResourceObjectAttributes.new({profiles: KlaviyoAPI::ProfileImportJobCreateQueryResourceObjectAttributesProfiles.new({data: [KlaviyoAPI::ProfileUpsertQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::ProfileUpsertQueryResourceObjectAttributes.new})]})})})}) # ProfileImportJobCreateQuery |
begin
# Spawn Bulk Profile Import Job
result = api_instance.spawn_bulk_profile_import_job(profile_import_job_create_query)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->spawn_bulk_profile_import_job: #{e}"
end
```
#### Using the spawn_bulk_profile_import_job_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> spawn_bulk_profile_import_job_with_http_info(profile_import_job_create_query)
```ruby
begin
# Spawn Bulk Profile Import Job
data, status_code, headers = api_instance.spawn_bulk_profile_import_job_with_http_info(profile_import_job_create_query)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ProfilesApi->spawn_bulk_profile_import_job_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **profile_import_job_create_query** | [**ProfileImportJobCreateQuery**](ProfileImportJobCreateQuery.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
## 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 provided 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. Learn more about [consent in this guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). If a list is not provided, the opt-in process used will be determined by the [account-level default opt-in setting](https://www.klaviyo.com/settings/account/api-keys). 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](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1). Maximum number of profiles can be submitted for subscription: 1000 This endpoint now supports a `historical_import` flag. If this flag is set `true`, profiles being subscribed will bypass double opt-in emails and be subscribed immediately. They will also bypass any associated \"Added to list\" flows. This is useful for importing historical data where you have already collected consent. If `historical_import` is set to true, the `consented_at` field is required and must be in the past.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `lists: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({profiles: KlaviyoAPI::SubscriptionCreateJobCreateQueryResourceObjectAttributesProfiles.new({data: [KlaviyoAPI::ProfileSubscriptionCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::ProfileSubscriptionCreateQueryResourceObjectAttributes.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 profiles using their email address, or by specifying a segment or list ID to suppress all current members. Suppressed profiles cannot receive email marketing, independent of their consent status. To learn more, see our [email suppressions guide](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1) and our [collecting consent guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email addresses per request limit: 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})}) # 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(subscription_delete_job_create_query)
Unsubscribe Profiles
Unsubscribe one or more profiles to email marketing, SMS marketing, or both. Learn more about [consent in this guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). 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:** `lists: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_delete_job_create_query = KlaviyoAPI::SubscriptionDeleteJobCreateQuery.new({data: KlaviyoAPI::SubscriptionDeleteJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileSubscriptionBulkDeleteJobEnum::PROFILE_SUBSCRIPTION_BULK_DELETE_JOB, attributes: KlaviyoAPI::SubscriptionDeleteJobCreateQueryResourceObjectAttributes.new({profiles: KlaviyoAPI::SubscriptionDeleteJobCreateQueryResourceObjectAttributesProfiles.new({data: [KlaviyoAPI::ProfileSubscriptionDeleteQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::ProfileSubscriptionDeleteQueryResourceObjectAttributes.new})]})})})}) # SubscriptionDeleteJobCreateQuery | 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(subscription_delete_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(subscription_delete_job_create_query)
```ruby
begin
# Unsubscribe Profiles
data, status_code, headers = api_instance.unsubscribe_profiles_with_http_info(subscription_delete_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 |
| ---- | ---- | ----------- | ----- |
| **subscription_delete_job_create_query** | [**SubscriptionDeleteJobCreateQuery**](SubscriptionDeleteJobCreateQuery.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(suppression_delete_job_create_query)
Unsuppress Profiles
Manually unsuppress profiles using their email address, or by specifying a segment or list ID to unsuppress all current members. This only removes suppressions with reason `USER_SUPPRESSED`, leaving unsubscribed profiles and profiles suppressed with reason `INVALID_EMAIL` or `HARD_BOUNCE` unchanged. To learn more, see our [email suppressions guide](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1) and our [collecting consent guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email addresses per request limit: 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
suppression_delete_job_create_query = KlaviyoAPI::SuppressionDeleteJobCreateQuery.new({data: KlaviyoAPI::SuppressionDeleteJobCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileSuppressionBulkDeleteJobEnum::PROFILE_SUPPRESSION_BULK_DELETE_JOB, attributes: KlaviyoAPI::SuppressionDeleteJobCreateQueryResourceObjectAttributes.new})}) # SuppressionDeleteJobCreateQuery | 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(suppression_delete_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(suppression_delete_job_create_query)
```ruby
begin
# Unsuppress Profiles
data, status_code, headers = api_instance.unsuppress_profiles_with_http_info(suppression_delete_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 |
| ---- | ---- | ----------- | ----- |
| **suppression_delete_job_create_query** | [**SuppressionDeleteJobCreateQuery**](SuppressionDeleteJobCreateQuery.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)
Update Profile
Update the profile with the given profile ID. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged.
*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::ProfilePartialUpdateQueryResourceObjectAttributes.new})}) # ProfilePartialUpdateQuery |
begin
# Update Profile
result = api_instance.update_profile(id, profile_partial_update_query)
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)
```ruby
begin
# Update Profile
data, status_code, headers = api_instance.update_profile_with_http_info(id, profile_partial_update_query)
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) | | |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json