Class: KlaviyoAPI::ProfilesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo-api-sdk/api/profiles_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProfilesApi

Returns a new instance of ProfilesApi.



18
19
20
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 18

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#bulk_import_profiles(profile_import_job_create_query, opts = {}) ⇒ Hash<String, Object> Also known as: spawn_bulk_profile_import_job, create_profile_bulk_import_job

Bulk Import Profiles 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. The maximum allowed payload size per-profile is 100KB. To learn more, see our [Bulk Profile Import API guide](developers.klaviyo.com/en/docs/use_klaviyos_bulk_profile_import_api).
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `lists:write` `profiles:write`

Parameters:

Returns:

  • (Hash<String, Object>)


26
27
28
29
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 26

def bulk_import_profiles(profile_import_job_create_query, opts = {})
  data, _status_code, _headers = bulk_import_profiles_with_http_info(profile_import_job_create_query, opts)
  data
end

#bulk_import_profiles_with_http_info(profile_import_job_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: spawn_bulk_profile_import_job_with_http_info, create_profile_bulk_import_job_with_http_info

Bulk Import Profiles 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. The maximum allowed payload size per-profile is 100KB. To learn more, see our [Bulk Profile Import API guide](developers.klaviyo.com/en/docs/use_klaviyos_bulk_profile_import_api).&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;lists:write&#x60; &#x60;profiles:write&#x60;

Parameters:

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 42

def bulk_import_profiles_with_http_info(profile_import_job_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.bulk_import_profiles ...'
  end
  # verify the required parameter 'profile_import_job_create_query' is set
  if @api_client.config.client_side_validation && profile_import_job_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'profile_import_job_create_query' when calling ProfilesApi.bulk_import_profiles"
  end
  # resource path
  local_var_path = '/api/profile-bulk-import-jobs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(profile_import_job_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.bulk_import_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#bulk_import_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#bulk_subscribe_profiles(subscription_create_job_create_query, opts = {}) ⇒ nil Also known as: subscribe_profiles, create_profile_subscription_bulk_create_job

Bulk 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](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](www.klaviyo.com/settings/account/api-keys). To add someone to a list without changing their subscription status, use [Add Profile to List](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](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`

Parameters:

  • subscription_create_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


108
109
110
111
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 108

def bulk_subscribe_profiles(subscription_create_job_create_query, opts = {})
  bulk_subscribe_profiles_with_http_info(subscription_create_job_create_query, opts)
  nil
end

#bulk_subscribe_profiles_with_http_info(subscription_create_job_create_query, opts = {}) ⇒ Array<(nil, Integer, Hash)> Also known as: subscribe_profiles_with_http_info, create_profile_subscription_bulk_create_job_with_http_info

Bulk 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](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](www.klaviyo.com/settings/account/api-keys). To add someone to a list without changing their subscription status, use [Add Profile to List](developers.klaviyo.com/en/reference/create_list_relationships). This API will remove any &#x60;UNSUBSCRIBE&#x60;, &#x60;SPAM_REPORT&#x60; or &#x60;USER_SUPPRESSED&#x60; suppressions from the provided profiles. Learn more about [suppressed profiles](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 &#x60;historical_import&#x60; flag. If this flag is set &#x60;true&#x60;, profiles being subscribed will bypass double opt-in emails and be subscribed immediately. They will also bypass any associated &quot;Added to list&quot; flows. This is useful for importing historical data where you have already collected consent. If &#x60;historical_import&#x60; is set to true, the &#x60;consented_at&#x60; field is required and must be in the past.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;lists:write&#x60; &#x60;profiles:write&#x60; &#x60;subscriptions:write&#x60;

Parameters:

  • subscription_create_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 124

def bulk_subscribe_profiles_with_http_info(subscription_create_job_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.bulk_subscribe_profiles ...'
  end
  # verify the required parameter 'subscription_create_job_create_query' is set
  if @api_client.config.client_side_validation && subscription_create_job_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_create_job_create_query' when calling ProfilesApi.bulk_subscribe_profiles"
  end
  # resource path
  local_var_path = '/api/profile-subscription-bulk-create-jobs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(subscription_create_job_create_query)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.bulk_subscribe_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#bulk_subscribe_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#bulk_suppress_profiles(suppression_create_job_create_query, opts = {}) ⇒ Hash<String, Object> Also known as: suppress_profiles, create_profile_suppression_bulk_create_job

Bulk Suppress Profiles Manually suppress profiles by email address or specify a segment/list ID to suppress all current members of a segment/list. Suppressed profiles cannot receive email marketing, independent of their consent status. To learn more, see our guides on [email suppressions](help.klaviyo.com/hc/en-us/articles/115005246108#what-is-a-suppressed-profile-1) and [collecting consent](developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email address per request limit: 100
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `profiles:write` `subscriptions:write`

Parameters:

  • suppression_create_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


190
191
192
193
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 190

def bulk_suppress_profiles(suppression_create_job_create_query, opts = {})
  data, _status_code, _headers = bulk_suppress_profiles_with_http_info(suppression_create_job_create_query, opts)
  data
end

#bulk_suppress_profiles_with_http_info(suppression_create_job_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: suppress_profiles_with_http_info, create_profile_suppression_bulk_create_job_with_http_info

Bulk Suppress Profiles Manually suppress profiles by email address or specify a segment/list ID to suppress all current members of a segment/list. Suppressed profiles cannot receive email marketing, independent of their consent status. To learn more, see our guides on [email suppressions](help.klaviyo.com/hc/en-us/articles/115005246108#what-is-a-suppressed-profile-1) and [collecting consent](developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email address per request limit: 100&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;profiles:write&#x60; &#x60;subscriptions:write&#x60;

Parameters:

  • suppression_create_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 206

def bulk_suppress_profiles_with_http_info(suppression_create_job_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.bulk_suppress_profiles ...'
  end
  # verify the required parameter 'suppression_create_job_create_query' is set
  if @api_client.config.client_side_validation && suppression_create_job_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'suppression_create_job_create_query' when calling ProfilesApi.bulk_suppress_profiles"
  end
  # resource path
  local_var_path = '/api/profile-suppression-bulk-create-jobs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(suppression_create_job_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.bulk_suppress_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#bulk_suppress_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#bulk_unsubscribe_profiles(subscription_delete_job_create_query, opts = {}) ⇒ nil Also known as: unsubscribe_profiles, create_profile_subscription_bulk_delete_job

Bulk Unsubscribe Profiles Unsubscribe one or more profiles to email marketing, SMS marketing, or both. Learn more about [consent in this guide](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](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`

Parameters:

  • subscription_delete_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


272
273
274
275
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 272

def bulk_unsubscribe_profiles(subscription_delete_job_create_query, opts = {})
  bulk_unsubscribe_profiles_with_http_info(subscription_delete_job_create_query, opts)
  nil
end

#bulk_unsubscribe_profiles_with_http_info(subscription_delete_job_create_query, opts = {}) ⇒ Array<(nil, Integer, Hash)> Also known as: unsubscribe_profiles_with_http_info, create_profile_subscription_bulk_delete_job_with_http_info

Bulk Unsubscribe Profiles Unsubscribe one or more profiles to email marketing, SMS marketing, or both. Learn more about [consent in this guide](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](developers.klaviyo.com/en/reference/delete_list_relationships). Maximum number of profile can be submitted for unsubscription: 100&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;lists:write&#x60; &#x60;profiles:write&#x60; &#x60;subscriptions:write&#x60;

Parameters:

  • subscription_delete_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 288

def bulk_unsubscribe_profiles_with_http_info(subscription_delete_job_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.bulk_unsubscribe_profiles ...'
  end
  # verify the required parameter 'subscription_delete_job_create_query' is set
  if @api_client.config.client_side_validation && subscription_delete_job_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_delete_job_create_query' when calling ProfilesApi.bulk_unsubscribe_profiles"
  end
  # resource path
  local_var_path = '/api/profile-subscription-bulk-delete-jobs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(subscription_delete_job_create_query)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.bulk_unsubscribe_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#bulk_unsubscribe_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#bulk_unsuppress_profiles(suppression_delete_job_create_query, opts = {}) ⇒ Hash<String, Object> Also known as: unsuppress_profiles, create_profile_suppression_bulk_delete_job

Bulk Unsuppress Profiles Manually unsuppress profiles by email address or specify a segment/list ID to unsuppress all current members of a segment/list. This only removes suppressions with reason USER_SUPPRESSED ; unsubscribed profiles and suppressed profiles with reason INVALID_EMAIL or HARD_BOUNCE remain unchanged. To learn more, see our guides on [email suppressions](help.klaviyo.com/hc/en-us/articles/115005246108#what-is-a-suppressed-profile-1) and [collecting consent](developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email address per request limit: 100
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `subscriptions:write`

Parameters:

  • suppression_delete_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


354
355
356
357
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 354

def bulk_unsuppress_profiles(suppression_delete_job_create_query, opts = {})
  data, _status_code, _headers = bulk_unsuppress_profiles_with_http_info(suppression_delete_job_create_query, opts)
  data
end

#bulk_unsuppress_profiles_with_http_info(suppression_delete_job_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: unsuppress_profiles_with_http_info, create_profile_suppression_bulk_delete_job_with_http_info

Bulk Unsuppress Profiles Manually unsuppress profiles by email address or specify a segment/list ID to unsuppress all current members of a segment/list. This only removes suppressions with reason USER_SUPPRESSED ; unsubscribed profiles and suppressed profiles with reason INVALID_EMAIL or HARD_BOUNCE remain unchanged. To learn more, see our guides on [email suppressions](help.klaviyo.com/hc/en-us/articles/115005246108#what-is-a-suppressed-profile-1) and [collecting consent](developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email address per request limit: 100&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;subscriptions:write&#x60;

Parameters:

  • suppression_delete_job_create_query (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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 370

def bulk_unsuppress_profiles_with_http_info(suppression_delete_job_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.bulk_unsuppress_profiles ...'
  end
  # verify the required parameter 'suppression_delete_job_create_query' is set
  if @api_client.config.client_side_validation && suppression_delete_job_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'suppression_delete_job_create_query' when calling ProfilesApi.bulk_unsuppress_profiles"
  end
  # resource path
  local_var_path = '/api/profile-suppression-bulk-delete-jobs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(suppression_delete_job_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.bulk_unsuppress_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#bulk_unsuppress_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_or_update_profile(profile_upsert_query, opts = {}) ⇒ Hash<String, Object> Also known as: create_profile_import

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. Use the ‘additional-fields` parameter to include subscriptions and predictive analytics data in your response. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged. The maximum allowed payload size is 100KB.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` Scopes: `profiles:write`

Parameters:

  • profile_upsert_query (ProfileUpsertQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

Returns:

  • (Hash<String, Object>)


437
438
439
440
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 437

def create_or_update_profile(profile_upsert_query, opts = {})
  data, _status_code, _headers = create_or_update_profile_with_http_info(profile_upsert_query, opts)
  data
end

#create_or_update_profile_with_http_info(profile_upsert_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_profile_import_with_http_info

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. Use the &#x60;additional-fields&#x60; parameter to include subscriptions and predictive analytics data in your response. Note that setting a field to &#x60;null&#x60; will clear out the field, whereas not including a field in your request will leave it unchanged. The maximum allowed payload size is 100KB.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;profiles:write&#x60;

Parameters:

  • profile_upsert_query (ProfileUpsertQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 451

def create_or_update_profile_with_http_info(profile_upsert_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.create_or_update_profile ...'
  end
  # verify the required parameter 'profile_upsert_query' is set
  if @api_client.config.client_side_validation && profile_upsert_query.nil?
    fail ArgumentError, "Missing the required parameter 'profile_upsert_query' when calling ProfilesApi.create_or_update_profile"
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-import'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(profile_upsert_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.create_or_update_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#create_or_update_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_profile(profile_create_query, opts = {}) ⇒ Hash<String, Object>

Create Profile Create a new profile. Use the ‘additional-fields` parameter to include subscriptions and predictive analytics data in your response. The maximum allowed payload size is 100KB.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` Scopes: `profiles:write`

Parameters:

  • profile_create_query (ProfileCreateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

Returns:

  • (Hash<String, Object>)


520
521
522
523
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 520

def create_profile(profile_create_query, opts = {})
  data, _status_code, _headers = create_profile_with_http_info(profile_create_query, opts)
  data
end

#create_profile_with_http_info(profile_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Create Profile Create a new profile. Use the &#x60;additional-fields&#x60; parameter to include subscriptions and predictive analytics data in your response. The maximum allowed payload size is 100KB.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;profiles:write&#x60;

Parameters:

  • profile_create_query (ProfileCreateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 531

def create_profile_with_http_info(profile_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.create_profile ...'
  end
  # verify the required parameter 'profile_create_query' is set
  if @api_client.config.client_side_validation && profile_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'profile_create_query' when calling ProfilesApi.create_profile"
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(profile_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.create_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#create_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_push_token(push_token_create_query, opts = {}) ⇒ nil

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](github.com/klaviyo/klaviyo-swift-sdk) and [Android](github.com/klaviyo/klaviyo-android-sdk)) to create push tokens from users’ devices. The maximum allowed payload size is 100KB.
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `profiles:write` `push-tokens:write`

Parameters:

  • push_token_create_query (PushTokenCreateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


596
597
598
599
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 596

def create_push_token(push_token_create_query, opts = {})
  create_push_token_with_http_info(push_token_create_query, opts)
  nil
end

#create_push_token_with_http_info(push_token_create_query, opts = {}) ⇒ Array<(nil, Integer, Hash)>

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](github.com/klaviyo/klaviyo-swift-sdk) and [Android](github.com/klaviyo/klaviyo-android-sdk)) to create push tokens from users&#39; devices. The maximum allowed payload size is 100KB.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;profiles:write&#x60; &#x60;push-tokens:write&#x60;

Parameters:

  • push_token_create_query (PushTokenCreateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 606

def create_push_token_with_http_info(push_token_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.create_push_token ...'
  end
  # verify the required parameter 'push_token_create_query' is set
  if @api_client.config.client_side_validation && push_token_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'push_token_create_query' when calling ProfilesApi.create_push_token"
  end
  # resource path
  local_var_path = '/api/push-tokens'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(push_token_create_query)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.create_push_token",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#create_push_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_push_token(id, opts = {}) ⇒ nil

Delete Push Token Delete a specific push token based on its ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `push-tokens:write`

Parameters:

  • id (String)

    The value of the push token to delete

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


666
667
668
669
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 666

def delete_push_token(id, opts = {})
  delete_push_token_with_http_info(id, opts)
  nil
end

#delete_push_token_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Push Token Delete a specific push token based on its ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60; Scopes: &#x60;push-tokens:write&#x60;

Parameters:

  • id (String)

    The value of the push token to delete

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 676

def delete_push_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.delete_push_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.delete_push_token"
  end
  # resource path
  local_var_path = '/api/push-tokens/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.delete_push_token",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#delete_push_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_bulk_import_profiles_job(job_id, opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_job, get_profile_bulk_import_job

Get Bulk Import Profiles 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`

Parameters:

  • job_id (String)

    ID of the job to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


734
735
736
737
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 734

def get_bulk_import_profiles_job(job_id, opts = {})
  data, _status_code, _headers = get_bulk_import_profiles_job_with_http_info(job_id, opts)
  data
end

#get_bulk_import_profiles_job_with_http_info(job_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_job_with_http_info, get_profile_bulk_import_job_with_http_info

Get Bulk Import Profiles Job Get a bulk profile import job with the given job ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;lists:read&#x60; &#x60;profiles:read&#x60;

Parameters:

  • job_id (String)

    ID of the job to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 753

def get_bulk_import_profiles_job_with_http_info(job_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_import_profiles_job ...'
  end
  # verify the required parameter 'job_id' is set
  if @api_client.config.client_side_validation && job_id.nil?
    fail ArgumentError, "Missing the required parameter 'job_id' when calling ProfilesApi.get_bulk_import_profiles_job"
  end
  allowable_values = ["name", "created", "updated", "opt_in_process"]
  if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}"
  end
  allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "expires_at", "started_at"]
  if @api_client.config.client_side_validation && opts[:'fields_profile_bulk_import_job'] && !opts[:'fields_profile_bulk_import_job'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile_bulk_import_job\", must include one of #{allowable_values}"
  end
  allowable_values = ["lists"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-bulk-import-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil?
  query_params[:'fields[profile-bulk-import-job]'] = @api_client.build_collection_param(opts[:'fields_profile_bulk_import_job'], :csv) if !opts[:'fields_profile_bulk_import_job'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_bulk_import_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_bulk_import_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_bulk_import_profiles_jobs(opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_jobs, get_profile_bulk_import_jobs

Get Bulk Import Profiles 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`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


833
834
835
836
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 833

def get_bulk_import_profiles_jobs(opts = {})
  data, _status_code, _headers = get_bulk_import_profiles_jobs_with_http_info(opts)
  data
end

#get_bulk_import_profiles_jobs_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_jobs_with_http_info, get_profile_bulk_import_jobs_with_http_info

Get Bulk Import Profiles Jobs Get all bulk profile import jobs. Returns a maximum of 100 jobs per request.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;lists:read&#x60; &#x60;profiles:read&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 853

def get_bulk_import_profiles_jobs_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_import_profiles_jobs ...'
  end
  allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "expires_at", "started_at"]
  if @api_client.config.client_side_validation && opts[:'fields_profile_bulk_import_job'] && !opts[:'fields_profile_bulk_import_job'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile_bulk_import_job\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_import_profiles_jobs, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_import_profiles_jobs, must be greater than or equal to 1.'
  end

  allowable_values = ["created_at", "-created_at"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-bulk-import-jobs'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile-bulk-import-job]'] = @api_client.build_collection_param(opts[:'fields_profile_bulk_import_job'], :csv) if !opts[:'fields_profile_bulk_import_job'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_bulk_import_profiles_jobs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_bulk_import_profiles_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_bulk_suppress_profiles_job(job_id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_suppression_bulk_create_job

Get Bulk Suppress Profiles Job Get the bulk suppress profiles job with the given job ID.
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `subscriptions:read`

Parameters:

  • job_id (String)

    ID of the job to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


932
933
934
935
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 932

def get_bulk_suppress_profiles_job(job_id, opts = {})
  data, _status_code, _headers = get_bulk_suppress_profiles_job_with_http_info(job_id, opts)
  data
end

#get_bulk_suppress_profiles_job_with_http_info(job_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_suppression_bulk_create_job_with_http_info

Get Bulk Suppress Profiles Job Get the bulk suppress profiles job with the given job ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;subscriptions:read&#x60;

Parameters:

  • job_id (String)

    ID of the job to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 946

def get_bulk_suppress_profiles_job_with_http_info(job_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_suppress_profiles_job ...'
  end
  # verify the required parameter 'job_id' is set
  if @api_client.config.client_side_validation && job_id.nil?
    fail ArgumentError, "Missing the required parameter 'job_id' when calling ProfilesApi.get_bulk_suppress_profiles_job"
  end
  allowable_values = ["status", "created_at", "total_count", "completed_count", "completed_at", "skipped_count"]
  if @api_client.config.client_side_validation && opts[:'fields_profile_suppression_bulk_create_job'] && !opts[:'fields_profile_suppression_bulk_create_job'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile_suppression_bulk_create_job\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-suppression-bulk-create-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile-suppression-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_profile_suppression_bulk_create_job'], :csv) if !opts[:'fields_profile_suppression_bulk_create_job'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_bulk_suppress_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_bulk_suppress_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_bulk_suppress_profiles_jobs(opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_suppression_bulk_create_jobs

Get Bulk Suppress Profiles Jobs Get the status of all bulk profile suppression jobs.
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `subscriptions:read`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1012
1013
1014
1015
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1012

def get_bulk_suppress_profiles_jobs(opts = {})
  data, _status_code, _headers = get_bulk_suppress_profiles_jobs_with_http_info(opts)
  data
end

#get_bulk_suppress_profiles_jobs_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_suppression_bulk_create_jobs_with_http_info

Get Bulk Suppress Profiles Jobs Get the status of all bulk profile suppression jobs.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;subscriptions:read&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1028

def get_bulk_suppress_profiles_jobs_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_suppress_profiles_jobs ...'
  end
  allowable_values = ["status", "created_at", "total_count", "completed_count", "completed_at", "skipped_count"]
  if @api_client.config.client_side_validation && opts[:'fields_profile_suppression_bulk_create_job'] && !opts[:'fields_profile_suppression_bulk_create_job'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile_suppression_bulk_create_job\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "-created"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-suppression-bulk-create-jobs'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile-suppression-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_profile_suppression_bulk_create_job'], :csv) if !opts[:'fields_profile_suppression_bulk_create_job'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_bulk_suppress_profiles_jobs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_bulk_suppress_profiles_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_bulk_unsuppress_profiles_job(job_id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_suppression_bulk_delete_job

Get Bulk Unsuppress Profiles Job Get the bulk unsuppress profiles job with the given job ID.
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `subscriptions:read`

Parameters:

  • job_id (String)

    ID of the job to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1095
1096
1097
1098
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1095

def get_bulk_unsuppress_profiles_job(job_id, opts = {})
  data, _status_code, _headers = get_bulk_unsuppress_profiles_job_with_http_info(job_id, opts)
  data
end

#get_bulk_unsuppress_profiles_job_with_http_info(job_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_suppression_bulk_delete_job_with_http_info

Get Bulk Unsuppress Profiles Job Get the bulk unsuppress profiles job with the given job ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;subscriptions:read&#x60;

Parameters:

  • job_id (String)

    ID of the job to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1109

def get_bulk_unsuppress_profiles_job_with_http_info(job_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_unsuppress_profiles_job ...'
  end
  # verify the required parameter 'job_id' is set
  if @api_client.config.client_side_validation && job_id.nil?
    fail ArgumentError, "Missing the required parameter 'job_id' when calling ProfilesApi.get_bulk_unsuppress_profiles_job"
  end
  allowable_values = ["status", "created_at", "total_count", "completed_count", "completed_at", "skipped_count"]
  if @api_client.config.client_side_validation && opts[:'fields_profile_suppression_bulk_delete_job'] && !opts[:'fields_profile_suppression_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile_suppression_bulk_delete_job\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-suppression-bulk-delete-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile-suppression-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_profile_suppression_bulk_delete_job'], :csv) if !opts[:'fields_profile_suppression_bulk_delete_job'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_bulk_unsuppress_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_bulk_unsuppress_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_bulk_unsuppress_profiles_jobs(opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_suppression_bulk_delete_jobs

Get Bulk Unsuppress Profiles Jobs Get all bulk unsuppress profiles jobs.
*Rate limits*:
Burst: ‘75/s`
Steady: `700/m` Scopes: `subscriptions:read`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1175
1176
1177
1178
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1175

def get_bulk_unsuppress_profiles_jobs(opts = {})
  data, _status_code, _headers = get_bulk_unsuppress_profiles_jobs_with_http_info(opts)
  data
end

#get_bulk_unsuppress_profiles_jobs_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_suppression_bulk_delete_jobs_with_http_info

Get Bulk Unsuppress Profiles Jobs Get all bulk unsuppress profiles jobs.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;subscriptions:read&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1191

def get_bulk_unsuppress_profiles_jobs_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_unsuppress_profiles_jobs ...'
  end
  allowable_values = ["status", "created_at", "total_count", "completed_count", "completed_at", "skipped_count"]
  if @api_client.config.client_side_validation && opts[:'fields_profile_suppression_bulk_delete_job'] && !opts[:'fields_profile_suppression_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile_suppression_bulk_delete_job\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "-created"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-suppression-bulk-delete-jobs'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile-suppression-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_profile_suppression_bulk_delete_job'], :csv) if !opts[:'fields_profile_suppression_bulk_delete_job'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_bulk_unsuppress_profiles_jobs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_bulk_unsuppress_profiles_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_errors_for_bulk_import_profiles_job(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_job_import_errors, get_import_errors_for_profile_bulk_import_job, get_profile_bulk_import_job_import_errors

Get Errors for Bulk Import Profiles Job Get import errors for the bulk profile import job with the given ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1260
1261
1262
1263
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1260

def get_errors_for_bulk_import_profiles_job(id, opts = {})
  data, _status_code, _headers = get_errors_for_bulk_import_profiles_job_with_http_info(id, opts)
  data
end

#get_errors_for_bulk_import_profiles_job_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_job_import_errors_with_http_info, get_import_errors_for_profile_bulk_import_job_with_http_info, get_profile_bulk_import_job_import_errors_with_http_info

Get Errors for Bulk Import Profiles Job Get import errors for the bulk profile import job with the given ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1282

def get_errors_for_bulk_import_profiles_job_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_errors_for_bulk_import_profiles_job ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_errors_for_bulk_import_profiles_job"
  end
  allowable_values = ["code", "title", "detail", "source", "source.pointer", "original_payload"]
  if @api_client.config.client_side_validation && opts[:'fields_import_error'] && !opts[:'fields_import_error'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_import_error\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_errors_for_bulk_import_profiles_job, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_errors_for_bulk_import_profiles_job, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/profile-bulk-import-jobs/{id}/import-errors'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[import-error]'] = @api_client.build_collection_param(opts[:'fields_import_error'], :csv) if !opts[:'fields_import_error'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_errors_for_bulk_import_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_errors_for_bulk_import_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list_for_bulk_import_profiles_job(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_job_lists, get_lists_for_profile_bulk_import_job, get_profile_bulk_import_job_lists

Get List for Bulk Import Profiles Job Get list for the bulk profile import job with the given ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `lists:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1362
1363
1364
1365
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1362

def get_list_for_bulk_import_profiles_job(id, opts = {})
  data, _status_code, _headers = get_list_for_bulk_import_profiles_job_with_http_info(id, opts)
  data
end

#get_list_for_bulk_import_profiles_job_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_job_lists_with_http_info, get_lists_for_profile_bulk_import_job_with_http_info, get_profile_bulk_import_job_lists_with_http_info

Get List for Bulk Import Profiles Job Get list for the bulk profile import job with the given ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;lists:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1382

def get_list_for_bulk_import_profiles_job_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_list_for_bulk_import_profiles_job ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_list_for_bulk_import_profiles_job"
  end
  allowable_values = ["name", "created", "updated", "opt_in_process"]
  if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profile-bulk-import-jobs/{id}/lists'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_list_for_bulk_import_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_list_for_bulk_import_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list_ids_for_bulk_import_profiles_job(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_job_relationships_lists, get_list_ids_for_profile_bulk_import_job, get_profile_bulk_import_job_relationships_lists

Get List IDs for Bulk Import Profiles Job Get list relationship for the bulk profile import job with the given ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `lists:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


1451
1452
1453
1454
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1451

def get_list_ids_for_bulk_import_profiles_job(id, opts = {})
  data, _status_code, _headers = get_list_ids_for_bulk_import_profiles_job_with_http_info(id, opts)
  data
end

#get_list_ids_for_bulk_import_profiles_job_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_job_relationships_lists_with_http_info, get_list_ids_for_profile_bulk_import_job_with_http_info, get_profile_bulk_import_job_relationships_lists_with_http_info

Get List IDs for Bulk Import Profiles Job Get list relationship for the bulk profile import job with the given ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;lists:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1470

def get_list_ids_for_bulk_import_profiles_job_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_list_ids_for_bulk_import_profiles_job ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_list_ids_for_bulk_import_profiles_job"
  end
  # resource path
  local_var_path = '/api/profile-bulk-import-jobs/{id}/relationships/lists'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_list_ids_for_bulk_import_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_list_ids_for_bulk_import_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list_ids_for_profile(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_relationships_lists

Get List IDs for Profile Get list memberships for a profile with the given profile ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `lists:read` `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


1534
1535
1536
1537
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1534

def get_list_ids_for_profile(id, opts = {})
  data, _status_code, _headers = get_list_ids_for_profile_with_http_info(id, opts)
  data
end

#get_list_ids_for_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_relationships_lists_with_http_info

Get List IDs for Profile Get list memberships for a profile with the given profile ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60; Scopes: &#x60;lists:read&#x60; &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1547

def get_list_ids_for_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_list_ids_for_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_list_ids_for_profile"
  end
  # resource path
  local_var_path = '/api/profiles/{id}/relationships/lists'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_list_ids_for_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_list_ids_for_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_lists_for_profile(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_lists

Get Lists for Profile Get list memberships for a profile with the given profile ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `lists:read` `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1606
1607
1608
1609
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1606

def get_lists_for_profile(id, opts = {})
  data, _status_code, _headers = get_lists_for_profile_with_http_info(id, opts)
  data
end

#get_lists_for_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_lists_with_http_info

Get Lists for Profile Get list memberships for a profile with the given profile ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60; Scopes: &#x60;lists:read&#x60; &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1620

def get_lists_for_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_lists_for_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_lists_for_profile"
  end
  allowable_values = ["name", "created", "updated", "opt_in_process"]
  if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles/{id}/lists'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_lists_for_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_lists_for_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_profile(id, opts = {}) ⇒ Hash<String, Object>

Get Profile Get the profile with the given profile ID. Use the ‘additional-fields` parameter to include subscriptions and predictive analytics data in your response.
*Rate limits*:
Burst: `75/s`
Steady: `700/m`
Rate limits when using the `include=list` parameter in your API request:
Burst: `1/s`
Steady: `15/m`
Rate limits when using the `include=segment` parameter in your API request:
Burst: `1/s`
Steady: `15/m`
To learn more about how the `include` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](developers.klaviyo.com/en/v2025-04-15/docs/rate_limits_and_error_handling) guide. Scopes: `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1689
1690
1691
1692
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1689

def get_profile(id, opts = {})
  data, _status_code, _headers = get_profile_with_http_info(id, opts)
  data
end

#get_profile_for_push_token(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_push_token_profile

Get Profile for Push Token Return the profile associated with the given push token.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read` `push-tokens:read`

Parameters:

  • id (String)

    The value of the push token

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1792
1793
1794
1795
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1792

def get_profile_for_push_token(id, opts = {})
  data, _status_code, _headers = get_profile_for_push_token_with_http_info(id, opts)
  data
end

#get_profile_for_push_token_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_push_token_profile_with_http_info

Get Profile for Push Token Return the profile associated with the given push token.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60; &#x60;push-tokens:read&#x60;

Parameters:

  • id (String)

    The value of the push token

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1807

def get_profile_for_push_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_for_push_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_profile_for_push_token"
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "subscriptions.sms.transactional", "subscriptions.sms.transactional.can_receive_sms_transactional", "subscriptions.sms.transactional.consent", "subscriptions.sms.transactional.consent_timestamp", "subscriptions.sms.transactional.method", "subscriptions.sms.transactional.method_detail", "subscriptions.sms.transactional.last_updated", "subscriptions.mobile_push", "subscriptions.mobile_push.marketing", "subscriptions.mobile_push.marketing.can_receive_push_marketing", "subscriptions.mobile_push.marketing.consent", "subscriptions.mobile_push.marketing.consent_timestamp", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"]
  if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/push-tokens/{id}/profile'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?
  query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_profile_for_push_token",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_profile_for_push_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_profile_id_for_push_token(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_push_token_relationships_profile

Get Profile ID for Push Token Return the ID of the profile associated with the given push token.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read` `push-tokens:read`

Parameters:

  • id (String)

    The value of the push token

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


1875
1876
1877
1878
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1875

def get_profile_id_for_push_token(id, opts = {})
  data, _status_code, _headers = get_profile_id_for_push_token_with_http_info(id, opts)
  data
end

#get_profile_id_for_push_token_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_push_token_relationships_profile_with_http_info

Get Profile ID for Push Token Return the ID of the profile associated with the given push token.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60; &#x60;push-tokens:read&#x60;

Parameters:

  • id (String)

    The value of the push token

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1888

def get_profile_id_for_push_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_id_for_push_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_profile_id_for_push_token"
  end
  # resource path
  local_var_path = '/api/push-tokens/{id}/relationships/profile'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_profile_id_for_push_token",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_profile_id_for_push_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_profile_ids_for_bulk_import_profiles_job(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_job_relationships_profiles, get_profile_bulk_import_job_relationships_profiles, get_profile_ids_for_profile_bulk_import_job

Get Profile IDs for Bulk Import Profiles Job Get profile relationships for the bulk profile import job with the given ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1948
1949
1950
1951
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1948

def get_profile_ids_for_bulk_import_profiles_job(id, opts = {})
  data, _status_code, _headers = get_profile_ids_for_bulk_import_profiles_job_with_http_info(id, opts)
  data
end

#get_profile_ids_for_bulk_import_profiles_job_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_job_relationships_profiles_with_http_info, get_profile_bulk_import_job_relationships_profiles_with_http_info, get_profile_ids_for_profile_bulk_import_job_with_http_info

Get Profile IDs for Bulk Import Profiles Job Get profile relationships for the bulk profile import job with the given ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1969

def get_profile_ids_for_bulk_import_profiles_job_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_ids_for_bulk_import_profiles_job ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_profile_ids_for_bulk_import_profiles_job"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profile_ids_for_bulk_import_profiles_job, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profile_ids_for_bulk_import_profiles_job, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/profile-bulk-import-jobs/{id}/relationships/profiles'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_profile_ids_for_bulk_import_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_profile_ids_for_bulk_import_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Profile Get the profile with the given profile ID. Use the &#x60;additional-fields&#x60; parameter to include subscriptions and predictive analytics data in your response.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60;&lt;br&gt;&lt;br&gt;Rate limits when using the &#x60;include&#x3D;list&#x60; parameter in your API request:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;15/m&#x60;&lt;br&gt;&lt;br&gt;Rate limits when using the &#x60;include&#x3D;segment&#x60; parameter in your API request:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;15/m&#x60;&lt;br&gt;&lt;br&gt;To learn more about how the &#x60;include&#x60; parameter impacts rate limits, check out our [Rate limits, status codes, and errors](developers.klaviyo.com/en/v2025-04-15/docs/rate_limits_and_error_handling) guide. Scopes: &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 1705

def get_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_profile"
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "created", "updated", "opt_in_process"]
  if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}"
  end
  allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "subscriptions.sms.transactional", "subscriptions.sms.transactional.can_receive_sms_transactional", "subscriptions.sms.transactional.consent", "subscriptions.sms.transactional.consent_timestamp", "subscriptions.sms.transactional.method", "subscriptions.sms.transactional.method_detail", "subscriptions.sms.transactional.last_updated", "subscriptions.mobile_push", "subscriptions.mobile_push.marketing", "subscriptions.mobile_push.marketing.can_receive_push_marketing", "subscriptions.mobile_push.marketing.consent", "subscriptions.mobile_push.marketing.consent_timestamp", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"]
  if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "token", "enablement_status", "platform", "vendor", "background", "recorded_date", "metadata", "metadata.device_id", "metadata.klaviyo_sdk", "metadata.sdk_version", "metadata.device_model", "metadata.os_name", "metadata.os_version", "metadata.manufacturer", "metadata.app_name", "metadata.app_version", "metadata.app_build", "metadata.app_id", "metadata.environment"]
  if @api_client.config.client_side_validation && opts[:'fields_push_token'] && !opts[:'fields_push_token'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_push_token\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "definition", "definition.condition_groups", "created", "updated", "is_active", "is_processing", "is_starred"]
  if @api_client.config.client_side_validation && opts[:'fields_segment'] && !opts[:'fields_segment'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_segment\", must include one of #{allowable_values}"
  end
  allowable_values = ["lists", "push-tokens", "segments"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?
  query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil?
  query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
  query_params[:'fields[push-token]'] = @api_client.build_collection_param(opts[:'fields_push_token'], :csv) if !opts[:'fields_push_token'].nil?
  query_params[:'fields[segment]'] = @api_client.build_collection_param(opts[:'fields_segment'], :csv) if !opts[:'fields_segment'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_profiles(opts = {}) ⇒ Hash<String, Object>

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` Use the `additional-fields` parameter to include subscriptions and predictive analytics data in your response.
*Rate limits*:
Burst: `75/s`
Steady: `700/m`
Rate limits when using the `additional-fields=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](developers.klaviyo.com/en/v2025-04-15/docs/rate_limits_and_error_handling) guide. Scopes: `profiles:read`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

  • :fields_profile (Array<String>)
  • :filter (String)

    For more information please visit developers.klaviyo.com/en/v2025-04-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;email&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;phone_number&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;external_id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;_kx&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.list_suppressions.reason&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.list_suppressions.timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.list_suppressions.list_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.suppression.reason&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.suppression.timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;

  • :include (Array<String>)
  • :page_cursor (String)
  • :page_size (Integer)

    Default: 20. Min: 1. Max: 100. (default to 20)

  • :sort (String)

Returns:

  • (Hash<String, Object>)


2049
2050
2051
2052
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2049

def get_profiles(opts = {})
  data, _status_code, _headers = get_profiles_with_http_info(opts)
  data
end

#get_profiles_for_bulk_import_profiles_job(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_bulk_profile_import_job_profiles, get_profile_bulk_import_job_profiles, get_profiles_for_profile_bulk_import_job

Get Profiles for Bulk Import Profiles Job Get profiles for the bulk profile import job with the given ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


2151
2152
2153
2154
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2151

def get_profiles_for_bulk_import_profiles_job(id, opts = {})
  data, _status_code, _headers = get_profiles_for_bulk_import_profiles_job_with_http_info(id, opts)
  data
end

#get_profiles_for_bulk_import_profiles_job_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_bulk_profile_import_job_profiles_with_http_info, get_profile_bulk_import_job_profiles_with_http_info, get_profiles_for_profile_bulk_import_job_with_http_info

Get Profiles for Bulk Import Profiles Job Get profiles for the bulk profile import job with the given ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2174

def get_profiles_for_bulk_import_profiles_job_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profiles_for_bulk_import_profiles_job ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_profiles_for_bulk_import_profiles_job"
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "subscriptions.sms.transactional", "subscriptions.sms.transactional.can_receive_sms_transactional", "subscriptions.sms.transactional.consent", "subscriptions.sms.transactional.consent_timestamp", "subscriptions.sms.transactional.method", "subscriptions.sms.transactional.method_detail", "subscriptions.sms.transactional.last_updated", "subscriptions.mobile_push", "subscriptions.mobile_push.marketing", "subscriptions.mobile_push.marketing.can_receive_push_marketing", "subscriptions.mobile_push.marketing.consent", "subscriptions.mobile_push.marketing.consent_timestamp", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"]
  if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profiles_for_bulk_import_profiles_job, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profiles_for_bulk_import_profiles_job, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/profile-bulk-import-jobs/{id}/profiles'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?
  query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_profiles_for_bulk_import_profiles_job",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_profiles_for_bulk_import_profiles_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_profiles_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Profiles Get all profiles in an account. Profiles can be sorted by the following fields in ascending and descending order: &#x60;id&#x60;, &#x60;created&#x60;, &#x60;updated&#x60;, &#x60;email&#x60;, &#x60;subscriptions.email.marketing.suppression.timestamp&#x60;, &#x60;subscriptions.email.marketing.list_suppressions.timestamp&#x60; Use the &#x60;additional-fields&#x60; parameter to include subscriptions and predictive analytics data in your response.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60;&lt;br&gt;&lt;br&gt;Rate limits when using the &#x60;additional-fields&#x3D;predictive_analytics&#x60; parameter in your API request:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60;&lt;br&gt;&lt;br&gt;To learn more about how the &#x60;additional-fields&#x60; parameter impacts rate limits, check out our [Rate limits, status codes, and errors](developers.klaviyo.com/en/v2025-04-15/docs/rate_limits_and_error_handling) guide. Scopes: &#x60;profiles:read&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

  • :fields_profile (Array<String>)
  • :filter (String)

    For more information please visit developers.klaviyo.com/en/v2025-04-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;email&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;phone_number&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;external_id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;_kx&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.list_suppressions.reason&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.list_suppressions.timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.list_suppressions.list_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.suppression.reason&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;subscriptions.email.marketing.suppression.timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;

  • :include (Array<String>)
  • :page_cursor (String)
  • :page_size (Integer)

    Default: 20. Min: 1. Max: 100. (default to 20)

  • :sort (String)

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2065

def get_profiles_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profiles ...'
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "subscriptions.sms.transactional", "subscriptions.sms.transactional.can_receive_sms_transactional", "subscriptions.sms.transactional.consent", "subscriptions.sms.transactional.consent_timestamp", "subscriptions.sms.transactional.method", "subscriptions.sms.transactional.method_detail", "subscriptions.sms.transactional.last_updated", "subscriptions.mobile_push", "subscriptions.mobile_push.marketing", "subscriptions.mobile_push.marketing.can_receive_push_marketing", "subscriptions.mobile_push.marketing.consent", "subscriptions.mobile_push.marketing.consent_timestamp", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"]
  if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["lists", "push-tokens", "segments"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profiles, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profiles, must be greater than or equal to 1.'
  end

  allowable_values = ["created", "-created", "email", "-email", "id", "-id", "subscriptions.email.marketing.list_suppressions.timestamp", "-subscriptions.email.marketing.list_suppressions.timestamp", "subscriptions.email.marketing.suppression.timestamp", "-subscriptions.email.marketing.suppression.timestamp", "updated", "-updated"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?
  query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_push_token(id, opts = {}) ⇒ Hash<String, Object>

Get Push Token Return a specific push token based on its ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read` `push-tokens:read`

Parameters:

  • id (String)

    The value of the push token

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


2261
2262
2263
2264
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2261

def get_push_token(id, opts = {})
  data, _status_code, _headers = get_push_token_with_http_info(id, opts)
  data
end

#get_push_token_ids_for_profile(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_relationships_push_tokens

Get Push Token IDs for Profile Return the IDs of all push tokens associated with the given profile.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


2344
2345
2346
2347
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2344

def get_push_token_ids_for_profile(id, opts = {})
  data, _status_code, _headers = get_push_token_ids_for_profile_with_http_info(id, opts)
  data
end

#get_push_token_ids_for_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_relationships_push_tokens_with_http_info

Get Push Token IDs for Profile Return the IDs of all push tokens associated with the given profile.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2357

def get_push_token_ids_for_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_push_token_ids_for_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_push_token_ids_for_profile"
  end
  # resource path
  local_var_path = '/api/profiles/{id}/relationships/push-tokens'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_push_token_ids_for_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_push_token_ids_for_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_push_token_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Push Token Return a specific push token based on its ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60; &#x60;push-tokens:read&#x60;

Parameters:

  • id (String)

    The value of the push token

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2274

def get_push_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_push_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_push_token"
  end
  allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties"]
  if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "token", "enablement_status", "platform", "vendor", "background", "recorded_date", "metadata", "metadata.device_id", "metadata.klaviyo_sdk", "metadata.sdk_version", "metadata.device_model", "metadata.os_name", "metadata.os_version", "metadata.manufacturer", "metadata.app_name", "metadata.app_version", "metadata.app_build", "metadata.app_id", "metadata.environment"]
  if @api_client.config.client_side_validation && opts[:'fields_push_token'] && !opts[:'fields_push_token'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_push_token\", must include one of #{allowable_values}"
  end
  allowable_values = ["profile"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/push-tokens/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
  query_params[:'fields[push-token]'] = @api_client.build_collection_param(opts[:'fields_push_token'], :csv) if !opts[:'fields_push_token'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_push_token",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_push_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_push_tokens(opts = {}) ⇒ Hash<String, Object>

Get Push Tokens Return push tokens associated with company.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read` `push-tokens:read`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


2420
2421
2422
2423
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2420

def get_push_tokens(opts = {})
  data, _status_code, _headers = get_push_tokens_with_http_info(opts)
  data
end

#get_push_tokens_for_profile(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_push_tokens

Get Push Tokens for Profile Return all push tokens that belong to the given profile.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `profiles:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


2513
2514
2515
2516
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2513

def get_push_tokens_for_profile(id, opts = {})
  data, _status_code, _headers = get_push_tokens_for_profile_with_http_info(id, opts)
  data
end

#get_push_tokens_for_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_push_tokens_with_http_info

Get Push Tokens for Profile Return all push tokens that belong to the given profile.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2527

def get_push_tokens_for_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_push_tokens_for_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_push_tokens_for_profile"
  end
  allowable_values = ["created", "token", "enablement_status", "platform", "vendor", "background", "recorded_date", "metadata", "metadata.device_id", "metadata.klaviyo_sdk", "metadata.sdk_version", "metadata.device_model", "metadata.os_name", "metadata.os_version", "metadata.manufacturer", "metadata.app_name", "metadata.app_version", "metadata.app_build", "metadata.app_id", "metadata.environment"]
  if @api_client.config.client_side_validation && opts[:'fields_push_token'] && !opts[:'fields_push_token'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_push_token\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles/{id}/push-tokens'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[push-token]'] = @api_client.build_collection_param(opts[:'fields_push_token'], :csv) if !opts[:'fields_push_token'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_push_tokens_for_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_push_tokens_for_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_push_tokens_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Push Tokens Return push tokens associated with company.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:read&#x60; &#x60;push-tokens:read&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2435

def get_push_tokens_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_push_tokens ...'
  end
  allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties"]
  if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "token", "enablement_status", "platform", "vendor", "background", "recorded_date", "metadata", "metadata.device_id", "metadata.klaviyo_sdk", "metadata.sdk_version", "metadata.device_model", "metadata.os_name", "metadata.os_version", "metadata.manufacturer", "metadata.app_name", "metadata.app_version", "metadata.app_build", "metadata.app_id", "metadata.environment"]
  if @api_client.config.client_side_validation && opts[:'fields_push_token'] && !opts[:'fields_push_token'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_push_token\", must include one of #{allowable_values}"
  end
  allowable_values = ["profile"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_push_tokens, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_push_tokens, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/push-tokens'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
  query_params[:'fields[push-token]'] = @api_client.build_collection_param(opts[:'fields_push_token'], :csv) if !opts[:'fields_push_token'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_push_tokens",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_push_tokens\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_segment_ids_for_profile(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_relationships_segments

Get Segment IDs for Profile 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`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


2590
2591
2592
2593
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2590

def get_segment_ids_for_profile(id, opts = {})
  data, _status_code, _headers = get_segment_ids_for_profile_with_http_info(id, opts)
  data
end

#get_segment_ids_for_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_relationships_segments_with_http_info

Get Segment IDs for Profile Get segment membership relationships for a profile with the given profile ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60; Scopes: &#x60;profiles:read&#x60; &#x60;segments:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2603

def get_segment_ids_for_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_segment_ids_for_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_segment_ids_for_profile"
  end
  # resource path
  local_var_path = '/api/profiles/{id}/relationships/segments'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_segment_ids_for_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_segment_ids_for_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_segments_for_profile(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_profile_segments

Get Segments for Profile Get segment memberships for a profile with the given profile ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `profiles:read` `segments:read`

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


2662
2663
2664
2665
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2662

def get_segments_for_profile(id, opts = {})
  data, _status_code, _headers = get_segments_for_profile_with_http_info(id, opts)
  data
end

#get_segments_for_profile_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: get_profile_segments_with_http_info

Get Segments for Profile Get segment memberships for a profile with the given profile ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60; Scopes: &#x60;profiles:read&#x60; &#x60;segments:read&#x60;

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2676

def get_segments_for_profile_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.get_segments_for_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.get_segments_for_profile"
  end
  allowable_values = ["name", "definition", "definition.condition_groups", "created", "updated", "is_active", "is_processing", "is_starred"]
  if @api_client.config.client_side_validation && opts[:'fields_segment'] && !opts[:'fields_segment'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_segment\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles/{id}/segments'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[segment]'] = @api_client.build_collection_param(opts[:'fields_segment'], :csv) if !opts[:'fields_segment'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.get_segments_for_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#get_segments_for_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#merge_profiles(profile_merge_query, opts = {}) ⇒ Hash<String, Object> Also known as: create_profile_merge

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](help.klaviyo.com/hc/en-us/articles/115005073847#merge-2-profiles3).
*Rate limits*:
Burst: `10/s`
Steady: `150/m` Scopes: `profiles:write`

Parameters:

  • profile_merge_query (ProfileMergeQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


2739
2740
2741
2742
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2739

def merge_profiles(profile_merge_query, opts = {})
  data, _status_code, _headers = merge_profiles_with_http_info(profile_merge_query, opts)
  data
end

#merge_profiles_with_http_info(profile_merge_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_profile_merge_with_http_info

Merge Profiles Merge a given related profile into a profile with the given profile ID. The profile provided under &#x60;relationships&#x60; (the &quot;source&quot; profile) will be merged into the profile provided by the ID in the base data object (the &quot;destination&quot; 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](help.klaviyo.com/hc/en-us/articles/115005073847#merge-2-profiles3).&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;profiles:write&#x60;

Parameters:

  • profile_merge_query (ProfileMergeQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2752

def merge_profiles_with_http_info(profile_merge_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.merge_profiles ...'
  end
  # verify the required parameter 'profile_merge_query' is set
  if @api_client.config.client_side_validation && profile_merge_query.nil?
    fail ArgumentError, "Missing the required parameter 'profile_merge_query' when calling ProfilesApi.merge_profiles"
  end
  # resource path
  local_var_path = '/api/profile-merge'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(profile_merge_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.merge_profiles",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#merge_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_profile(id, profile_partial_update_query, opts = {}) ⇒ Hash<String, Object>

Update Profile Update the profile with the given profile ID. Use the ‘additional-fields` parameter to include subscriptions and predictive analytics data in your response. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged. The maximum allowed payload size is 100KB.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` Scopes: `profiles:write`

Parameters:

  • id (String)

    Primary key that uniquely identifies this profile. Generated by Klaviyo.

  • profile_partial_update_query (ProfilePartialUpdateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

Returns:

  • (Hash<String, Object>)


2817
2818
2819
2820
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2817

def update_profile(id, profile_partial_update_query, opts = {})
  data, _status_code, _headers = update_profile_with_http_info(id, profile_partial_update_query, opts)
  data
end

#update_profile_with_http_info(id, profile_partial_update_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Update Profile Update the profile with the given profile ID. Use the &#x60;additional-fields&#x60; parameter to include subscriptions and predictive analytics data in your response. Note that setting a field to &#x60;null&#x60; will clear out the field, whereas not including a field in your request will leave it unchanged. The maximum allowed payload size is 100KB.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; Scopes: &#x60;profiles:write&#x60;

Parameters:

  • id (String)

    Primary key that uniquely identifies this profile. Generated by Klaviyo.

  • profile_partial_update_query (ProfilePartialUpdateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :additional_fields_profile (Array<String>)

    Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
# File 'lib/klaviyo-api-sdk/api/profiles_api.rb', line 2829

def update_profile_with_http_info(id, profile_partial_update_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.update_profile ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ProfilesApi.update_profile"
  end
  # verify the required parameter 'profile_partial_update_query' is set
  if @api_client.config.client_side_validation && profile_partial_update_query.nil?
    fail ArgumentError, "Missing the required parameter 'profile_partial_update_query' when calling ProfilesApi.update_profile"
  end
  allowable_values = ["subscriptions", "predictive_analytics"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/profiles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(profile_partial_update_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ProfilesApi.update_profile",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#update_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end