Class: KlaviyoAPI::FlowsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FlowsApi

Returns a new instance of FlowsApi.



18
19
20
# File 'lib/klaviyo-api-sdk/api/flows_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/flows_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

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

Create Flow Create a new flow using an encoded flow definition. New objects within the flow definition, such as actions, will need to use a ‘temporary_id` field for identification. These will be replaced with traditional `id` fields after successful creation. A successful request will return the new definition to you.
*Rate limits*:
Burst: `1/s`
Steady: `15/m`
Daily: `100/d` Scopes: `flows:write`

Parameters:

  • flow_create_query (FlowCreateQuery)

    Creates a Flow from parameters

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

    the optional parameters

Options Hash (opts):

  • :additional_fields_flow (Array<String>)

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

Returns:

  • (Hash<String, Object>)


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

def create_flow(flow_create_query, opts = {})
  data, _status_code, _headers = create_flow_with_http_info(flow_create_query, opts)
  data
end

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

Create Flow Create a new flow using an encoded flow definition. New objects within the flow definition, such as actions, will need to use a &#x60;temporary_id&#x60; field for identification. These will be replaced with traditional &#x60;id&#x60; fields after successful creation. A successful request will return the new definition to you.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;15/m&#x60;&lt;br&gt;Daily: &#x60;100/d&#x60; Scopes: &#x60;flows:write&#x60;

Parameters:

  • flow_create_query (FlowCreateQuery)

    Creates a Flow from parameters

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

    the optional parameters

Options Hash (opts):

  • :additional_fields_flow (Array<String>)

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

Returns:

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

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



38
39
40
41
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
96
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 38

def create_flow_with_http_info(flow_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.create_flow ...'
  end
  # verify the required parameter 'flow_create_query' is set
  if @api_client.config.client_side_validation && flow_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'flow_create_query' when calling FlowsApi.create_flow"
  end
  allowable_values = ["definition"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_flow'] && !opts[:'additional_fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_flow\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flows'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[flow]'] = @api_client.build_collection_param(opts[:'additional_fields_flow'], :csv) if !opts[:'additional_fields_flow'].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(flow_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 => :"FlowsApi.create_flow",
    :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: FlowsApi#create_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Delete Flow Delete a flow with the given flow ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:write`

Parameters:

  • id (String)

    ID of the Flow to delete. Ex: XVTP5Q

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

    the optional parameters

Returns:

  • (nil)


103
104
105
106
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 103

def delete_flow(id, opts = {})
  delete_flow_with_http_info(id, opts)
  nil
end

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

Delete Flow Delete a flow with the given flow 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;flows:write&#x60;

Parameters:

  • id (String)

    ID of the Flow to delete. Ex: XVTP5Q

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



113
114
115
116
117
118
119
120
121
122
123
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 113

def delete_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.delete_flow ...'
  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 FlowsApi.delete_flow"
  end
  # resource path
  local_var_path = '/api/flows/{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 => :"FlowsApi.delete_flow",
    :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: FlowsApi#delete_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Action for Flow Message Get the flow action for a flow message with the given message ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


169
170
171
172
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 169

def get_action_for_flow_message(id, opts = {})
  data, _status_code, _headers = get_action_for_flow_message_with_http_info(id, opts)
  data
end

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

Get Action for Flow Message Get the flow action for a flow message with the given message 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;flows: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



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 183

def get_action_for_flow_message_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_action_for_flow_message ...'
  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 FlowsApi.get_action_for_flow_message"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "tracking_options.add_utm", "tracking_options.utm_params", "tracking_options.is_tracking_opens", "tracking_options.is_tracking_clicks", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "badge_options", "badge_options.badge_config", "badge_options.value", "badge_options.set_from_property", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-messages/{id}/flow-action'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].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 => :"FlowsApi.get_action_for_flow_message",
    :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: FlowsApi#get_action_for_flow_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Action ID for Flow Message Get the [relationship](developers.klaviyo.com/en/reference/api_overview#relationships) for a flow message’s flow action, given the flow ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


246
247
248
249
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 246

def get_action_id_for_flow_message(id, opts = {})
  data, _status_code, _headers = get_action_id_for_flow_message_with_http_info(id, opts)
  data
end

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

Get Action ID for Flow Message Get the [relationship](developers.klaviyo.com/en/reference/api_overview#relationships) for a flow message&#39;s flow action, given the flow 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;flows: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



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 259

def get_action_id_for_flow_message_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_action_id_for_flow_message ...'
  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 FlowsApi.get_action_id_for_flow_message"
  end
  # resource path
  local_var_path = '/api/flow-messages/{id}/relationships/flow-action'.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 => :"FlowsApi.get_action_id_for_flow_message",
    :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: FlowsApi#get_action_id_for_flow_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_action_ids_for_flow(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_flow_relationships_flow_actions, get_flow_relationships_actions

Get Action IDs for Flow Get all [relationships](developers.klaviyo.com/en/reference/api_overview#relationships) for flow actions associated with the given flow ID. Returns a maximum of 100 flows per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


321
322
323
324
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 321

def get_action_ids_for_flow(id, opts = {})
  data, _status_code, _headers = get_action_ids_for_flow_with_http_info(id, opts)
  data
end

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

Get Action IDs for Flow Get all [relationships](developers.klaviyo.com/en/reference/api_overview#relationships) for flow actions associated with the given flow ID. Returns a maximum of 100 flows per request, which can be paginated with cursor-based pagination.&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;flows: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



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 341

def get_action_ids_for_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_action_ids_for_flow ...'
  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 FlowsApi.get_action_ids_for_flow"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling FlowsApi.get_action_ids_for_flow, must be smaller than or equal to 50.'
  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 FlowsApi.get_action_ids_for_flow, must be greater than or equal to 1.'
  end

  allowable_values = ["action_type", "-action_type", "created", "-created", "id", "-id", "status", "-status", "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/flows/{id}/relationships/flow-actions'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  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 => :"FlowsApi.get_action_ids_for_flow",
    :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: FlowsApi#get_action_ids_for_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_actions_for_flow(id, opts = {}) ⇒ Hash<String, Object> Also known as: get_flow_flow_actions, get_flow_actions

Get Actions for Flow Get all flow actions associated with the given flow ID. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


423
424
425
426
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 423

def get_actions_for_flow(id, opts = {})
  data, _status_code, _headers = get_actions_for_flow_with_http_info(id, opts)
  data
end

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

Get Actions for Flow Get all flow actions associated with the given flow ID. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.&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;flows: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



444
445
446
447
448
449
450
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
510
511
512
513
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 444

def get_actions_for_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_actions_for_flow ...'
  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 FlowsApi.get_actions_for_flow"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "tracking_options.add_utm", "tracking_options.utm_params", "tracking_options.is_tracking_opens", "tracking_options.is_tracking_clicks", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "badge_options", "badge_options.badge_config", "badge_options.value", "badge_options.set_from_property", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling FlowsApi.get_actions_for_flow, must be smaller than or equal to 50.'
  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 FlowsApi.get_actions_for_flow, must be greater than or equal to 1.'
  end

  allowable_values = ["action_type", "-action_type", "created", "-created", "id", "-id", "status", "-status", "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/flows/{id}/flow-actions'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].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 => :"FlowsApi.get_actions_for_flow",
    :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: FlowsApi#get_actions_for_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flow Get a flow with the given flow ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


531
532
533
534
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 531

def get_flow(id, opts = {})
  data, _status_code, _headers = get_flow_with_http_info(id, opts)
  data
end

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

Get Flow Action Get a flow action from a flow with the given flow action ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


630
631
632
633
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 630

def get_flow_action(id, opts = {})
  data, _status_code, _headers = get_flow_action_with_http_info(id, opts)
  data
end

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

Get Messages For Flow Action Get all flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


724
725
726
727
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 724

def get_flow_action_messages(id, opts = {})
  data, _status_code, _headers = get_flow_action_messages_with_http_info(id, opts)
  data
end

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

Get Messages For Flow Action Get all flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.&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;flows: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



742
743
744
745
746
747
748
749
750
751
752
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 742

def get_flow_action_messages_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_action_messages ...'
  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 FlowsApi.get_flow_action_messages"
  end
  allowable_values = ["name", "channel", "content", "content.subject", "content.preview_text", "content.from_email", "content.from_label", "content.reply_to_email", "content.cc_email", "content.bcc_email", "content.body", "content.media_url", "content.title", "content.sound", "content.badge", "content.dynamic_image", "content.ios_link", "content.android_link", "content.on_open", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_message'] && !opts[:'fields_flow_message'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_message\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling FlowsApi.get_flow_action_messages, must be smaller than or equal to 50.'
  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 FlowsApi.get_flow_action_messages, must be greater than or equal to 1.'
  end

  allowable_values = ["created", "-created", "id", "-id", "name", "-name", "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/flow-actions/{id}/flow-messages'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-message]'] = @api_client.build_collection_param(opts[:'fields_flow_message'], :csv) if !opts[:'fields_flow_message'].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 => :"FlowsApi.get_flow_action_messages",
    :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: FlowsApi#get_flow_action_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flow Action Get a flow action from a flow with the given flow action 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;flows: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



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 644

def get_flow_action_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_action ...'
  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 FlowsApi.get_flow_action"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "tracking_options.add_utm", "tracking_options.utm_params", "tracking_options.is_tracking_opens", "tracking_options.is_tracking_clicks", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "badge_options", "badge_options.badge_config", "badge_options.value", "badge_options.set_from_property", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "channel", "content", "content.subject", "content.preview_text", "content.from_email", "content.from_label", "content.reply_to_email", "content.cc_email", "content.bcc_email", "content.body", "content.media_url", "content.title", "content.sound", "content.badge", "content.dynamic_image", "content.ios_link", "content.android_link", "content.on_open", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_message'] && !opts[:'fields_flow_message'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_message\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow", "flow-messages"]
  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/flow-actions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow-message]'] = @api_client.build_collection_param(opts[:'fields_flow_message'], :csv) if !opts[:'fields_flow_message'].nil?
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].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 => :"FlowsApi.get_flow_action",
    :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: FlowsApi#get_flow_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flow for Flow Action Get the flow associated with the given action ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


822
823
824
825
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 822

def get_flow_for_flow_action(id, opts = {})
  data, _status_code, _headers = get_flow_for_flow_action_with_http_info(id, opts)
  data
end

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

Get Flow for Flow Action Get the flow associated with the given action 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;flows: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



836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 836

def get_flow_for_flow_action_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_for_flow_action ...'
  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 FlowsApi.get_flow_for_flow_action"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-actions/{id}/flow'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].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 => :"FlowsApi.get_flow_for_flow_action",
    :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: FlowsApi#get_flow_for_flow_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flow ID for Flow Action Get the flow associated with the given action ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


899
900
901
902
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 899

def get_flow_id_for_flow_action(id, opts = {})
  data, _status_code, _headers = get_flow_id_for_flow_action_with_http_info(id, opts)
  data
end

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

Get Flow ID for Flow Action Get the flow associated with the given action 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;flows: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



912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 912

def get_flow_id_for_flow_action_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_id_for_flow_action ...'
  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 FlowsApi.get_flow_id_for_flow_action"
  end
  # resource path
  local_var_path = '/api/flow-actions/{id}/relationships/flow'.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 => :"FlowsApi.get_flow_id_for_flow_action",
    :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: FlowsApi#get_flow_id_for_flow_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flow Message Get the flow message of a flow with the given message ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


974
975
976
977
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 974

def get_flow_message(id, opts = {})
  data, _status_code, _headers = get_flow_message_with_http_info(id, opts)
  data
end

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

Get Flow Message Get the flow message of a flow with the given message 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;flows: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



988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 988

def get_flow_message_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_message ...'
  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 FlowsApi.get_flow_message"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "tracking_options.add_utm", "tracking_options.utm_params", "tracking_options.is_tracking_opens", "tracking_options.is_tracking_clicks", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "badge_options", "badge_options.badge_config", "badge_options.value", "badge_options.set_from_property", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "channel", "content", "content.subject", "content.preview_text", "content.from_email", "content.from_label", "content.reply_to_email", "content.cc_email", "content.bcc_email", "content.body", "content.media_url", "content.title", "content.sound", "content.badge", "content.dynamic_image", "content.ios_link", "content.android_link", "content.on_open", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_message'] && !opts[:'fields_flow_message'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_message\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "editor_type", "html", "text", "amp", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_template'] && !opts[:'fields_template'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_template\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow-action", "template"]
  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/flow-messages/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow-message]'] = @api_client.build_collection_param(opts[:'fields_flow_message'], :csv) if !opts[:'fields_flow_message'].nil?
  query_params[:'fields[template]'] = @api_client.build_collection_param(opts[:'fields_template'], :csv) if !opts[:'fields_template'].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 => :"FlowsApi.get_flow_message",
    :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: FlowsApi#get_flow_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flow Get a flow with the given flow 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;flows: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



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
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 546

def get_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow ...'
  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 FlowsApi.get_flow"
  end
  allowable_values = ["definition"]
  if @api_client.config.client_side_validation && opts[:'additional_fields_flow'] && !opts[:'additional_fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"additional_fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "tracking_options.add_utm", "tracking_options.utm_params", "tracking_options.is_tracking_opens", "tracking_options.is_tracking_clicks", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "badge_options", "badge_options.badge_config", "badge_options.value", "badge_options.set_from_property", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type", "definition", "definition.triggers", "definition.profile_filter", "definition.profile_filter.condition_groups", "definition.actions", "definition.entry_action_id"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["name"]
  if @api_client.config.client_side_validation && opts[:'fields_tag'] && !opts[:'fields_tag'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_tag\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow-actions", "tags"]
  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/flows/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'additional-fields[flow]'] = @api_client.build_collection_param(opts[:'additional_fields_flow'], :csv) if !opts[:'additional_fields_flow'].nil?
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].nil?
  query_params[:'fields[tag]'] = @api_client.build_collection_param(opts[:'fields_tag'], :csv) if !opts[:'fields_tag'].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 => :"FlowsApi.get_flow",
    :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: FlowsApi#get_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Flows Get all flows in an account. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1070
1071
1072
1073
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1070

def get_flows(opts = {})
  data, _status_code, _headers = get_flows_with_http_info(opts)
  data
end

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

Get Flows Get all flows in an account. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.&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;flows: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



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
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
1163
1164
1165
1166
1167
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1087

def get_flows_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flows ...'
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "tracking_options.add_utm", "tracking_options.utm_params", "tracking_options.is_tracking_opens", "tracking_options.is_tracking_clicks", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "badge_options", "badge_options.badge_config", "badge_options.value", "badge_options.set_from_property", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["name"]
  if @api_client.config.client_side_validation && opts[:'fields_tag'] && !opts[:'fields_tag'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_tag\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow-actions", "tags"]
  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'] > 50
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling FlowsApi.get_flows, must be smaller than or equal to 50.'
  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 FlowsApi.get_flows, must be greater than or equal to 1.'
  end

  allowable_values = ["created", "-created", "id", "-id", "name", "-name", "status", "-status", "trigger_type", "-trigger_type", "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/flows'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].nil?
  query_params[:'fields[tag]'] = @api_client.build_collection_param(opts[:'fields_tag'], :csv) if !opts[:'fields_tag'].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 => :"FlowsApi.get_flows",
    :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: FlowsApi#get_flows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Message IDs for Flow Action Get all relationships for flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1178
1179
1180
1181
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1178

def get_message_ids_for_flow_action(id, opts = {})
  data, _status_code, _headers = get_message_ids_for_flow_action_with_http_info(id, opts)
  data
end

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

Get Message IDs for Flow Action Get all relationships for flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.&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;flows: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



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
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1195

def get_message_ids_for_flow_action_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_message_ids_for_flow_action ...'
  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 FlowsApi.get_message_ids_for_flow_action"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling FlowsApi.get_message_ids_for_flow_action, must be smaller than or equal to 50.'
  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 FlowsApi.get_message_ids_for_flow_action, must be greater than or equal to 1.'
  end

  allowable_values = ["created", "-created", "id", "-id", "name", "-name", "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/flow-actions/{id}/relationships/flow-messages'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  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 => :"FlowsApi.get_message_ids_for_flow_action",
    :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: FlowsApi#get_message_ids_for_flow_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Tag IDs for Flow Return the tag IDs of all tags associated with the given flow.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read` `tags:read`

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


1269
1270
1271
1272
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1269

def get_tag_ids_for_flow(id, opts = {})
  data, _status_code, _headers = get_tag_ids_for_flow_with_http_info(id, opts)
  data
end

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

Get Tag IDs for Flow Return the tag IDs of all tags associated with the given flow.&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;flows:read&#x60; &#x60;tags: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



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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1282

def get_tag_ids_for_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_tag_ids_for_flow ...'
  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 FlowsApi.get_tag_ids_for_flow"
  end
  # resource path
  local_var_path = '/api/flows/{id}/relationships/tags'.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 => :"FlowsApi.get_tag_ids_for_flow",
    :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: FlowsApi#get_tag_ids_for_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Tags for Flow Return all tags associated with the given flow ID.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:read` `tags:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1341
1342
1343
1344
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1341

def get_tags_for_flow(id, opts = {})
  data, _status_code, _headers = get_tags_for_flow_with_http_info(id, opts)
  data
end

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

Get Tags for Flow Return all tags associated with the given flow 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;flows:read&#x60; &#x60;tags: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



1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
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
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1355

def get_tags_for_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_tags_for_flow ...'
  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 FlowsApi.get_tags_for_flow"
  end
  allowable_values = ["name"]
  if @api_client.config.client_side_validation && opts[:'fields_tag'] && !opts[:'fields_tag'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_tag\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flows/{id}/tags'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[tag]'] = @api_client.build_collection_param(opts[:'fields_tag'], :csv) if !opts[:'fields_tag'].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 => :"FlowsApi.get_tags_for_flow",
    :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: FlowsApi#get_tags_for_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Template for Flow Message Return the related template
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `templates:read`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


1419
1420
1421
1422
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1419

def get_template_for_flow_message(id, opts = {})
  data, _status_code, _headers = get_template_for_flow_message_with_http_info(id, opts)
  data
end

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

Get Template for Flow Message Return the related template&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;templates: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



1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1433

def get_template_for_flow_message_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_template_for_flow_message ...'
  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 FlowsApi.get_template_for_flow_message"
  end
  allowable_values = ["name", "editor_type", "html", "text", "amp", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_template'] && !opts[:'fields_template'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_template\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-messages/{id}/template'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[template]'] = @api_client.build_collection_param(opts[:'fields_template'], :csv) if !opts[:'fields_template'].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 => :"FlowsApi.get_template_for_flow_message",
    :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: FlowsApi#get_template_for_flow_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Template ID for Flow Message Returns the ID of the related template
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `templates:read`

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


1496
1497
1498
1499
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1496

def get_template_id_for_flow_message(id, opts = {})
  data, _status_code, _headers = get_template_id_for_flow_message_with_http_info(id, opts)
  data
end

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

Get Template ID for Flow Message Returns the ID of the related template&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;templates: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



1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1509

def get_template_id_for_flow_message_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_template_id_for_flow_message ...'
  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 FlowsApi.get_template_id_for_flow_message"
  end
  # resource path
  local_var_path = '/api/flow-messages/{id}/relationships/template'.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 => :"FlowsApi.get_template_id_for_flow_message",
    :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: FlowsApi#get_template_id_for_flow_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Update Flow Status Update the status of a flow with the given flow ID, and all actions in that flow.
*Rate limits*:
Burst: ‘3/s`
Steady: `60/m` Scopes: `flows:write`

Parameters:

  • id (String)

    ID of the Flow to update. Ex: XVTP5Q

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


1568
1569
1570
1571
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1568

def update_flow(id, flow_update_query, opts = {})
  data, _status_code, _headers = update_flow_with_http_info(id, flow_update_query, opts)
  data
end

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

Update Flow Status Update the status of a flow with the given flow ID, and all actions in that flow.&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;flows:write&#x60;

Parameters:

  • id (String)

    ID of the Flow to update. Ex: XVTP5Q

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

    the optional parameters

Returns:

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

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



1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
# File 'lib/klaviyo-api-sdk/api/flows_api.rb', line 1579

def update_flow_with_http_info(id, flow_update_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.update_flow ...'
  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 FlowsApi.update_flow"
  end
  # verify the required parameter 'flow_update_query' is set
  if @api_client.config.client_side_validation && flow_update_query.nil?
    fail ArgumentError, "Missing the required parameter 'flow_update_query' when calling FlowsApi.update_flow"
  end
  # resource path
  local_var_path = '/api/flows/{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'])
  # 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(flow_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 => :"FlowsApi.update_flow",
    :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: FlowsApi#update_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end