Class: Zernio::AdsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/ads_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdsApi

Returns a new instance of AdsApi.



19
20
21
# File 'lib/zernio-sdk/api/ads_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/ads_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_conversion_associations(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ AddConversionAssociations200Response

Associate campaigns Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).

Parameters:

  • account_id (String)
  • destination_id (String)
  • add_conversion_associations_request (AddConversionAssociationsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



29
30
31
32
# File 'lib/zernio-sdk/api/ads_api.rb', line 29

def add_conversion_associations(, destination_id, add_conversion_associations_request, opts = {})
  data, _status_code, _headers = add_conversion_associations_with_http_info(, destination_id, add_conversion_associations_request, opts)
  data
end

#add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ Array<(AddConversionAssociations200Response, Integer, Hash)>

Associate campaigns Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).

Parameters:

  • account_id (String)
  • destination_id (String)
  • add_conversion_associations_request (AddConversionAssociationsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
97
98
99
100
# File 'lib/zernio-sdk/api/ads_api.rb', line 41

def add_conversion_associations_with_http_info(, destination_id, add_conversion_associations_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.add_conversion_associations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.add_conversion_associations"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.add_conversion_associations"
  end
  # verify the required parameter 'add_conversion_associations_request' is set
  if @api_client.config.client_side_validation && add_conversion_associations_request.nil?
    fail ArgumentError, "Missing the required parameter 'add_conversion_associations_request' when calling AdsApi.add_conversion_associations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(add_conversion_associations_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AddConversionAssociations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.add_conversion_associations",
    :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: AdsApi#add_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#adjust_conversions(adjust_conversions_request, opts = {}) ⇒ AdjustConversions200Response

Adjust uploaded conversions Adjust conversions that were previously uploaded via POST /v1/ads/conversions — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. Google Ads only. Google handles adjustments through the classic Google Ads API (ConversionAdjustmentUploadService); the Data Manager ingestEvents path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns 405 for those platforms. Adjustment types: - RETRACTION — remove the conversion entirely (refund, chargeback, cancelled order, churn). - RESTATEMENT — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected total value in restatementValue (not a delta). - ENHANCEMENT — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - orderId — the transaction ID you sent as eventId on the original conversion. Recommended, and required for ENHANCEMENT. - or gclid + conversionTime — the click ID and the original conversion's time (unix seconds). Not available for ENHANCEMENT. destinationId is the conversion action resource name, e.g. customers/1234567890/conversionActions/987654321 (same value you send to POST /v1/ads/conversions). PII in user is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required yyyy-MM-dd HH:mm:ss+00:00 format. Up to 2000 adjustments per request; partial failure is supported (inspect adjustmentsFailed / failures[]).

Parameters:

Returns:



107
108
109
110
# File 'lib/zernio-sdk/api/ads_api.rb', line 107

def adjust_conversions(adjust_conversions_request, opts = {})
  data, _status_code, _headers = adjust_conversions_with_http_info(adjust_conversions_request, opts)
  data
end

#adjust_conversions_with_http_info(adjust_conversions_request, opts = {}) ⇒ Array<(AdjustConversions200Response, Integer, Hash)>

Adjust uploaded conversions Adjust conversions that were previously uploaded via `POST /v1/ads/conversions` — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. Google Ads only. Google handles adjustments through the classic Google Ads API (`ConversionAdjustmentUploadService`); the Data Manager `ingestEvents` path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns `405` for those platforms. Adjustment types: - `RETRACTION` — remove the conversion entirely (refund, chargeback, cancelled order, churn). - `RESTATEMENT` — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected total value in `restatementValue` (not a delta). - `ENHANCEMENT` — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - `orderId` — the transaction ID you sent as `eventId` on the original conversion. Recommended, and required for `ENHANCEMENT`. - or `gclid` + `conversionTime` — the click ID and the original conversion's time (unix seconds). Not available for `ENHANCEMENT`. `destinationId` is the conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` (same value you send to `POST /v1/ads/conversions`). PII in `user` is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required `yyyy-MM-dd HH:mm:ss+00:00` format. Up to 2000 adjustments per request; partial failure is supported (inspect `adjustmentsFailed` / `failures`).

Parameters:

Returns:



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
162
163
164
165
166
167
168
# File 'lib/zernio-sdk/api/ads_api.rb', line 117

def adjust_conversions_with_http_info(adjust_conversions_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.adjust_conversions ...'
  end
  # verify the required parameter 'adjust_conversions_request' is set
  if @api_client.config.client_side_validation && adjust_conversions_request.nil?
    fail ArgumentError, "Missing the required parameter 'adjust_conversions_request' when calling AdsApi.adjust_conversions"
  end
  # resource path
  local_var_path = '/v1/ads/conversions/adjustments'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(adjust_conversions_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AdjustConversions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.adjust_conversions",
    :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: AdsApi#adjust_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#archive_lead_form(form_id, account_id, opts = {}) ⇒ ArchiveLeadForm200Response

Archive a lead form Meta has no hard delete for forms; this archives the form (status=ARCHIVED).

Parameters:

  • form_id (String)
  • account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



176
177
178
179
# File 'lib/zernio-sdk/api/ads_api.rb', line 176

def archive_lead_form(form_id, , opts = {})
  data, _status_code, _headers = archive_lead_form_with_http_info(form_id, , opts)
  data
end

#archive_lead_form_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(ArchiveLeadForm200Response, Integer, Hash)>

Archive a lead form Meta has no hard delete for forms; this archives the form (status=ARCHIVED).

Parameters:

  • form_id (String)
  • account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    ArchiveLeadForm200Response data, response status code and response headers



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
237
238
# File 'lib/zernio-sdk/api/ads_api.rb', line 187

def archive_lead_form_with_http_info(form_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.archive_lead_form ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.archive_lead_form"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.archive_lead_form"
  end
  # resource path
  local_var_path = '/v1/ads/lead-forms/{formId}'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ArchiveLeadForm200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.archive_lead_form",
    :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: AdsApi#archive_lead_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#boost_post(boost_post_request, opts = {}) ⇒ UpdateAd200Response

Boost post as ad Creates a paid ad campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).

Parameters:

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

    the optional parameters

Returns:



245
246
247
248
# File 'lib/zernio-sdk/api/ads_api.rb', line 245

def boost_post(boost_post_request, opts = {})
  data, _status_code, _headers = boost_post_with_http_info(boost_post_request, opts)
  data
end

#boost_post_with_http_info(boost_post_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>

Boost post as ad Creates a paid ad campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).

Parameters:

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

    the optional parameters

Returns:

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

    UpdateAd200Response data, response status code and response headers



255
256
257
258
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 255

def boost_post_with_http_info(boost_post_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.boost_post ...'
  end
  # verify the required parameter 'boost_post_request' is set
  if @api_client.config.client_side_validation && boost_post_request.nil?
    fail ArgumentError, "Missing the required parameter 'boost_post_request' when calling AdsApi.boost_post"
  end
  # resource path
  local_var_path = '/v1/ads/boost'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(boost_post_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAd200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.boost_post",
    :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: AdsApi#boost_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cancel_rf_reservation(prediction_id, account_id, ad_account_id, opts = {}) ⇒ nil

Cancel a Reach & Frequency reservation (Meta) Releases a RESERVATION's locked price and inventory. Unreserved predictions expire on their own.

Parameters:

  • prediction_id (String)
  • account_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


315
316
317
318
# File 'lib/zernio-sdk/api/ads_api.rb', line 315

def cancel_rf_reservation(prediction_id, , , opts = {})
  cancel_rf_reservation_with_http_info(prediction_id, , , opts)
  nil
end

#cancel_rf_reservation_with_http_info(prediction_id, account_id, ad_account_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Cancel a Reach & Frequency reservation (Meta) Releases a RESERVATION's locked price and inventory. Unreserved predictions expire on their own.

Parameters:

  • prediction_id (String)
  • account_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



327
328
329
330
331
332
333
334
335
336
337
338
339
340
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 327

def cancel_rf_reservation_with_http_info(prediction_id, , , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.cancel_rf_reservation ...'
  end
  # verify the required parameter 'prediction_id' is set
  if @api_client.config.client_side_validation && prediction_id.nil?
    fail ArgumentError, "Missing the required parameter 'prediction_id' when calling AdsApi.cancel_rf_reservation"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.cancel_rf_reservation"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.cancel_rf_reservation"
  end
  # resource path
  local_var_path = '/v1/ads/rf-predictions/{predictionId}'.sub('{' + 'predictionId' + '}', CGI.escape(prediction_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # 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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.cancel_rf_reservation",
    :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: AdsApi#cancel_rf_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_ad_insights_report(create_ad_insights_report_request, opts = {}) ⇒ CreateAdInsightsReport202Response

Submit an async insights report run (Meta) Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a reportRunId to poll via GET /v1/ads/insights/reports/reportRunId. Meta only.

Parameters:

Returns:



390
391
392
393
# File 'lib/zernio-sdk/api/ads_api.rb', line 390

def create_ad_insights_report(create_ad_insights_report_request, opts = {})
  data, _status_code, _headers = create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts)
  data
end

#create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts = {}) ⇒ Array<(CreateAdInsightsReport202Response, Integer, Hash)>

Submit an async insights report run (Meta) Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a `reportRunId` to poll via GET /v1/ads/insights/reports/reportRunId. Meta only.

Parameters:

Returns:



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/zernio-sdk/api/ads_api.rb', line 400

def create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_ad_insights_report ...'
  end
  # verify the required parameter 'create_ad_insights_report_request' is set
  if @api_client.config.client_side_validation && create_ad_insights_report_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_ad_insights_report_request' when calling AdsApi.create_ad_insights_report"
  end
  # resource path
  local_var_path = '/v1/ads/insights/reports'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_ad_insights_report_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateAdInsightsReport202Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_ad_insights_report",
    :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: AdsApi#create_ad_insights_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_call_ad(create_call_ad_request, opts = {}) ⇒ nil

Create Click-to-Call ad Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing phoneNumber via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


458
459
460
461
# File 'lib/zernio-sdk/api/ads_api.rb', line 458

def create_call_ad(create_call_ad_request, opts = {})
  create_call_ad_with_http_info(create_call_ad_request, opts)
  nil
end

#create_call_ad_with_http_info(create_call_ad_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create Click-to-Call ad Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
514
515
516
517
518
519
# File 'lib/zernio-sdk/api/ads_api.rb', line 468

def create_call_ad_with_http_info(create_call_ad_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_call_ad ...'
  end
  # verify the required parameter 'create_call_ad_request' is set
  if @api_client.config.client_side_validation && create_call_ad_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_call_ad_request' when calling AdsApi.create_call_ad"
  end
  # resource path
  local_var_path = '/v1/ads/call'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_call_ad_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_call_ad",
    :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: AdsApi#create_call_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_conversion_destination(account_id, create_conversion_destination_request, opts = {}) ⇒ CreateConversionDestination201Response

Create a conversion destination Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta manages destinations in its own UI and returns 405. LinkedIn: creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. Google Ads: calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed IDEMPOTENCY_CONFLICT (409) rather than silently returning the mismatched action. LinkedIn: the rule is created with conversionMethod=CONVERSIONS_API and (by default) auto-associated with all of the ad account's campaigns via autoAssociationType=ALL_CAMPAIGNS. Pass autoAssociationType: NONE to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for SUBMIT_APPLICATION, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, and LEAD rule types; the API rejects other combinations locally. Google Ads: the conversion action is created with type=UPLOAD_CLICKS (required for API-uploaded offline conversions, immutable after creation). The type field carries the Google ConversionActionCategory enum value, e.g. PURCHASE, SUBSCRIBE_PAID, SIGNUP, IMPORTED_LEAD, BOOK_APPOINTMENT. Unified standard event names (e.g. Purchase, Subscribe, CompleteRegistration, Lead, Schedule) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass primaryForGoal: true to opt in.

Parameters:

  • account_id (String)

    SocialAccount ID (linkedinads or googleads).

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

    the optional parameters

Returns:



527
528
529
530
# File 'lib/zernio-sdk/api/ads_api.rb', line 527

def create_conversion_destination(, create_conversion_destination_request, opts = {})
  data, _status_code, _headers = create_conversion_destination_with_http_info(, create_conversion_destination_request, opts)
  data
end

#create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts = {}) ⇒ Array<(CreateConversionDestination201Response, Integer, Hash)>

Create a conversion destination Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta manages destinations in its own UI and returns 405. LinkedIn: creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. Google Ads: calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed `IDEMPOTENCY_CONFLICT` (409) rather than silently returning the mismatched action. LinkedIn: the rule is created with `conversionMethod=CONVERSIONS_API` and (by default) auto-associated with all of the ad account's campaigns via `autoAssociationType=ALL_CAMPAIGNS`. Pass `autoAssociationType: NONE` to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for `SUBMIT_APPLICATION`, `PURCHASE`, `ADD_TO_CART`, `QUALIFIED_LEAD`, and `LEAD` rule types; the API rejects other combinations locally. Google Ads: the conversion action is created with `type=UPLOAD_CLICKS` (required for API-uploaded offline conversions, immutable after creation). The `type` field carries the Google `ConversionActionCategory` enum value, e.g. `PURCHASE`, `SUBSCRIBE_PAID`, `SIGNUP`, `IMPORTED_LEAD`, `BOOK_APPOINTMENT`. Unified standard event names (e.g. `Purchase`, `Subscribe`, `CompleteRegistration`, `Lead`, `Schedule`) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass `primaryForGoal: true` to opt in.

Parameters:

  • account_id (String)

    SocialAccount ID (linkedinads or googleads).

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

    the optional parameters

Returns:



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
590
591
592
593
# File 'lib/zernio-sdk/api/ads_api.rb', line 538

def create_conversion_destination_with_http_info(, create_conversion_destination_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.create_conversion_destination"
  end
  # verify the required parameter 'create_conversion_destination_request' is set
  if @api_client.config.client_side_validation && create_conversion_destination_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_conversion_destination_request' when calling AdsApi.create_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_conversion_destination_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateConversionDestination201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_conversion_destination",
    :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: AdsApi#create_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_ctwa_ad(ctwa_ad_request_body, opts = {}) ⇒ CreateCtwaAd201Response

Create Click-to-WhatsApp ad (deprecated) Deprecated: use POST /v1/ads/messaging with destination: whatsapp. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - Single-creative: supply top-level headline, body, and one of imageUrl / video. Creates 1 campaign + 1 ad set + 1 ad. - Multi-creative: supply a creatives[] array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.

Parameters:

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

    the optional parameters

Returns:



600
601
602
603
# File 'lib/zernio-sdk/api/ads_api.rb', line 600

def create_ctwa_ad(ctwa_ad_request_body, opts = {})
  data, _status_code, _headers = create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts)
  data
end

#create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {}) ⇒ Array<(CreateCtwaAd201Response, Integer, Hash)>

Create Click-to-WhatsApp ad (deprecated) Deprecated: use POST /v1/ads/messaging with `destination: whatsapp`. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - Single-creative: supply top-level `headline`, `body`, and one of `imageUrl` / `video`. Creates 1 campaign + 1 ad set + 1 ad. - Multi-creative: supply a `creatives` array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.

Parameters:

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

    the optional parameters

Returns:

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

    CreateCtwaAd201Response data, response status code and response headers



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
660
661
# File 'lib/zernio-sdk/api/ads_api.rb', line 610

def create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_ctwa_ad ...'
  end
  # verify the required parameter 'ctwa_ad_request_body' is set
  if @api_client.config.client_side_validation && ctwa_ad_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'ctwa_ad_request_body' when calling AdsApi.create_ctwa_ad"
  end
  # resource path
  local_var_path = '/v1/ads/ctwa'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(ctwa_ad_request_body)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateCtwaAd201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_ctwa_ad",
    :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: AdsApi#create_ctwa_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_lead_form(create_lead_form_request, opts = {}) ⇒ CreateLeadForm200Response

Create a lead form Creates a Lead Gen form on the connected Facebook Page (POST /page-id/leadgen_forms). NOT idempotent — a retry creates a second form. Prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. Requires the Ads add-on.

Parameters:

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

    the optional parameters

Returns:



668
669
670
671
# File 'lib/zernio-sdk/api/ads_api.rb', line 668

def create_lead_form(create_lead_form_request, opts = {})
  data, _status_code, _headers = create_lead_form_with_http_info(create_lead_form_request, opts)
  data
end

#create_lead_form_with_http_info(create_lead_form_request, opts = {}) ⇒ Array<(CreateLeadForm200Response, Integer, Hash)>

Create a lead form Creates a Lead Gen form on the connected Facebook Page (POST /page-id/leadgen_forms). NOT idempotent — a retry creates a second form. Prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. Requires the Ads add-on.

Parameters:

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

    the optional parameters

Returns:

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

    CreateLeadForm200Response data, response status code and response headers



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
725
726
727
728
729
# File 'lib/zernio-sdk/api/ads_api.rb', line 678

def create_lead_form_with_http_info(create_lead_form_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_lead_form ...'
  end
  # verify the required parameter 'create_lead_form_request' is set
  if @api_client.config.client_side_validation && create_lead_form_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_lead_form_request' when calling AdsApi.create_lead_form"
  end
  # resource path
  local_var_path = '/v1/ads/lead-forms'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_lead_form_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateLeadForm200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_lead_form",
    :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: AdsApi#create_lead_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_messaging_ad(create_messaging_ad_request, opts = {}) ⇒ nil

Create click-to-message ad (WhatsApp / Messenger / Instagram Direct) Creates a click-to-message ad; destination selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to destination: whatsapp).

Parameters:

Returns:

  • (nil)


736
737
738
739
# File 'lib/zernio-sdk/api/ads_api.rb', line 736

def create_messaging_ad(create_messaging_ad_request, opts = {})
  create_messaging_ad_with_http_info(create_messaging_ad_request, opts)
  nil
end

#create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create click-to-message ad (WhatsApp / Messenger / Instagram Direct) Creates a click-to-message ad; `destination` selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to `destination: whatsapp`).

Parameters:

Returns:

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

    nil, response status code and response headers



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
# File 'lib/zernio-sdk/api/ads_api.rb', line 746

def create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_messaging_ad ...'
  end
  # verify the required parameter 'create_messaging_ad_request' is set
  if @api_client.config.client_side_validation && create_messaging_ad_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_messaging_ad_request' when calling AdsApi.create_messaging_ad"
  end
  # resource path
  local_var_path = '/v1/ads/messaging'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_messaging_ad_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_messaging_ad",
    :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: AdsApi#create_messaging_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_rf_prediction(create_rf_prediction_request, opts = {}) ⇒ CreateRfPrediction201Response

Create a Reach & Frequency prediction (Meta) Creates an R&F prediction — a QUOTE, nothing is bought and no ad entities are created. Provide a date range plus exactly one of budgetAmount (Meta predicts reach) or reach (Meta predicts the budget). The response carries the estimate and its allowed bounds (min/max budget and reach). Predictions expire on their own; to buy, reserve one via POST /v1/ads/rf-predictions/predictionId/reserve and pass the RESERVED id to POST /v1/ads/create with buyingType: \"RESERVED\". Reservation campaigns reject automatic placements, so omitted placements default to Facebook feed (+ Instagram stream when a linked IG professional account resolves); Instagram placements require that IG account. Meta only.

Parameters:

Returns:



804
805
806
807
# File 'lib/zernio-sdk/api/ads_api.rb', line 804

def create_rf_prediction(create_rf_prediction_request, opts = {})
  data, _status_code, _headers = create_rf_prediction_with_http_info(create_rf_prediction_request, opts)
  data
end

#create_rf_prediction_with_http_info(create_rf_prediction_request, opts = {}) ⇒ Array<(CreateRfPrediction201Response, Integer, Hash)>

Create a Reach & Frequency prediction (Meta) Creates an R&F prediction — a QUOTE, nothing is bought and no ad entities are created. Provide a date range plus exactly one of `budgetAmount` (Meta predicts reach) or `reach` (Meta predicts the budget). The response carries the estimate and its allowed bounds (min/max budget and reach). Predictions expire on their own; to buy, reserve one via POST /v1/ads/rf-predictions/predictionId/reserve and pass the RESERVED id to POST /v1/ads/create with `buyingType: &quot;RESERVED&quot;`. Reservation campaigns reject automatic placements, so omitted `placements` default to Facebook feed (+ Instagram stream when a linked IG professional account resolves); Instagram placements require that IG account. Meta only.

Parameters:

Returns:



814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 814

def create_rf_prediction_with_http_info(create_rf_prediction_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_rf_prediction ...'
  end
  # verify the required parameter 'create_rf_prediction_request' is set
  if @api_client.config.client_side_validation && create_rf_prediction_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_rf_prediction_request' when calling AdsApi.create_rf_prediction"
  end
  # resource path
  local_var_path = '/v1/ads/rf-predictions'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_rf_prediction_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateRfPrediction201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_rf_prediction",
    :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: AdsApi#create_rf_prediction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ CreateStandaloneAd201Response

Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, and LinkedIn. Supports three mutually-exclusive request shapes selected by the body, a legacy single-creative shape (all platforms, default), a Meta-only multi-creative shape via the creatives array (one ad set with N ads sharing budget and targeting), and a Meta-only attach shape via adSetId (adds one new ad to an existing ad set). Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content "dark post" authored by a Company Page (see organizationId); supported goals are engagement, traffic, awareness, and video_views (video ads use the video field; video_views requires a video), and traffic ads require linkUrl. Idempotency: this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an Idempotency-Key header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with Idempotent-Replayed: true) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.

Parameters:

Options Hash (opts):

  • :idempotency_key (String)

    Optional client-generated unique key (e.g. a UUID) that makes create retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.

Returns:



873
874
875
876
# File 'lib/zernio-sdk/api/ads_api.rb', line 873

def create_standalone_ad(create_standalone_ad_request, opts = {})
  data, _status_code, _headers = create_standalone_ad_with_http_info(create_standalone_ad_request, opts)
  data
end

#create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) ⇒ Array<(CreateStandaloneAd201Response, Integer, Hash)>

Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, and LinkedIn. Supports three mutually-exclusive request shapes selected by the body, a legacy single-creative shape (all platforms, default), a Meta-only multi-creative shape via the creatives array (one ad set with N ads sharing budget and targeting), and a Meta-only attach shape via adSetId (adds one new ad to an existing ad set). Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content &quot;dark post&quot; authored by a Company Page (see `organizationId`); supported goals are engagement, traffic, awareness, and video_views (video ads use the `video` field; video_views requires a video), and traffic ads require `linkUrl`. Idempotency: this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an `Idempotency-Key` header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.

Parameters:

Options Hash (opts):

  • :idempotency_key (String)

    Optional client-generated unique key (e.g. a UUID) that makes create retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.

Returns:



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
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
# File 'lib/zernio-sdk/api/ads_api.rb', line 884

def create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_standalone_ad ...'
  end
  # verify the required parameter 'create_standalone_ad_request' is set
  if @api_client.config.client_side_validation && create_standalone_ad_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_standalone_ad_request' when calling AdsApi.create_standalone_ad"
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdsApi.create_standalone_ad, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/v1/ads/create'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'CreateStandaloneAd201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_standalone_ad",
    :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: AdsApi#create_standalone_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_test_lead(form_id, create_test_lead_request, opts = {}) ⇒ CreateTestLead200Response

Create a test lead Submits a test lead against the form (POST /form-id/test_leads) to exercise retrieval without waiting for real ad impressions. Meta allows one test lead per form at a time.

Parameters:

  • form_id (String)
  • create_test_lead_request (CreateTestLeadRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



948
949
950
951
# File 'lib/zernio-sdk/api/ads_api.rb', line 948

def create_test_lead(form_id, create_test_lead_request, opts = {})
  data, _status_code, _headers = create_test_lead_with_http_info(form_id, create_test_lead_request, opts)
  data
end

#create_test_lead_with_http_info(form_id, create_test_lead_request, opts = {}) ⇒ Array<(CreateTestLead200Response, Integer, Hash)>

Create a test lead Submits a test lead against the form (POST /form-id/test_leads) to exercise retrieval without waiting for real ad impressions. Meta allows one test lead per form at a time.

Parameters:

  • form_id (String)
  • create_test_lead_request (CreateTestLeadRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    CreateTestLead200Response data, response status code and response headers



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
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
# File 'lib/zernio-sdk/api/ads_api.rb', line 959

def create_test_lead_with_http_info(form_id, create_test_lead_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.create_test_lead ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.create_test_lead"
  end
  # verify the required parameter 'create_test_lead_request' is set
  if @api_client.config.client_side_validation && create_test_lead_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_test_lead_request' when calling AdsApi.create_test_lead"
  end
  # resource path
  local_var_path = '/v1/ads/lead-forms/{formId}/test-leads'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(create_test_lead_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateTestLead200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.create_test_lead",
    :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: AdsApi#create_test_lead\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_ad(ad_id, opts = {}) ⇒ DeleteAccountGroup200Response

Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.

Parameters:

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

    the optional parameters

Returns:



1021
1022
1023
1024
# File 'lib/zernio-sdk/api/ads_api.rb', line 1021

def delete_ad(ad_id, opts = {})
  data, _status_code, _headers = delete_ad_with_http_info(ad_id, opts)
  data
end

#delete_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(DeleteAccountGroup200Response, Integer, Hash)>

Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.

Parameters:

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

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/ads_api.rb', line 1031

def delete_ad_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.delete_ad ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.delete_ad"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteAccountGroup200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.delete_ad",
    :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: AdsApi#delete_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_conversion_destination(account_id, destination_id, opts = {}) ⇒ nil

Delete a conversion destination LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls "delete" is the same enabled: false flip we apply here. The rule remains fetchable via GET with status: 'inactive'; the unified discovery endpoint hides it by default. adAccountId may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.

Parameters:

  • account_id (String)
  • destination_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Required as query OR in JSON body.

Returns:

  • (nil)


1086
1087
1088
1089
# File 'lib/zernio-sdk/api/ads_api.rb', line 1086

def delete_conversion_destination(, destination_id, opts = {})
  delete_conversion_destination_with_http_info(, destination_id, opts)
  nil
end

#delete_conversion_destination_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a conversion destination LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls &quot;delete&quot; is the same `enabled: false` flip we apply here. The rule remains fetchable via GET with `status: 'inactive'`; the unified discovery endpoint hides it by default. `adAccountId` may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.

Parameters:

  • account_id (String)
  • destination_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Required as query OR in JSON body.

Returns:

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

    nil, response status code and response headers



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
# File 'lib/zernio-sdk/api/ads_api.rb', line 1098

def delete_conversion_destination_with_http_info(, destination_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.delete_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.delete_conversion_destination"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.delete_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # 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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.delete_conversion_destination",
    :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: AdsApi#delete_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#estimate_ad_reach(estimate_ad_reach_request, opts = {}) ⇒ EstimateAdReach200Response

Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta delivery_estimate, LinkedIn audienceCounts, X audience_summary, Pinterest audience_sizing). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return available: false with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.

Parameters:

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

    the optional parameters

Returns:



1156
1157
1158
1159
# File 'lib/zernio-sdk/api/ads_api.rb', line 1156

def estimate_ad_reach(estimate_ad_reach_request, opts = {})
  data, _status_code, _headers = estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts)
  data
end

#estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) ⇒ Array<(EstimateAdReach200Response, Integer, Hash)>

Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta `delivery_estimate`, LinkedIn `audienceCounts`, X `audience_summary`, Pinterest `audience_sizing`). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return `available: false` with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.

Parameters:

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

    the optional parameters

Returns:

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

    EstimateAdReach200Response data, response status code and response headers



1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 1166

def estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.estimate_ad_reach ...'
  end
  # verify the required parameter 'estimate_ad_reach_request' is set
  if @api_client.config.client_side_validation && estimate_ad_reach_request.nil?
    fail ArgumentError, "Missing the required parameter 'estimate_ad_reach_request' when calling AdsApi.estimate_ad_reach"
  end
  # resource path
  local_var_path = '/v1/ads/targeting/reach-estimate'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(estimate_ad_reach_request)

  # return_type
  return_type = opts[:debug_return_type] || 'EstimateAdReach200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.estimate_ad_reach",
    :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: AdsApi#estimate_ad_reach\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_ad_previews(generate_ad_previews_request, opts = {}) ⇒ GenerateAdPreviews200Response

Render pre-create ad previews (Meta) Renders how a creative would look per placement BEFORE any ad exists, via Meta's /generatepreviews. Provide exactly one creative source: existingCreativeId or creativeSpec. Each preview is an HTML <iframe> snippet embeddable directly. Unknown formats values return Meta's 400 verbatim. Meta only.

Parameters:

Returns:



1224
1225
1226
1227
# File 'lib/zernio-sdk/api/ads_api.rb', line 1224

def generate_ad_previews(generate_ad_previews_request, opts = {})
  data, _status_code, _headers = generate_ad_previews_with_http_info(generate_ad_previews_request, opts)
  data
end

#generate_ad_previews_with_http_info(generate_ad_previews_request, opts = {}) ⇒ Array<(GenerateAdPreviews200Response, Integer, Hash)>

Render pre-create ad previews (Meta) Renders how a creative would look per placement BEFORE any ad exists, via Meta's `/generatepreviews`. Provide exactly one creative source: `existingCreativeId` or `creativeSpec`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim. Meta only.

Parameters:

Returns:



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
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
# File 'lib/zernio-sdk/api/ads_api.rb', line 1234

def generate_ad_previews_with_http_info(generate_ad_previews_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.generate_ad_previews ...'
  end
  # verify the required parameter 'generate_ad_previews_request' is set
  if @api_client.config.client_side_validation && generate_ad_previews_request.nil?
    fail ArgumentError, "Missing the required parameter 'generate_ad_previews_request' when calling AdsApi.generate_ad_previews"
  end
  # resource path
  local_var_path = '/v1/ads/preview'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(generate_ad_previews_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GenerateAdPreviews200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.generate_ad_previews",
    :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: AdsApi#generate_ad_previews\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad(ad_id, opts = {}) ⇒ GetAd200Response

Get ad details Returns an ad with its creative, targeting, status, and performance metrics. The {adId} path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal _id (24-char hex) - Meta's numeric platformAdId (the value shipped in comment.received webhooks as comment.ad.id) - the creative's effective_object_story_id ({pageId}_{postId} shape, Facebook side) - the creative's effective_instagram_media_id (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.

Parameters:

  • ad_id (String)

    Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs. See description for details.

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

    the optional parameters

Returns:



1292
1293
1294
1295
# File 'lib/zernio-sdk/api/ads_api.rb', line 1292

def get_ad(ad_id, opts = {})
  data, _status_code, _headers = get_ad_with_http_info(ad_id, opts)
  data
end

#get_ad_account_finance(account_id, ad_account_id, opts = {}) ⇒ GetAdAccountFinance200Response

Ad account finances (Meta) Finances of one Meta ad account: prepaid balance, lifetime amountSpent, account spendCap (null = no cap) and the fundingSource. Money values are converted from Meta's minor units to whole units of currency. Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

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

    the optional parameters

Returns:



1356
1357
1358
1359
# File 'lib/zernio-sdk/api/ads_api.rb', line 1356

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

#get_ad_account_finance_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(GetAdAccountFinance200Response, Integer, Hash)>

Ad account finances (Meta) Finances of one Meta ad account: prepaid `balance`, lifetime `amountSpent`, account `spendCap` (null = no cap) and the `fundingSource`. Money values are converted from Meta's minor units to whole units of `currency`. Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

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

    the optional parameters

Returns:



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
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
# File 'lib/zernio-sdk/api/ads_api.rb', line 1367

def (, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_account_finance ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_ad_account_finance"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_ad_account_finance"
  end
  # resource path
  local_var_path = '/v1/ads/accounts/finance'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdAccountFinance200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad_account_finance",
    :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: AdsApi#get_ad_account_finance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_analytics(ad_id, opts = {}) ⇒ GetAdAnalytics200Response

Get ad analytics Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :from_date (Date)

    Start of date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

  • :breakdowns (String)

    Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region. TikTok: gender, age, country_code, platform, ac, language. LinkedIn (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.

Returns:



1429
1430
1431
1432
# File 'lib/zernio-sdk/api/ads_api.rb', line 1429

def get_ad_analytics(ad_id, opts = {})
  data, _status_code, _headers = get_ad_analytics_with_http_info(ad_id, opts)
  data
end

#get_ad_analytics_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdAnalytics200Response, Integer, Hash)>

Get ad analytics Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :from_date (Date)

    Start of date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

  • :breakdowns (String)

    Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region. TikTok: gender, age, country_code, platform, ac, language. LinkedIn (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.

Returns:

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

    GetAdAnalytics200Response data, response status code and response headers



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
1487
1488
1489
1490
1491
# File 'lib/zernio-sdk/api/ads_api.rb', line 1442

def get_ad_analytics_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_analytics ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad_analytics"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/analytics'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdAnalytics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad_analytics",
    :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: AdsApi#get_ad_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_comments(ad_id, opts = {}) ⇒ GetAdComments200Response

List comments on an ad Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/postId endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the placement query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/postId. The {adId} path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal _id (24-char hex), Meta's numeric platformAdId (the value shipped in comment.received webhooks as comment.ad.id), or the creative's effective_object_story_id / effective_instagram_media_id. Caller doesn't need a translation step.

Parameters:

  • ad_id (String)

    Internal Zernio ad ID (ObjectId).

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

    the optional parameters

Options Hash (opts):

  • :placement (String)

    Which side of the ad to return comments for. Omit to default to the Instagram side when present, else Facebook. Returns ad_not_commentable if the ad has no such placement.

  • :limit (Integer) — default: default to 25
  • :cursor (String)

    Pagination cursor from a previous response.

Returns:



1501
1502
1503
1504
# File 'lib/zernio-sdk/api/ads_api.rb', line 1501

def get_ad_comments(ad_id, opts = {})
  data, _status_code, _headers = get_ad_comments_with_http_info(ad_id, opts)
  data
end

#get_ad_comments_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdComments200Response, Integer, Hash)>

List comments on an ad Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/postId endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the `placement` query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/postId. The `adId` path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal `_id` (24-char hex), Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`), or the creative's `effective_object_story_id` / `effective_instagram_media_id`. Caller doesn't need a translation step.

Parameters:

  • ad_id (String)

    Internal Zernio ad ID (ObjectId).

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

    the optional parameters

Options Hash (opts):

  • :placement (String)

    Which side of the ad to return comments for. Omit to default to the Instagram side when present, else Facebook. Returns ad_not_commentable if the ad has no such placement.

  • :limit (Integer) — default: default to 25
  • :cursor (String)

    Pagination cursor from a previous response.

Returns:

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

    GetAdComments200Response data, response status code and response headers



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
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
# File 'lib/zernio-sdk/api/ads_api.rb', line 1514

def get_ad_comments_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_comments ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad_comments"
  end
  allowable_values = ["facebook", "instagram"]
  if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])
    fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.get_ad_comments, must be smaller than or equal to 100.'
  end

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

  # resource path
  local_var_path = '/v1/ads/{adId}/comments'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'placement'] = opts[:'placement'] if !opts[:'placement'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdComments200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad_comments",
    :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: AdsApi#get_ad_comments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_insights_report(report_run_id, account_id, opts = {}) ⇒ GetAdInsightsReport200Response

Poll an async insights report run (Meta) Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns status and percentCompletion. Once status is "Job Completed" the response also carries a data page, cursor-paginated via limit / after.

Parameters:

  • report_run_id (String)
  • account_id (String)

    Zernio SocialAccount id used to resolve the Meta token (must be the same connection that created the run).

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 25
  • :after (String)

Returns:



1585
1586
1587
1588
# File 'lib/zernio-sdk/api/ads_api.rb', line 1585

def get_ad_insights_report(report_run_id, , opts = {})
  data, _status_code, _headers = get_ad_insights_report_with_http_info(report_run_id, , opts)
  data
end

#get_ad_insights_report_with_http_info(report_run_id, account_id, opts = {}) ⇒ Array<(GetAdInsightsReport200Response, Integer, Hash)>

Poll an async insights report run (Meta) Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns `status` and `percentCompletion`. Once `status` is &quot;Job Completed&quot; the response also carries a `data` page, cursor-paginated via `limit` / `after`.

Parameters:

  • report_run_id (String)
  • account_id (String)

    Zernio SocialAccount id used to resolve the Meta token (must be the same connection that created the run).

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 25
  • :after (String)

Returns:



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
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
# File 'lib/zernio-sdk/api/ads_api.rb', line 1598

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

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

  # resource path
  local_var_path = '/v1/ads/insights/reports/{reportRunId}'.sub('{' + 'reportRunId' + '}', CGI.escape(report_run_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdInsightsReport200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad_insights_report",
    :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: AdsApi#get_ad_insights_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_previews(ad_id, opts = {}) ⇒ GetAdPreviews200Response

Render previews of an existing ad (Meta) Renders an EXISTING ad per placement via Meta's /{ad_id}/previews. Each preview is an HTML <iframe> snippet embeddable directly. Unknown formats values return Meta's 400 verbatim. Meta only.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex).

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

    the optional parameters

Options Hash (opts):

  • :formats (String)

    Comma-separated Meta ad_format values (max 10), one preview per format. Defaults to DESKTOP_FEED_STANDARD.

Returns:



1667
1668
1669
1670
# File 'lib/zernio-sdk/api/ads_api.rb', line 1667

def get_ad_previews(ad_id, opts = {})
  data, _status_code, _headers = get_ad_previews_with_http_info(ad_id, opts)
  data
end

#get_ad_previews_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdPreviews200Response, Integer, Hash)>

Render previews of an existing ad (Meta) Renders an EXISTING ad per placement via Meta's `/ad_id/previews`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim. Meta only.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex).

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

    the optional parameters

Options Hash (opts):

  • :formats (String)

    Comma-separated Meta ad_format values (max 10), one preview per format. Defaults to DESKTOP_FEED_STANDARD.

Returns:

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

    GetAdPreviews200Response data, response status code and response headers



1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
# File 'lib/zernio-sdk/api/ads_api.rb', line 1678

def get_ad_previews_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_previews ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad_previews"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/preview'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'formats'] = opts[:'formats'] if !opts[:'formats'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdPreviews200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad_previews",
    :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: AdsApi#get_ad_previews\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_tracking_tags(ad_id, opts = {}) ⇒ GetAdTrackingTags200Response

Get ad tracking tags Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's url_tags (and template_url_spec). - Google (googleads): the campaign's trackingUrlTemplate + finalUrlSuffix. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM dynamicValueParameters + customValueParameters. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).

Parameters:

  • ad_id (String)

    Ad id (hex _id, platformAdId, or effective story/media id).

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

    the optional parameters

Returns:



1732
1733
1734
1735
# File 'lib/zernio-sdk/api/ads_api.rb', line 1732

def get_ad_tracking_tags(ad_id, opts = {})
  data, _status_code, _headers = get_ad_tracking_tags_with_http_info(ad_id, opts)
  data
end

#get_ad_tracking_tags_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdTrackingTags200Response, Integer, Hash)>

Get ad tracking tags Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).

Parameters:

  • ad_id (String)

    Ad id (hex _id, platformAdId, or effective story/media id).

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

    the optional parameters

Returns:



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
1784
1785
1786
1787
1788
# File 'lib/zernio-sdk/api/ads_api.rb', line 1742

def get_ad_tracking_tags_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_tracking_tags ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad_tracking_tags"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/tracking-tags'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdTrackingTags200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad_tracking_tags",
    :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: AdsApi#get_ad_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAd200Response, Integer, Hash)>

Get ad details Returns an ad with its creative, targeting, status, and performance metrics. The `adId` path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal `_id` (24-char hex) - Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`) - the creative's `effective_object_story_id` (`pageId_postId` shape, Facebook side) - the creative's `effective_instagram_media_id` (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.

Parameters:

  • ad_id (String)

    Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs. See description for details.

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

    the optional parameters

Returns:

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

    GetAd200Response data, response status code and response headers



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
1346
1347
1348
# File 'lib/zernio-sdk/api/ads_api.rb', line 1302

def get_ad_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAd200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ad",
    :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: AdsApi#get_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ads_activity_log(account_id, ad_account_id, opts = {}) ⇒ GetAdsActivityLog200Response

Ad account change / audit log (Meta) Account-level audit log from Meta's /act_X/activities: who changed what and when (creates, edits, status flips, budget changes...) with Meta's translated event names and the structured before/after in extra_data. Rows are returned verbatim. Meta has no server-side per-object filter on this edge, so objectId filters the returned page client-side (combine with paging to walk history for one campaign/ad set/ad). Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

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

    the optional parameters

Options Hash (opts):

  • :since (Date)

    Start of range (YYYY-MM-DD).

  • :_until (Date)

    End of range (YYYY-MM-DD).

  • :object_id (String)

    Client-side filter to one Meta object id (campaign, ad set or ad).

  • :limit (Integer)

    Rows per page (default to 50)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



1801
1802
1803
1804
# File 'lib/zernio-sdk/api/ads_api.rb', line 1801

def get_ads_activity_log(, , opts = {})
  data, _status_code, _headers = get_ads_activity_log_with_http_info(, , opts)
  data
end

#get_ads_activity_log_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(GetAdsActivityLog200Response, Integer, Hash)>

Ad account change / audit log (Meta) Account-level audit log from Meta's `/act_X/activities`: who changed what and when (creates, edits, status flips, budget changes...) with Meta's translated event names and the structured before/after in `extra_data`. Rows are returned verbatim. Meta has no server-side per-object filter on this edge, so `objectId` filters the returned page client-side (combine with paging to walk history for one campaign/ad set/ad). Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

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

    the optional parameters

Options Hash (opts):

  • :since (Date)

    Start of range (YYYY-MM-DD).

  • :_until (Date)

    End of range (YYYY-MM-DD).

  • :object_id (String)

    Client-side filter to one Meta object id (campaign, ad set or ad).

  • :limit (Integer)

    Rows per page (default to 50)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



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
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
# File 'lib/zernio-sdk/api/ads_api.rb', line 1817

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

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

  # resource path
  local_var_path = '/v1/ads/activity'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
  query_params[:'objectId'] = opts[:'object_id'] if !opts[:'object_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdsActivityLog200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_ads_activity_log",
    :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: AdsApi#get_ads_activity_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_campaign_analytics(campaign_id, opts = {}) ⇒ GetCampaignAnalytics200Response

Get campaign analytics Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. campaignId is the platform campaign id; pass platform when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.

Parameters:

  • campaign_id (String)

    Platform campaign id (platformCampaignId).

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

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Disambiguate when the campaign id exists across platforms (e.g. facebook, instagram).

  • :from_date (Date)

    Start of date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

  • :breakdowns (String)

    Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region, platform_position, impression_device, video_asset, image_asset, body_asset, title_asset. LinkedIn (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.

Returns:



1893
1894
1895
1896
# File 'lib/zernio-sdk/api/ads_api.rb', line 1893

def get_campaign_analytics(campaign_id, opts = {})
  data, _status_code, _headers = get_campaign_analytics_with_http_info(campaign_id, opts)
  data
end

#get_campaign_analytics_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignAnalytics200Response, Integer, Hash)>

Get campaign analytics Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. `campaignId` is the platform campaign id; pass `platform` when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.

Parameters:

  • campaign_id (String)

    Platform campaign id (platformCampaignId).

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

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Disambiguate when the campaign id exists across platforms (e.g. facebook, instagram).

  • :from_date (Date)

    Start of date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

  • :breakdowns (String)

    Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region, platform_position, impression_device, video_asset, image_asset, body_asset, title_asset. LinkedIn (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.

Returns:



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
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
# File 'lib/zernio-sdk/api/ads_api.rb', line 1907

def get_campaign_analytics_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_campaign_analytics ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdsApi.get_campaign_analytics"
  end
  # resource path
  local_var_path = '/v1/ads/campaigns/{campaignId}/analytics'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetCampaignAnalytics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_campaign_analytics",
    :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: AdsApi#get_campaign_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_conversion_destination(account_id, destination_id, ad_account_id, opts = {}) ⇒ GetConversionDestination200Response

Get a conversion destination LinkedIn-only today. Returns the full destination record for one conversion rule. The adAccountId query parameter is required because LinkedIn rules are scoped to a sponsored ad account.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)

    Numeric ID or full `urn:li:sponsoredAccount:id` URN.

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

    the optional parameters

Returns:



1966
1967
1968
1969
# File 'lib/zernio-sdk/api/ads_api.rb', line 1966

def get_conversion_destination(, destination_id, , opts = {})
  data, _status_code, _headers = get_conversion_destination_with_http_info(, destination_id, , opts)
  data
end

#get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>

Get a conversion destination LinkedIn-only today. Returns the full destination record for one conversion rule. The `adAccountId` query parameter is required because LinkedIn rules are scoped to a sponsored ad account.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)

    Numeric ID or full `urn:li:sponsoredAccount:id` URN.

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

    the optional parameters

Returns:



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
2028
2029
2030
2031
2032
2033
# File 'lib/zernio-sdk/api/ads_api.rb', line 1978

def get_conversion_destination_with_http_info(, destination_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_conversion_destination"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.get_conversion_destination"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionDestination200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_conversion_destination",
    :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: AdsApi#get_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_conversion_metrics(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ GetConversionMetrics200Response

Get attribution metrics LinkedIn-only today. Returns conversion-attribution metrics (externalWebsiteConversions, externalWebsitePostClickConversions, externalWebsitePostViewConversions, conversionValueInLocalCurrency, qualifiedLeads, costInLocalCurrency) bucketed by date. Date-range constraints (passed through from LinkedIn): - granularity=DAILY is retained for ~6 months only - granularity=ALL with a range > 6 months auto-rounds to month boundaries - granularity=MONTHLY/YEARLY retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • start_date (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :end_date (String)
  • :granularity (String) — default: default to 'DAILY'

Returns:



2045
2046
2047
2048
# File 'lib/zernio-sdk/api/ads_api.rb', line 2045

def get_conversion_metrics(, destination_id, , start_date, opts = {})
  data, _status_code, _headers = get_conversion_metrics_with_http_info(, destination_id, , start_date, opts)
  data
end

#get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ Array<(GetConversionMetrics200Response, Integer, Hash)>

Get attribution metrics LinkedIn-only today. Returns conversion-attribution metrics (`externalWebsiteConversions`, `externalWebsitePostClickConversions`, `externalWebsitePostViewConversions`, `conversionValueInLocalCurrency`, `qualifiedLeads`, `costInLocalCurrency`) bucketed by date. Date-range constraints (passed through from LinkedIn): - `granularity=DAILY` is retained for ~6 months only - `granularity=ALL` with a range > 6 months auto-rounds to month boundaries - `granularity=MONTHLY`/`YEARLY` retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • start_date (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :end_date (String)
  • :granularity (String) — default: default to 'DAILY'

Returns:



2060
2061
2062
2063
2064
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2060

def get_conversion_metrics_with_http_info(, destination_id, , start_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_conversion_metrics ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_conversion_metrics"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.get_conversion_metrics"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_conversion_metrics"
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdsApi.get_conversion_metrics"
  end
  pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/)
  if @api_client.config.client_side_validation && start_date !~ pattern
    fail ArgumentError, "invalid value for 'start_date' when calling AdsApi.get_conversion_metrics, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/)
  if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling AdsApi.get_conversion_metrics, must conform to the pattern #{pattern}."
  end

  allowable_values = ["ALL", "DAILY", "MONTHLY", "YEARLY"]
  if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])
    fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/metrics'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = 
  query_params[:'startDate'] = start_date
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionMetrics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_conversion_metrics",
    :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: AdsApi#get_conversion_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_conversions_quality(account_id, destination_id, opts = {}) ⇒ GetConversionsQuality200Response

Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.

Parameters:

  • account_id (String)

    SocialAccount _id (must be a metaads account).

  • destination_id (String)

    Meta pixel/dataset ID.

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

    the optional parameters

Returns:



2144
2145
2146
2147
# File 'lib/zernio-sdk/api/ads_api.rb', line 2144

def get_conversions_quality(, destination_id, opts = {})
  data, _status_code, _headers = get_conversions_quality_with_http_info(, destination_id, opts)
  data
end

#get_conversions_quality_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(GetConversionsQuality200Response, Integer, Hash)>

Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.

Parameters:

  • account_id (String)

    SocialAccount _id (must be a metaads account).

  • destination_id (String)

    Meta pixel/dataset ID.

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

    the optional parameters

Returns:



2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2155

def get_conversions_quality_with_http_info(, destination_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_conversions_quality ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_conversions_quality"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.get_conversions_quality"
  end
  # resource path
  local_var_path = '/v1/ads/conversions/quality'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'destinationId'] = destination_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionsQuality200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_conversions_quality",
    :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: AdsApi#get_conversions_quality\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_dsa_defaults(account_id, ad_account_id, opts = {}) ⇒ UpdateAdAccount200Response

Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via PATCH /v1/ads/accounts or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



2215
2216
2217
2218
# File 'lib/zernio-sdk/api/ads_api.rb', line 2215

def get_dsa_defaults(, , opts = {})
  data, _status_code, _headers = get_dsa_defaults_with_http_info(, , opts)
  data
end

#get_dsa_defaults_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>

Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via `PATCH /v1/ads/accounts` or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:

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

    UpdateAdAccount200Response data, response status code and response headers



2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
# File 'lib/zernio-sdk/api/ads_api.rb', line 2226

def get_dsa_defaults_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_dsa_defaults ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_dsa_defaults"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_dsa_defaults"
  end
  # resource path
  local_var_path = '/v1/ads/dsa-defaults'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAdAccount200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_dsa_defaults",
    :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: AdsApi#get_dsa_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_dsa_recommendations(account_id, ad_account_id, opts = {}) ⇒ GetDsaRecommendations200Response

List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling dsaBeneficiary/dsaPayor inputs, or the defaults sent to PATCH /v1/ads/accounts, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



2286
2287
2288
2289
# File 'lib/zernio-sdk/api/ads_api.rb', line 2286

def get_dsa_recommendations(, , opts = {})
  data, _status_code, _headers = get_dsa_recommendations_with_http_info(, , opts)
  data
end

#get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(GetDsaRecommendations200Response, Integer, Hash)>

List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling `dsaBeneficiary`/`dsaPayor` inputs, or the defaults sent to `PATCH /v1/ads/accounts`, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



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
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
# File 'lib/zernio-sdk/api/ads_api.rb', line 2297

def get_dsa_recommendations_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_dsa_recommendations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_dsa_recommendations"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_dsa_recommendations"
  end
  # resource path
  local_var_path = '/v1/ads/dsa-recommendations'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetDsaRecommendations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_dsa_recommendations",
    :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: AdsApi#get_dsa_recommendations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_lead_form(form_id, account_id, opts = {}) ⇒ GetLeadForm200Response

Get a lead form

Parameters:

  • form_id (String)
  • account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



2356
2357
2358
2359
# File 'lib/zernio-sdk/api/ads_api.rb', line 2356

def get_lead_form(form_id, , opts = {})
  data, _status_code, _headers = get_lead_form_with_http_info(form_id, , opts)
  data
end

#get_lead_form_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(GetLeadForm200Response, Integer, Hash)>

Get a lead form

Parameters:

  • form_id (String)
  • account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    GetLeadForm200Response data, response status code and response headers



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
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
# File 'lib/zernio-sdk/api/ads_api.rb', line 2366

def get_lead_form_with_http_info(form_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_lead_form ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.get_lead_form"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_lead_form"
  end
  # resource path
  local_var_path = '/v1/ads/lead-forms/{formId}'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetLeadForm200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_lead_form",
    :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: AdsApi#get_lead_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) ⇒ GetLinkedInBidPricing200Response

Suggested bid and budget bounds (LinkedIn) LinkedIn-only. Returns the suggested bid and bid limits for a targeting spec, plus the daily-budget bounds LinkedIn will accept. Use it before creating a campaign to pick a bid inside the allowed range and warn the user if their daily budget is below the minimum. Wraps LinkedIn's adBudgetPricing finder. Non-LinkedIn accounts return available: false so clients can hide the pricing UI without treating it as a failure.

Parameters:

Returns:



2424
2425
2426
2427
# File 'lib/zernio-sdk/api/ads_api.rb', line 2424

def get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {})
  data, _status_code, _headers = get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts)
  data
end

#get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) ⇒ Array<(GetLinkedInBidPricing200Response, Integer, Hash)>

Suggested bid and budget bounds (LinkedIn) LinkedIn-only. Returns the suggested bid and bid limits for a targeting spec, plus the daily-budget bounds LinkedIn will accept. Use it before creating a campaign to pick a bid inside the allowed range and warn the user if their daily budget is below the minimum. Wraps LinkedIn's `adBudgetPricing` finder. Non-LinkedIn accounts return `available: false` so clients can hide the pricing UI without treating it as a failure.

Parameters:

Returns:



2434
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2434

def get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_linked_in_bid_pricing ...'
  end
  # verify the required parameter 'get_linked_in_bid_pricing_request' is set
  if @api_client.config.client_side_validation && get_linked_in_bid_pricing_request.nil?
    fail ArgumentError, "Missing the required parameter 'get_linked_in_bid_pricing_request' when calling AdsApi.get_linked_in_bid_pricing"
  end
  # resource path
  local_var_path = '/v1/ads/targeting/bid-pricing'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(get_linked_in_bid_pricing_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetLinkedInBidPricing200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_linked_in_bid_pricing",
    :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: AdsApi#get_linked_in_bid_pricing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) ⇒ GetLinkedInSupplyForecast200Response

Impressions, clicks and spend forecast (LinkedIn) LinkedIn-only. Forecasted impressions, clicks, spend and ~20 other metrics for a targeting spec over a time range. Wraps LinkedIn's adSupplyForecasts finder. Each returned series carries a metricType (IMPRESSION, CLICK, SPENDING, MAX_POTENTIAL_BUDGET, COST_PER_MILLION_IMPRESSIONS, ...) and a granularity (DAILY, SEVEN_DAY, THIRTY_DAY, CUSTOM). LinkedIn caps the daily spending forecast at 1.2x the daily budget and returns 0 once the total budget is exhausted. Non-LinkedIn accounts return available: false.

Parameters:

Returns:



2492
2493
2494
2495
# File 'lib/zernio-sdk/api/ads_api.rb', line 2492

def get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {})
  data, _status_code, _headers = get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts)
  data
end

#get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) ⇒ Array<(GetLinkedInSupplyForecast200Response, Integer, Hash)>

Impressions, clicks and spend forecast (LinkedIn) LinkedIn-only. Forecasted impressions, clicks, spend and ~20 other metrics for a targeting spec over a time range. Wraps LinkedIn's `adSupplyForecasts` finder. Each returned series carries a `metricType` (IMPRESSION, CLICK, SPENDING, MAX_POTENTIAL_BUDGET, COST_PER_MILLION_IMPRESSIONS, ...) and a `granularity` (DAILY, SEVEN_DAY, THIRTY_DAY, CUSTOM). LinkedIn caps the daily spending forecast at 1.2x the daily budget and returns 0 once the total budget is exhausted. Non-LinkedIn accounts return `available: false`.

Parameters:

Returns:



2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2502

def get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_linked_in_supply_forecast ...'
  end
  # verify the required parameter 'get_linked_in_supply_forecast_request' is set
  if @api_client.config.client_side_validation && get_linked_in_supply_forecast_request.nil?
    fail ArgumentError, "Missing the required parameter 'get_linked_in_supply_forecast_request' when calling AdsApi.get_linked_in_supply_forecast"
  end
  # resource path
  local_var_path = '/v1/ads/targeting/supply-forecast'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(get_linked_in_supply_forecast_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetLinkedInSupplyForecast200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_linked_in_supply_forecast",
    :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: AdsApi#get_linked_in_supply_forecast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_rf_prediction(prediction_id, account_id, ad_account_id, opts = {}) ⇒ CreateRfPrediction201Response

Read a Reach & Frequency prediction (Meta)

Parameters:

  • prediction_id (String)
  • account_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



2561
2562
2563
2564
# File 'lib/zernio-sdk/api/ads_api.rb', line 2561

def get_rf_prediction(prediction_id, , , opts = {})
  data, _status_code, _headers = get_rf_prediction_with_http_info(prediction_id, , , opts)
  data
end

#get_rf_prediction_with_http_info(prediction_id, account_id, ad_account_id, opts = {}) ⇒ Array<(CreateRfPrediction201Response, Integer, Hash)>

Read a Reach & Frequency prediction (Meta)

Parameters:

  • prediction_id (String)
  • account_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2572

def get_rf_prediction_with_http_info(prediction_id, , , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_rf_prediction ...'
  end
  # verify the required parameter 'prediction_id' is set
  if @api_client.config.client_side_validation && prediction_id.nil?
    fail ArgumentError, "Missing the required parameter 'prediction_id' when calling AdsApi.get_rf_prediction"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_rf_prediction"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_rf_prediction"
  end
  # resource path
  local_var_path = '/v1/ads/rf-predictions/{predictionId}'.sub('{' + 'predictionId' + '}', CGI.escape(prediction_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'CreateRfPrediction201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.get_rf_prediction",
    :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: AdsApi#get_rf_prediction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_accounts(account_id, opts = {}) ⇒ ListAdAccounts200Response

List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's /advertiser/info/ endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time advertiser_ids list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.

Parameters:

  • account_id (String)

    Social account ID

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.

  • :limit (Integer)

    Clamp the returned `accounts` length. Useful for typeahead pickers on agency tokens with hundreds of advertisers.

Returns:



2637
2638
2639
2640
# File 'lib/zernio-sdk/api/ads_api.rb', line 2637

def list_ad_accounts(, opts = {})
  data, _status_code, _headers = list_ad_accounts_with_http_info(, opts)
  data
end

#list_ad_accounts_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdAccounts200Response, Integer, Hash)>

List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.

Parameters:

  • account_id (String)

    Social account ID

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.

  • :limit (Integer)

    Clamp the returned `accounts` length. Useful for typeahead pickers on agency tokens with hundreds of advertisers.

Returns:

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

    ListAdAccounts200Response data, response status code and response headers



2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2649

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

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

  # resource path
  local_var_path = '/v1/ads/accounts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdAccounts200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_ad_accounts",
    :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: AdsApi#list_ad_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_catalog_product_sets(catalog_id, account_id, opts = {}) ⇒ ListAdCatalogProductSets200Response

List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as promotedObject.productSetId on POST /v1/ads/create with goal: catalog_sales.

Parameters:

  • catalog_id (String)

    Meta product catalog ID (from GET /v1/ads/catalogs)

  • account_id (String)

    A facebook, instagram, or metaads social account ID

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

    the optional parameters

Returns:



2714
2715
2716
2717
# File 'lib/zernio-sdk/api/ads_api.rb', line 2714

def list_ad_catalog_product_sets(catalog_id, , opts = {})
  data, _status_code, _headers = list_ad_catalog_product_sets_with_http_info(catalog_id, , opts)
  data
end

#list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts = {}) ⇒ Array<(ListAdCatalogProductSets200Response, Integer, Hash)>

List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as `promotedObject.productSetId` on POST /v1/ads/create with `goal: catalog_sales`.

Parameters:

  • catalog_id (String)

    Meta product catalog ID (from GET /v1/ads/catalogs)

  • account_id (String)

    A facebook, instagram, or metaads social account ID

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

    the optional parameters

Returns:



2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
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
# File 'lib/zernio-sdk/api/ads_api.rb', line 2725

def list_ad_catalog_product_sets_with_http_info(catalog_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_catalog_product_sets ...'
  end
  # verify the required parameter 'catalog_id' is set
  if @api_client.config.client_side_validation && catalog_id.nil?
    fail ArgumentError, "Missing the required parameter 'catalog_id' when calling AdsApi.list_ad_catalog_product_sets"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_catalog_product_sets"
  end
  # resource path
  local_var_path = '/v1/ads/catalogs/{catalogId}/product-sets'.sub('{' + 'catalogId' + '}', CGI.escape(catalog_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCatalogProductSets200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_ad_catalog_product_sets",
    :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: AdsApi#list_ad_catalog_product_sets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_catalogs(account_id, ad_account_id, opts = {}) ⇒ ListAdCatalogs200Response

List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (goal: catalog_sales on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.

Parameters:

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



2784
2785
2786
2787
# File 'lib/zernio-sdk/api/ads_api.rb', line 2784

def list_ad_catalogs(, , opts = {})
  data, _status_code, _headers = list_ad_catalogs_with_http_info(, , opts)
  data
end

#list_ad_catalogs_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCatalogs200Response, Integer, Hash)>

List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (`goal: catalog_sales` on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.

Parameters:

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:

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

    ListAdCatalogs200Response data, response status code and response headers



2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
# File 'lib/zernio-sdk/api/ads_api.rb', line 2795

def list_ad_catalogs_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_catalogs ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_catalogs"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_catalogs"
  end
  # resource path
  local_var_path = '/v1/ads/catalogs'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCatalogs200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_ad_catalogs",
    :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: AdsApi#list_ad_catalogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_studies(account_id, ad_account_id, opts = {}) ⇒ ListAdStudies200Response

A/B tests and lift studies (Meta) Lists the ad account's A/B tests and lift studies (Meta's /act_X/ad_studies), rows returned verbatim. The default projection covers id, name, type, timing and cells with split percentages; fields is a raw-passthrough override. Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



2858
2859
2860
2861
# File 'lib/zernio-sdk/api/ads_api.rb', line 2858

def list_ad_studies(, , opts = {})
  data, _status_code, _headers = list_ad_studies_with_http_info(, , opts)
  data
end

#list_ad_studies_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdStudies200Response, Integer, Hash)>

A/B tests and lift studies (Meta) Lists the ad account's A/B tests and lift studies (Meta's `/act_X/ad_studies`), rows returned verbatim. The default projection covers id, name, type, timing and cells with split percentages; `fields` is a raw-passthrough override. Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

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

    ListAdStudies200Response data, response status code and response headers



2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
# File 'lib/zernio-sdk/api/ads_api.rb', line 2872

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

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

  # resource path
  local_var_path = '/v1/ads/studies'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdStudies200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_ad_studies",
    :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: AdsApi#list_ad_studies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ads(opts = {}) ⇒ ListAds200Response

List ads Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) — those are the post/media the ad's engagement lives on, and are also returned on each ad's creative object. Then call GET /v1/ads/adId/comments with the returned ad id.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (1-based) (default to 1)

  • :limit (Integer) — default: default to 50
  • :source (String)

    all (default) = Zernio-created + platform-discovered ads. zernio = restrict to Zernio-created only. (default to 'all')

  • :status (AdStatus)
  • :platform (String)
  • :account_id (String)

    Social account ID

  • :ad_account_id (String)

    Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.

  • :profile_id (String)

    Profile ID

  • :campaign_id (String)

    Platform campaign ID (filter ads within a campaign)

  • :platform_ad_id (String)

    Meta ad ID. Returns the ad with this platform-side ad ID.

  • :effective_object_story_id (String)

    Facebook `pageId_postId` of the post the ad's engagement lives on (Meta `effective_object_story_id`). Use to map a Business-Manager-visible post back to the Zernio ad.

  • :effective_instagram_media_id (String)

    Instagram media ID of the boosted post (Meta `effective_instagram_media_id`). Use to map a Business-Manager-visible IG post back to the Zernio ad.

  • :from_date (Date)

    Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

Returns:



2955
2956
2957
2958
# File 'lib/zernio-sdk/api/ads_api.rb', line 2955

def list_ads(opts = {})
  data, _status_code, _headers = list_ads_with_http_info(opts)
  data
end

#list_ads_business_centers(account_id, opts = {}) ⇒ ListAdsBusinessCenters200Response

List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected tiktokads account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking /v1/ads/accounts per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.

Parameters:

  • account_id (String)

    ID of the `tiktokads` (or parent `tiktok` posting) SocialAccount

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

    the optional parameters

Returns:



3061
3062
3063
3064
# File 'lib/zernio-sdk/api/ads_api.rb', line 3061

def list_ads_business_centers(, opts = {})
  data, _status_code, _headers = list_ads_business_centers_with_http_info(, opts)
  data
end

#list_ads_business_centers_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdsBusinessCenters200Response, Integer, Hash)>

List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected `tiktokads` account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking `/v1/ads/accounts` per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.

Parameters:

  • account_id (String)

    ID of the `tiktokads` (or parent `tiktok` posting) SocialAccount

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

    the optional parameters

Returns:



3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
# File 'lib/zernio-sdk/api/ads_api.rb', line 3071

def list_ads_business_centers_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_ads_business_centers ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ads_business_centers"
  end
  # resource path
  local_var_path = '/v1/ads/business-centers'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdsBusinessCenters200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_ads_business_centers",
    :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: AdsApi#list_ads_business_centers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ads_with_http_info(opts = {}) ⇒ Array<(ListAds200Response, Integer, Hash)>

List ads Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) — those are the post/media the ad's engagement lives on, and are also returned on each ad's `creative` object. Then call GET /v1/ads/adId/comments with the returned ad id.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (1-based) (default to 1)

  • :limit (Integer) — default: default to 50
  • :source (String)

    all (default) = Zernio-created + platform-discovered ads. zernio = restrict to Zernio-created only. (default to 'all')

  • :status (AdStatus)
  • :platform (String)
  • :account_id (String)

    Social account ID

  • :ad_account_id (String)

    Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.

  • :profile_id (String)

    Profile ID

  • :campaign_id (String)

    Platform campaign ID (filter ads within a campaign)

  • :platform_ad_id (String)

    Meta ad ID. Returns the ad with this platform-side ad ID.

  • :effective_object_story_id (String)

    Facebook `pageId_postId` of the post the ad's engagement lives on (Meta `effective_object_story_id`). Use to map a Business-Manager-visible post back to the Zernio ad.

  • :effective_instagram_media_id (String)

    Instagram media ID of the boosted post (Meta `effective_instagram_media_id`). Use to map a Business-Manager-visible IG post back to the Zernio ad.

  • :from_date (Date)

    Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.

Returns:

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

    ListAds200Response data, response status code and response headers



2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
# File 'lib/zernio-sdk/api/ads_api.rb', line 2978

def list_ads_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_ads ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdsApi.list_ads, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ads, must be smaller than or equal to 500.'
  end

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

  allowable_values = ["zernio", "all"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/ads'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
  query_params[:'platformAdId'] = opts[:'platform_ad_id'] if !opts[:'platform_ad_id'].nil?
  query_params[:'effectiveObjectStoryId'] = opts[:'effective_object_story_id'] if !opts[:'effective_object_story_id'].nil?
  query_params[:'effectiveInstagramMediaId'] = opts[:'effective_instagram_media_id'] if !opts[:'effective_instagram_media_id'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAds200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_ads",
    :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: AdsApi#list_ads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_conversion_associations(account_id, destination_id, ad_account_id, opts = {}) ⇒ ListConversionAssociations200Response

List associated campaigns LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



3127
3128
3129
3130
# File 'lib/zernio-sdk/api/ads_api.rb', line 3127

def list_conversion_associations(, destination_id, , opts = {})
  data, _status_code, _headers = list_conversion_associations_with_http_info(, destination_id, , opts)
  data
end

#list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(ListConversionAssociations200Response, Integer, Hash)>

List associated campaigns LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
# File 'lib/zernio-sdk/api/ads_api.rb', line 3139

def list_conversion_associations_with_http_info(, destination_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_conversion_associations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_conversion_associations"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.list_conversion_associations"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_conversion_associations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListConversionAssociations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_conversion_associations",
    :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: AdsApi#list_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_conversion_destinations(account_id, opts = {}) ⇒ ListConversionDestinations200Response

List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account. Use the returned id as destinationId when posting to POST /v1/ads/conversions. For Google and LinkedIn, each destination's type reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta, type is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the adAccountId field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).

Parameters:

  • account_id (String)

    SocialAccount ID (metaads, googleads, linkedinads, or tiktokads).

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

    the optional parameters

Returns:



3201
3202
3203
3204
# File 'lib/zernio-sdk/api/ads_api.rb', line 3201

def list_conversion_destinations(, opts = {})
  data, _status_code, _headers = list_conversion_destinations_with_http_info(, opts)
  data
end

#list_conversion_destinations_with_http_info(account_id, opts = {}) ⇒ Array<(ListConversionDestinations200Response, Integer, Hash)>

List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account. Use the returned `id` as `destinationId` when posting to `POST /v1/ads/conversions`. For Google and LinkedIn, each destination's `type` reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta, `type` is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the `adAccountId` field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).

Parameters:

  • account_id (String)

    SocialAccount ID (metaads, googleads, linkedinads, or tiktokads).

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

    the optional parameters

Returns:



3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
# File 'lib/zernio-sdk/api/ads_api.rb', line 3211

def list_conversion_destinations_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_conversion_destinations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_conversion_destinations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListConversionDestinations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_conversion_destinations",
    :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: AdsApi#list_conversion_destinations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_form_leads(form_id, account_id, opts = {}) ⇒ ListFormLeads200Response

List leads for a single form Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.

Parameters:

  • form_id (String)
  • account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 25
  • :cursor (String)
  • :since (Integer)

    Unix seconds.

Returns:



3268
3269
3270
3271
# File 'lib/zernio-sdk/api/ads_api.rb', line 3268

def list_form_leads(form_id, , opts = {})
  data, _status_code, _headers = list_form_leads_with_http_info(form_id, , opts)
  data
end

#list_form_leads_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(ListFormLeads200Response, Integer, Hash)>

List leads for a single form Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.

Parameters:

  • form_id (String)
  • account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 25
  • :cursor (String)
  • :since (Integer)

    Unix seconds.

Returns:

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

    ListFormLeads200Response data, response status code and response headers



3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
# File 'lib/zernio-sdk/api/ads_api.rb', line 3282

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

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

  # resource path
  local_var_path = '/v1/ads/lead-forms/{formId}/leads'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListFormLeads200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_form_leads",
    :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: AdsApi#list_form_leads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_lead_forms(account_id, opts = {}) ⇒ ListLeadForms200Response

List lead forms Lists the Lead Gen forms owned by the connected Facebook Page. Requires the Ads add-on.

Parameters:

  • account_id (String)

    Connected facebook account id.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 25
  • :cursor (String)

Returns:



3353
3354
3355
3356
# File 'lib/zernio-sdk/api/ads_api.rb', line 3353

def list_lead_forms(, opts = {})
  data, _status_code, _headers = list_lead_forms_with_http_info(, opts)
  data
end

#list_lead_forms_with_http_info(account_id, opts = {}) ⇒ Array<(ListLeadForms200Response, Integer, Hash)>

List lead forms Lists the Lead Gen forms owned by the connected Facebook Page. Requires the Ads add-on.

Parameters:

  • account_id (String)

    Connected facebook account id.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 25
  • :cursor (String)

Returns:

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

    ListLeadForms200Response data, response status code and response headers



3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
# File 'lib/zernio-sdk/api/ads_api.rb', line 3365

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

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

  # resource path
  local_var_path = '/v1/ads/lead-forms'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListLeadForms200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_lead_forms",
    :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: AdsApi#list_lead_forms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_leads(opts = {}) ⇒ ListLeads200Response

List submitted leads Returns persisted Meta Lead Gen leads for your team, newest-first, with keyset pagination on cursor. Leads are ingested in real time from the leadgen webhook. Requires the Ads add-on.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :form_id (String)

    Filter to a single lead form.

  • :account_id (String)

    Filter to a single connected account.

  • :limit (Integer) — default: default to 25
  • :since (Integer)

    Unix seconds; only leads created at/after this Meta timestamp.

  • :cursor (String)

    Keyset cursor from a previous response's pagination.cursor.

Returns:



3433
3434
3435
3436
# File 'lib/zernio-sdk/api/ads_api.rb', line 3433

def list_leads(opts = {})
  data, _status_code, _headers = list_leads_with_http_info(opts)
  data
end

#list_leads_with_http_info(opts = {}) ⇒ Array<(ListLeads200Response, Integer, Hash)>

List submitted leads Returns persisted Meta Lead Gen leads for your team, newest-first, with keyset pagination on `cursor`. Leads are ingested in real time from the `leadgen` webhook. Requires the Ads add-on.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :form_id (String)

    Filter to a single lead form.

  • :account_id (String)

    Filter to a single connected account.

  • :limit (Integer) — default: default to 25
  • :since (Integer)

    Unix seconds; only leads created at/after this Meta timestamp.

  • :cursor (String)

    Keyset cursor from a previous response's pagination.cursor.

Returns:

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

    ListLeads200Response data, response status code and response headers



3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
# File 'lib/zernio-sdk/api/ads_api.rb', line 3447

def list_leads_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_leads ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_leads, must be smaller than or equal to 100.'
  end

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

  # resource path
  local_var_path = '/v1/ads/leads'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'formId'] = opts[:'form_id'] if !opts[:'form_id'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListLeads200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_leads",
    :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: AdsApi#list_leads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_whats_app_conversions(account_id, opts = {}) ⇒ ListWhatsAppConversions200Response

List conversion events Returns the most recent conversion events sent through POST /v1/whatsapp/conversions for the given WhatsApp account. Sourced from delivery logs (Axiom late dataset), so the visible window is bounded by log retention (about 30 days). Useful for rendering a "recent activity" panel on the conversions setup tab without standing up a parallel persistence layer. Per-event payload mirrors the structured log we write on every successful send: eventName, conversationId, eventsReceived, eventsFailed, traceId, durationMs, and the wall-clock timestamp.

Parameters:

  • account_id (String)

    WhatsApp social account ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Max events to return (1-200, default 50). (default to 50)

Returns:



3510
3511
3512
3513
# File 'lib/zernio-sdk/api/ads_api.rb', line 3510

def list_whats_app_conversions(, opts = {})
  data, _status_code, _headers = list_whats_app_conversions_with_http_info(, opts)
  data
end

#list_whats_app_conversions_with_http_info(account_id, opts = {}) ⇒ Array<(ListWhatsAppConversions200Response, Integer, Hash)>

List conversion events Returns the most recent conversion events sent through `POST /v1/whatsapp/conversions` for the given WhatsApp account. Sourced from delivery logs (Axiom `late` dataset), so the visible window is bounded by log retention (about 30 days). Useful for rendering a &quot;recent activity&quot; panel on the conversions setup tab without standing up a parallel persistence layer. Per-event payload mirrors the structured log we write on every successful send: `eventName`, `conversationId`, `eventsReceived`, `eventsFailed`, `traceId`, `durationMs`, and the wall-clock `timestamp`.

Parameters:

  • account_id (String)

    WhatsApp social account ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Max events to return (1-200, default 50). (default to 50)

Returns:



3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
# File 'lib/zernio-sdk/api/ads_api.rb', line 3521

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

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

  # resource path
  local_var_path = '/v1/whatsapp/conversions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListWhatsAppConversions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.list_whats_app_conversions",
    :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: AdsApi#list_whats_app_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_ad_insights(account_id, object_id, opts = {}) ⇒ QueryAdInsights200Response

Flexible live insights query (Meta) Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/adId/analytics (fixed metric set, cached), this forwards caller-chosen fields, breakdowns and filtering to any Meta insights node and returns Meta's rows verbatim. objectId selects the node: an ad account, campaign, ad set or ad platform id. level sets row granularity independently of the node. Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports). Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • object_id (String)

    Meta insights node: act_<n>, campaign id, ad set id or ad id.

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

    the optional parameters

Options Hash (opts):

  • :level (String)

    Row granularity

  • :fields (String)

    Comma-separated Graph insights fields (e.g. spend,impressions,frequency,website_purchase_roas). Omitted = Meta's default set.

  • :breakdowns (String)

    Comma-separated Graph breakdowns (e.g. age,gender or publisher_platform).

  • :action_breakdowns (String)

    Comma-separated Graph action breakdowns. Segments the actions arrays in each row.

  • :action_attribution_windows (String)

    Comma-separated Meta attribution windows. Action values are returned keyed per window.

  • :action_report_time (String)

    When actions are counted: impression, conversion or mixed.

  • :use_unified_attribution_setting (Boolean)

    Use the ad sets' own attribution settings for action counting.

  • :filtering (String)

    JSON array of Meta filter objects: [\"operator\", \"value\"]. Applied server-side by Meta.

  • :date_preset (String)

    Meta date_preset (e.g. last_7d, last_30d, this_month). Mutually exclusive with fromDate/toDate.

  • :from_date (Date)

    Start of range (YYYY-MM-DD); requires toDate.

  • :to_date (Date)

    End of range (YYYY-MM-DD); requires fromDate.

  • :time_increment (String)

    Days per row (1-90), monthly, or all_days.

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



3599
3600
3601
3602
# File 'lib/zernio-sdk/api/ads_api.rb', line 3599

def query_ad_insights(, object_id, opts = {})
  data, _status_code, _headers = query_ad_insights_with_http_info(, object_id, opts)
  data
end

#query_ad_insights_with_http_info(account_id, object_id, opts = {}) ⇒ Array<(QueryAdInsights200Response, Integer, Hash)>

Flexible live insights query (Meta) Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/adId/analytics (fixed metric set, cached), this forwards caller-chosen `fields`, `breakdowns` and `filtering` to any Meta insights node and returns Meta's rows verbatim. `objectId` selects the node: an ad account, campaign, ad set or ad platform id. `level` sets row granularity independently of the node. Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports). Meta only.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • object_id (String)

    Meta insights node: act_<n>, campaign id, ad set id or ad id.

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

    the optional parameters

Options Hash (opts):

  • :level (String)

    Row granularity

  • :fields (String)

    Comma-separated Graph insights fields (e.g. spend,impressions,frequency,website_purchase_roas). Omitted = Meta's default set.

  • :breakdowns (String)

    Comma-separated Graph breakdowns (e.g. age,gender or publisher_platform).

  • :action_breakdowns (String)

    Comma-separated Graph action breakdowns. Segments the actions arrays in each row.

  • :action_attribution_windows (String)

    Comma-separated Meta attribution windows. Action values are returned keyed per window.

  • :action_report_time (String)

    When actions are counted: impression, conversion or mixed.

  • :use_unified_attribution_setting (Boolean)

    Use the ad sets' own attribution settings for action counting.

  • :filtering (String)

    JSON array of Meta filter objects: [\"operator\", \"value\"]. Applied server-side by Meta.

  • :date_preset (String)

    Meta date_preset (e.g. last_7d, last_30d, this_month). Mutually exclusive with fromDate/toDate.

  • :from_date (Date)

    Start of range (YYYY-MM-DD); requires toDate.

  • :to_date (Date)

    End of range (YYYY-MM-DD); requires fromDate.

  • :time_increment (String)

    Days per row (1-90), monthly, or all_days.

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

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

    QueryAdInsights200Response data, response status code and response headers



3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
# File 'lib/zernio-sdk/api/ads_api.rb', line 3624

def query_ad_insights_with_http_info(, object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.query_ad_insights ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.query_ad_insights"
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling AdsApi.query_ad_insights"
  end
  allowable_values = ["ad", "adset", "campaign", "account"]
  if @api_client.config.client_side_validation && opts[:'level'] && !allowable_values.include?(opts[:'level'])
    fail ArgumentError, "invalid value for \"level\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.query_ad_insights, must be smaller than or equal to 500.'
  end

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

  # resource path
  local_var_path = '/v1/ads/insights'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'objectId'] = object_id
  query_params[:'level'] = opts[:'level'] if !opts[:'level'].nil?
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?
  query_params[:'actionBreakdowns'] = opts[:'action_breakdowns'] if !opts[:'action_breakdowns'].nil?
  query_params[:'actionAttributionWindows'] = opts[:'action_attribution_windows'] if !opts[:'action_attribution_windows'].nil?
  query_params[:'actionReportTime'] = opts[:'action_report_time'] if !opts[:'action_report_time'].nil?
  query_params[:'useUnifiedAttributionSetting'] = opts[:'use_unified_attribution_setting'] if !opts[:'use_unified_attribution_setting'].nil?
  query_params[:'filtering'] = opts[:'filtering'] if !opts[:'filtering'].nil?
  query_params[:'datePreset'] = opts[:'date_preset'] if !opts[:'date_preset'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'timeIncrement'] = opts[:'time_increment'] if !opts[:'time_increment'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'QueryAdInsights200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.query_ad_insights",
    :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: AdsApi#query_ad_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_conversion_associations(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ RemoveConversionAssociations200Response

Remove associated campaigns Remove one or more campaign associations from this conversion rule. Pass adAccountId and campaignIds as query parameters (campaignIds is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • campaign_ids (String)

    Comma-separated list of campaign IDs.

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

    the optional parameters

Returns:



3712
3713
3714
3715
# File 'lib/zernio-sdk/api/ads_api.rb', line 3712

def remove_conversion_associations(, destination_id, , campaign_ids, opts = {})
  data, _status_code, _headers = remove_conversion_associations_with_http_info(, destination_id, , campaign_ids, opts)
  data
end

#remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ Array<(RemoveConversionAssociations200Response, Integer, Hash)>

Remove associated campaigns Remove one or more campaign associations from this conversion rule. Pass `adAccountId` and `campaignIds` as query parameters (`campaignIds` is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • campaign_ids (String)

    Comma-separated list of campaign IDs.

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

    the optional parameters

Returns:



3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
# File 'lib/zernio-sdk/api/ads_api.rb', line 3725

def remove_conversion_associations_with_http_info(, destination_id, , campaign_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.remove_conversion_associations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.remove_conversion_associations"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.remove_conversion_associations"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.remove_conversion_associations"
  end
  # verify the required parameter 'campaign_ids' is set
  if @api_client.config.client_side_validation && campaign_ids.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_ids' when calling AdsApi.remove_conversion_associations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = 
  query_params[:'campaignIds'] = campaign_ids

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'RemoveConversionAssociations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.remove_conversion_associations",
    :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: AdsApi#remove_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#reserve_rf_prediction(prediction_id, reserve_rf_prediction_request, opts = {}) ⇒ ReserveRfPrediction201Response

Reserve a Reach & Frequency prediction (Meta) Locks the quoted price + inventory until the returned expiresAt and mints a NEW prediction id — pass that RESERVED id (not the original) as rfPredictionId on POST /v1/ads/create. Release an unused reservation via DELETE. Meta only.

Parameters:

  • prediction_id (String)
  • reserve_rf_prediction_request (ReserveRfPredictionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



3793
3794
3795
3796
# File 'lib/zernio-sdk/api/ads_api.rb', line 3793

def reserve_rf_prediction(prediction_id, reserve_rf_prediction_request, opts = {})
  data, _status_code, _headers = reserve_rf_prediction_with_http_info(prediction_id, reserve_rf_prediction_request, opts)
  data
end

#reserve_rf_prediction_with_http_info(prediction_id, reserve_rf_prediction_request, opts = {}) ⇒ Array<(ReserveRfPrediction201Response, Integer, Hash)>

Reserve a Reach & Frequency prediction (Meta) Locks the quoted price + inventory until the returned `expiresAt` and mints a NEW prediction id — pass that RESERVED id (not the original) as `rfPredictionId` on POST /v1/ads/create. Release an unused reservation via DELETE. Meta only.

Parameters:

  • prediction_id (String)
  • reserve_rf_prediction_request (ReserveRfPredictionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
# File 'lib/zernio-sdk/api/ads_api.rb', line 3804

def reserve_rf_prediction_with_http_info(prediction_id, reserve_rf_prediction_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.reserve_rf_prediction ...'
  end
  # verify the required parameter 'prediction_id' is set
  if @api_client.config.client_side_validation && prediction_id.nil?
    fail ArgumentError, "Missing the required parameter 'prediction_id' when calling AdsApi.reserve_rf_prediction"
  end
  # verify the required parameter 'reserve_rf_prediction_request' is set
  if @api_client.config.client_side_validation && reserve_rf_prediction_request.nil?
    fail ArgumentError, "Missing the required parameter 'reserve_rf_prediction_request' when calling AdsApi.reserve_rf_prediction"
  end
  # resource path
  local_var_path = '/v1/ads/rf-predictions/{predictionId}/reserve'.sub('{' + 'predictionId' + '}', CGI.escape(prediction_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(reserve_rf_prediction_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ReserveRfPrediction201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.reserve_rf_prediction",
    :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: AdsApi#reserve_rf_prediction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_ad_interests(q, account_id, opts = {}) ⇒ SearchAdInterests200Response

Search targeting interests Deprecated alias for GET /v1/ads/targeting/search?dimension=interest. Kept for backward compatibility, it returns the legacy { interests: [...] } shape rather than the normalized { results: [...] }. New integrations should use GET /v1/ads/targeting/search with dimension=interest.

Parameters:

  • q (String)

    Search query

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



3867
3868
3869
3870
# File 'lib/zernio-sdk/api/ads_api.rb', line 3867

def search_ad_interests(q, , opts = {})
  data, _status_code, _headers = search_ad_interests_with_http_info(q, , opts)
  data
end

#search_ad_interests_with_http_info(q, account_id, opts = {}) ⇒ Array<(SearchAdInterests200Response, Integer, Hash)>

Search targeting interests Deprecated alias for `GET /v1/ads/targeting/search?dimension=interest`. Kept for backward compatibility, it returns the legacy `{ interests: [...] }` shape rather than the normalized `{ results: [...] }`. New integrations should use `GET /v1/ads/targeting/search` with `dimension=interest`.

Parameters:

  • q (String)

    Search query

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
# File 'lib/zernio-sdk/api/ads_api.rb', line 3878

def search_ad_interests_with_http_info(q, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.search_ad_interests ...'
  end
  # verify the required parameter 'q' is set
  if @api_client.config.client_side_validation && q.nil?
    fail ArgumentError, "Missing the required parameter 'q' when calling AdsApi.search_ad_interests"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.search_ad_interests"
  end
  # resource path
  local_var_path = '/v1/ads/interests'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'SearchAdInterests200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.search_ad_interests",
    :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: AdsApi#search_ad_interests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_ad_targeting(account_id, q, opts = {}) ⇒ SearchAdTargeting200Response

Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the TargetingSpec (countries/regions/cities/zips/metros geo keys, and interests/behaviors entity ids) on POST /v1/ads/create, POST /v1/ads/targeting/reach-estimate, and saved_targeting audiences. The dimension param selects what is searched, geo (locations, further scoped by geoType), interest, behavior, or income. Availability of each dimension varies by platform (e.g. behaviours are Meta/TikTok only). Results are normalized across platforms into a single shape, so the same client code consumes Meta, TikTok, LinkedIn, X, Pinterest, and Google results. TikTok geo searches return every matching level in one list (type is country, region, city, district, or metro for DMA areas) — geoType is not applied. Results are scoped to the advertiser's targetable markets, and every id is usable in regions/cities/metros keys on POST /v1/ads/create. For geo queries, q should contain only the locality name (e.g. \"Amsterdam\", not \"Amsterdam, NL\"). Use countryCode to disambiguate.

Parameters:

  • account_id (String)

    Social account ID (a connected account on the target ad platform).

  • q (String)

    Search query. For geo, the locality name only (no region/country suffix).

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

    the optional parameters

Options Hash (opts):

  • :dimension (String)

    What to search. `geo` resolves locations (scope further with `geoType`), `interest`/`behavior` resolve audience entities, `income` resolves income-tier options. Defaults to `interest` for backward compatibility with the deprecated /v1/ads/interests alias. (default to 'interest')

  • :geo_type (String)

    Only used when `dimension=geo`. The kind of location to resolve. Defaults to `city`. (default to 'city')

  • :country_code (String)

    ISO 3166-1 alpha-2 country code (e.g. NL) to scope a geo search.

  • :limit (Integer)

    Maximum results to return. (default to 25)

Returns:



3942
3943
3944
3945
# File 'lib/zernio-sdk/api/ads_api.rb', line 3942

def search_ad_targeting(, q, opts = {})
  data, _status_code, _headers = search_ad_targeting_with_http_info(, q, opts)
  data
end

#search_ad_targeting_with_http_info(account_id, q, opts = {}) ⇒ Array<(SearchAdTargeting200Response, Integer, Hash)>

Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the `TargetingSpec` (`countries`/`regions`/`cities`/`zips`/`metros` geo keys, and `interests`/`behaviors` entity ids) on `POST /v1/ads/create`, `POST /v1/ads/targeting/reach-estimate`, and `saved_targeting` audiences. The `dimension` param selects what is searched, `geo` (locations, further scoped by `geoType`), `interest`, `behavior`, or `income`. Availability of each dimension varies by platform (e.g. behaviours are Meta/TikTok only). Results are normalized across platforms into a single shape, so the same client code consumes Meta, TikTok, LinkedIn, X, Pinterest, and Google results. TikTok geo searches return every matching level in one list (`type` is `country`, `region`, `city`, `district`, or `metro` for DMA areas) — `geoType` is not applied. Results are scoped to the advertiser's targetable markets, and every id is usable in `regions`/`cities`/`metros` keys on `POST /v1/ads/create`. For geo queries, `q` should contain only the locality name (e.g. `&quot;Amsterdam&quot;`, not `&quot;Amsterdam, NL&quot;`). Use `countryCode` to disambiguate.

Parameters:

  • account_id (String)

    Social account ID (a connected account on the target ad platform).

  • q (String)

    Search query. For geo, the locality name only (no region/country suffix).

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

    the optional parameters

Options Hash (opts):

  • :dimension (String)

    What to search. `geo` resolves locations (scope further with `geoType`), `interest`/`behavior` resolve audience entities, `income` resolves income-tier options. Defaults to `interest` for backward compatibility with the deprecated /v1/ads/interests alias. (default to 'interest')

  • :geo_type (String)

    Only used when `dimension=geo`. The kind of location to resolve. Defaults to `city`. (default to 'city')

  • :country_code (String)

    ISO 3166-1 alpha-2 country code (e.g. NL) to scope a geo search.

  • :limit (Integer)

    Maximum results to return. (default to 25)

Returns:



3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
# File 'lib/zernio-sdk/api/ads_api.rb', line 3957

def search_ad_targeting_with_http_info(, q, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.search_ad_targeting ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.search_ad_targeting"
  end
  # verify the required parameter 'q' is set
  if @api_client.config.client_side_validation && q.nil?
    fail ArgumentError, "Missing the required parameter 'q' when calling AdsApi.search_ad_targeting"
  end
  allowable_values = ["geo", "interest", "behavior", "income"]
  if @api_client.config.client_side_validation && opts[:'dimension'] && !allowable_values.include?(opts[:'dimension'])
    fail ArgumentError, "invalid value for \"dimension\", must be one of #{allowable_values}"
  end
  allowable_values = ["country", "region", "city", "zip", "metro"]
  if @api_client.config.client_side_validation && opts[:'geo_type'] && !allowable_values.include?(opts[:'geo_type'])
    fail ArgumentError, "invalid value for \"geo_type\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'country_code'].nil? && opts[:'country_code'].to_s.length > 2
    fail ArgumentError, 'invalid value for "opts[:"country_code"]" when calling AdsApi.search_ad_targeting, the character length must be smaller than or equal to 2.'
  end

  if @api_client.config.client_side_validation && !opts[:'country_code'].nil? && opts[:'country_code'].to_s.length < 2
    fail ArgumentError, 'invalid value for "opts[:"country_code"]" when calling AdsApi.search_ad_targeting, the character length must be greater than or equal to 2.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.search_ad_targeting, must be smaller than or equal to 100.'
  end

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

  # resource path
  local_var_path = '/v1/ads/targeting/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'q'] = q
  query_params[:'dimension'] = opts[:'dimension'] if !opts[:'dimension'].nil?
  query_params[:'geoType'] = opts[:'geo_type'] if !opts[:'geo_type'].nil?
  query_params[:'countryCode'] = opts[:'country_code'] if !opts[:'country_code'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'SearchAdTargeting200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.search_ad_targeting",
    :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: AdsApi#search_ad_targeting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_conversions(send_conversions_request, opts = {}) ⇒ SendConversions200Response

Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided accountId. Requires the Ads add-on. Supported platforms: - Meta (metaads) via Graph API - Google Ads (googleads) via Data Manager API ingestEvents - LinkedIn (linkedinads) via /rest/conversionEvents - TikTok (tiktokads) via the Offline Events API /offline/batch/ — OFFLINE conversions only destinationId semantics differ per platform: - Meta: pixel (dataset) ID, e.g. 123456789012345 - Google: conversion action resource name, e.g. customers/1234567890/conversionActions/987654321 - LinkedIn: conversion rule ID or URN, e.g. 104012 or urn:lla:llaPartnerConversion:104012 - TikTok: Offline Event Set ID, e.g. 7057103914977558530 TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. Callers can list valid destinations via GET /v1/accounts/{accountId}/conversion-destinations. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn externalIds are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include rw_conversions). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. Dedup: pass a stable eventId on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to transactionId. Per-platform eventName semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's type (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it.

Parameters:

Returns:



4044
4045
4046
4047
# File 'lib/zernio-sdk/api/ads_api.rb', line 4044

def send_conversions(send_conversions_request, opts = {})
  data, _status_code, _headers = send_conversions_with_http_info(send_conversions_request, opts)
  data
end

#send_conversions_with_http_info(send_conversions_request, opts = {}) ⇒ Array<(SendConversions200Response, Integer, Hash)>

Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided `accountId`. Requires the Ads add-on. Supported platforms: - Meta (`metaads`) via Graph API - Google Ads (`googleads`) via Data Manager API `ingestEvents` - LinkedIn (`linkedinads`) via `/rest/conversionEvents` - TikTok (`tiktokads`) via the Offline Events API `/offline/batch/` — OFFLINE conversions only `destinationId` semantics differ per platform: - Meta: pixel (dataset) ID, e.g. `123456789012345` - Google: conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` - LinkedIn: conversion rule ID or URN, e.g. `104012` or `urn:lla:llaPartnerConversion:104012` - TikTok: Offline Event Set ID, e.g. `7057103914977558530` TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. Callers can list valid destinations via `GET /v1/accounts/accountId/conversion-destinations`. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn `externalIds` are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include `rw_conversions`). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. Dedup: pass a stable `eventId` on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to `transactionId`. Per-platform `eventName` semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's `type` (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it.

Parameters:

Returns:

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

    SendConversions200Response data, response status code and response headers



4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
# File 'lib/zernio-sdk/api/ads_api.rb', line 4054

def send_conversions_with_http_info(send_conversions_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.send_conversions ...'
  end
  # verify the required parameter 'send_conversions_request' is set
  if @api_client.config.client_side_validation && send_conversions_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_conversions_request' when calling AdsApi.send_conversions"
  end
  # resource path
  local_var_path = '/v1/ads/conversions'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(send_conversions_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendConversions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.send_conversions",
    :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: AdsApi#send_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_whats_app_conversion(send_whats_app_conversion_request, opts = {}) ⇒ SendWhatsAppConversion200Response

Send WhatsApp conversion event Forward a WhatsApp Business Messaging conversion event (LeadSubmitted, Purchase, AddToCart, InitiateCheckout, ViewContent) to Meta's Conversions API with action_source = business_messaging and messaging_channel = whatsapp. The endpoint looks up the originating CTWA click ID (ctwa_clid) captured on the first inbound message of the conversation and replays it on every event so Meta can attribute the conversion back to the Click-to-WhatsApp ad that drove the chat. Configuration prerequisite on the WhatsApp account metadata: - metaCapiDatasetId: the Meta dataset ID linked to the WABA. Provision one with POST /v1/whatsapp/dataset. The WABA ID (already set automatically at connect time) is forwarded as user_data.whatsapp_business_account_id, which is the per-channel attribution identifier Meta requires for WhatsApp events. No Facebook Page ID is needed (that field is the Messenger-branch identifier). Identify the conversation by either conversationId (preferred) or phoneE164 (digits only, no +). At least one is required. If the conversation has no captured ctwa_clid, the request returns 422 because there is nothing to attribute. Token and dataset coupling: the WhatsApp account's accessToken must have access to the configured metaCapiDatasetId. By default a WABA's system-user token is scoped to the WABA's own Business Manager and cannot post to a pixel owned by a different Business; Meta returns code 100 in that case. Either share the dataset with the WhatsApp app's Business in BM, or use a dataset already in the same Business as the WABA.

Parameters:

Returns:



4112
4113
4114
4115
# File 'lib/zernio-sdk/api/ads_api.rb', line 4112

def send_whats_app_conversion(send_whats_app_conversion_request, opts = {})
  data, _status_code, _headers = send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts)
  data
end

#send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts = {}) ⇒ Array<(SendWhatsAppConversion200Response, Integer, Hash)>

Send WhatsApp conversion event Forward a WhatsApp Business Messaging conversion event (`LeadSubmitted`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`) to Meta's Conversions API with `action_source = business_messaging` and `messaging_channel = whatsapp`. The endpoint looks up the originating CTWA click ID (`ctwa_clid`) captured on the first inbound message of the conversation and replays it on every event so Meta can attribute the conversion back to the Click-to-WhatsApp ad that drove the chat. Configuration prerequisite on the WhatsApp account metadata: - `metaCapiDatasetId`: the Meta dataset ID linked to the WABA. Provision one with `POST /v1/whatsapp/dataset`. The WABA ID (already set automatically at connect time) is forwarded as `user_data.whatsapp_business_account_id`, which is the per-channel attribution identifier Meta requires for WhatsApp events. No Facebook Page ID is needed (that field is the Messenger-branch identifier). Identify the conversation by either `conversationId` (preferred) or `phoneE164` (digits only, no `+`). At least one is required. If the conversation has no captured `ctwa_clid`, the request returns 422 because there is nothing to attribute. Token and dataset coupling: the WhatsApp account's accessToken must have access to the configured `metaCapiDatasetId`. By default a WABA's system-user token is scoped to the WABA's own Business Manager and cannot post to a pixel owned by a different Business; Meta returns code 100 in that case. Either share the dataset with the WhatsApp app's Business in BM, or use a dataset already in the same Business as the WABA.

Parameters:

Returns:



4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
# File 'lib/zernio-sdk/api/ads_api.rb', line 4122

def send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.send_whats_app_conversion ...'
  end
  # verify the required parameter 'send_whats_app_conversion_request' is set
  if @api_client.config.client_side_validation && send_whats_app_conversion_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_whats_app_conversion_request' when calling AdsApi.send_whats_app_conversion"
  end
  # resource path
  local_var_path = '/v1/whatsapp/conversions'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(send_whats_app_conversion_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendWhatsAppConversion200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.send_whats_app_conversion",
    :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: AdsApi#send_whats_app_conversion\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad(ad_id, update_ad_request, opts = {}) ⇒ UpdateAd200Response

Update ad Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform. Per-platform support: - Meta (Facebook + Instagram): all fields supported. - TikTok: status, budget, targeting (via /v2/adgroup/update/), and creative (via /v2/ad/update/ patch-style — headline is ignored, body becomes ad_text). - Pinterest / X / LinkedIn / Google: status + budget only. Sending targeting or creative returns 501 with code unsupported_platform_operation.

Parameters:

  • ad_id (String)
  • update_ad_request (UpdateAdRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



4181
4182
4183
4184
# File 'lib/zernio-sdk/api/ads_api.rb', line 4181

def update_ad(ad_id, update_ad_request, opts = {})
  data, _status_code, _headers = update_ad_with_http_info(ad_id, update_ad_request, opts)
  data
end

#update_ad_account(update_ad_account_request, opts = {}) ⇒ UpdateAdAccount200Response

Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to /v1/ads/create, /v1/ads/boost and /v1/ads/ctwa on that ad account can omit dsaBeneficiary/dsaPayor: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use GET /v1/ads/dsa-recommendations to offer suggestions in your UI. If defaultDsaPayor is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with GET /v1/ads/dsa-defaults. Currently supported for Meta accounts only; other platforms return 400.

Parameters:

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

    the optional parameters

Returns:



4254
4255
4256
4257
# File 'lib/zernio-sdk/api/ads_api.rb', line 4254

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

#update_ad_account_with_http_info(update_ad_account_request, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>

Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to `/v1/ads/create`, `/v1/ads/boost` and `/v1/ads/ctwa` on that ad account can omit `dsaBeneficiary`/`dsaPayor`: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use `GET /v1/ads/dsa-recommendations` to offer suggestions in your UI. If `defaultDsaPayor` is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with `GET /v1/ads/dsa-defaults`. Currently supported for Meta accounts only; other platforms return 400.

Parameters:

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

    the optional parameters

Returns:

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

    UpdateAdAccount200Response data, response status code and response headers



4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
# File 'lib/zernio-sdk/api/ads_api.rb', line 4264

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.update_ad_account ...'
  end
  # verify the required parameter 'update_ad_account_request' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_account_request' when calling AdsApi.update_ad_account"
  end
  # resource path
  local_var_path = '/v1/ads/accounts'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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()

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAdAccount200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.update_ad_account",
    :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: AdsApi#update_ad_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_status(ad_id, update_ad_status_request, opts = {}) ⇒ UpdateAdStatus200Response

Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the status field of PUT /v1/ads/adId, for callers that want a URL symmetric to /v1/ads/campaigns/campaignId/status and /v1/ads/ad-sets/adSetId/status. {adId} accepts the same identifier dialects as GET/PUT /v1/ads/adId (Zernio hex _id, Meta numeric platformAdId, or the creative's effective story/media IDs). platform is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.

Parameters:

  • ad_id (String)

    Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs.

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

    the optional parameters

Returns:



4323
4324
4325
4326
# File 'lib/zernio-sdk/api/ads_api.rb', line 4323

def update_ad_status(ad_id, update_ad_status_request, opts = {})
  data, _status_code, _headers = update_ad_status_with_http_info(ad_id, update_ad_status_request, opts)
  data
end

#update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) ⇒ Array<(UpdateAdStatus200Response, Integer, Hash)>

Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the `status` field of PUT /v1/ads/adId, for callers that want a URL symmetric to /v1/ads/campaigns/campaignId/status and /v1/ads/ad-sets/adSetId/status. `adId` accepts the same identifier dialects as GET/PUT /v1/ads/adId (Zernio hex `_id`, Meta numeric `platformAdId`, or the creative's effective story/media IDs). `platform` is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.

Parameters:

  • ad_id (String)

    Zernio `_id` (hex), Meta `platformAdId` (numeric), or one of the creative's effective story/media IDs.

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

    the optional parameters

Returns:

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

    UpdateAdStatus200Response data, response status code and response headers



4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
# File 'lib/zernio-sdk/api/ads_api.rb', line 4334

def update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.update_ad_status ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.update_ad_status"
  end
  # verify the required parameter 'update_ad_status_request' is set
  if @api_client.config.client_side_validation && update_ad_status_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_status_request' when calling AdsApi.update_ad_status"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/status'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(update_ad_status_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAdStatus200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.update_ad_status",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdsApi#update_ad_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ nil

Set ad tracking tags Unified update. Send only the fields for the ad's platform: - Meta: urlTags (array of key,value). Meta creatives are immutable, so this rebuilds the creative and repoints the ad. By DEFAULT we PRESERVE the existing creative verbatim (re-post its object_story_spec + the new url_tags, reusing the image), so you send urlTags ALONE — no need to read back headline/body/CTA. creative (headline, body, callToAction, linkUrl, imageUrl) is OPTIONAL and only needed to rebuild explicitly, or for SHARE / page-post / dark / asset_feed creatives whose object_story_spec Meta strips (those return 422 asking for creative). - Google: trackingUrlTemplate and/or finalUrlSuffix (full template strings; account quota applies). - LinkedIn: dynamicValueParameters and/or customValueParameters (campaign-level Dynamic UTM).

Parameters:

  • ad_id (String)
  • update_ad_tracking_tags_request (UpdateAdTrackingTagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


4397
4398
4399
4400
# File 'lib/zernio-sdk/api/ads_api.rb', line 4397

def update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {})
  update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts)
  nil
end

#update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Set ad tracking tags Unified update. Send only the fields for the ad's platform: - Meta: `urlTags` (array of key,value). Meta creatives are immutable, so this rebuilds the creative and repoints the ad. By DEFAULT we PRESERVE the existing creative verbatim (re-post its object_story_spec + the new url_tags, reusing the image), so you send `urlTags` ALONE — no need to read back headline/body/CTA. `creative` (headline, body, callToAction, linkUrl, imageUrl) is OPTIONAL and only needed to rebuild explicitly, or for SHARE / page-post / dark / asset_feed creatives whose object_story_spec Meta strips (those return 422 asking for `creative`). - Google: `trackingUrlTemplate` and/or `finalUrlSuffix` (full template strings; account quota applies). - LinkedIn: `dynamicValueParameters` and/or `customValueParameters` (campaign-level Dynamic UTM).

Parameters:

  • ad_id (String)
  • update_ad_tracking_tags_request (UpdateAdTrackingTagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
# File 'lib/zernio-sdk/api/ads_api.rb', line 4408

def update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.update_ad_tracking_tags ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.update_ad_tracking_tags"
  end
  # verify the required parameter 'update_ad_tracking_tags_request' is set
  if @api_client.config.client_side_validation && update_ad_tracking_tags_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_tracking_tags_request' when calling AdsApi.update_ad_tracking_tags"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/tracking-tags'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(update_ad_tracking_tags_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.update_ad_tracking_tags",
    :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: AdsApi#update_ad_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_with_http_info(ad_id, update_ad_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>

Update ad Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform. Per-platform support: - Meta (Facebook + Instagram): all fields supported. - TikTok: status, budget, targeting (via `/v2/adgroup/update/`), and creative (via `/v2/ad/update/` patch-style — `headline` is ignored, `body` becomes `ad_text`). - Pinterest / X / LinkedIn / Google: status + budget only. Sending `targeting` or `creative` returns 501 with code `unsupported_platform_operation`.

Parameters:

  • ad_id (String)
  • update_ad_request (UpdateAdRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    UpdateAd200Response data, response status code and response headers



4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
# File 'lib/zernio-sdk/api/ads_api.rb', line 4192

def update_ad_with_http_info(ad_id, update_ad_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.update_ad ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.update_ad"
  end
  # verify the required parameter 'update_ad_request' is set
  if @api_client.config.client_side_validation && update_ad_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_request' when calling AdsApi.update_ad"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(update_ad_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAd200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.update_ad",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdsApi#update_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_conversion_destination(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ GetConversionDestination200Response

Update a conversion destination Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: name, enabled, attribution windows, valueType, value, attributionType. The rule's type and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.

Parameters:

  • account_id (String)
  • destination_id (String)
  • update_conversion_destination_request (UpdateConversionDestinationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



4472
4473
4474
4475
# File 'lib/zernio-sdk/api/ads_api.rb', line 4472

def update_conversion_destination(, destination_id, update_conversion_destination_request, opts = {})
  data, _status_code, _headers = update_conversion_destination_with_http_info(, destination_id, update_conversion_destination_request, opts)
  data
end

#update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>

Update a conversion destination Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: `name`, `enabled`, attribution windows, `valueType`, `value`, `attributionType`. The rule's `type` and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.

Parameters:

  • account_id (String)
  • destination_id (String)
  • update_conversion_destination_request (UpdateConversionDestinationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
# File 'lib/zernio-sdk/api/ads_api.rb', line 4484

def update_conversion_destination_with_http_info(, destination_id, update_conversion_destination_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.update_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.update_conversion_destination"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.update_conversion_destination"
  end
  # verify the required parameter 'update_conversion_destination_request' is set
  if @api_client.config.client_side_validation && update_conversion_destination_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_conversion_destination_request' when calling AdsApi.update_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(update_conversion_destination_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionDestination200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.update_conversion_destination",
    :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: AdsApi#update_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_ad_image(upload_ad_image_request, opts = {}) ⇒ UploadAdImage201Response

Upload an ad image from base64 (Meta) Uploads raw image bytes to the Meta ad account's image library — for callers whose creatives aren't hosted at a public URL. Returns the image hash (Meta's identifier for the asset) and the Meta-hosted url, which can be used directly as imageUrl on the create endpoints. Max 30 MB decoded. Meta only.

Parameters:

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

    the optional parameters

Returns:



4550
4551
4552
4553
# File 'lib/zernio-sdk/api/ads_api.rb', line 4550

def upload_ad_image(upload_ad_image_request, opts = {})
  data, _status_code, _headers = upload_ad_image_with_http_info(upload_ad_image_request, opts)
  data
end

#upload_ad_image_with_http_info(upload_ad_image_request, opts = {}) ⇒ Array<(UploadAdImage201Response, Integer, Hash)>

Upload an ad image from base64 (Meta) Uploads raw image bytes to the Meta ad account's image library — for callers whose creatives aren't hosted at a public URL. Returns the image `hash` (Meta's identifier for the asset) and the Meta-hosted `url`, which can be used directly as `imageUrl` on the create endpoints. Max 30 MB decoded. Meta only.

Parameters:

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

    the optional parameters

Returns:

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

    UploadAdImage201Response data, response status code and response headers



4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
# File 'lib/zernio-sdk/api/ads_api.rb', line 4560

def upload_ad_image_with_http_info(upload_ad_image_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.upload_ad_image ...'
  end
  # verify the required parameter 'upload_ad_image_request' is set
  if @api_client.config.client_side_validation && upload_ad_image_request.nil?
    fail ArgumentError, "Missing the required parameter 'upload_ad_image_request' when calling AdsApi.upload_ad_image"
  end
  # resource path
  local_var_path = '/v1/ads/images'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(upload_ad_image_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UploadAdImage201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdsApi.upload_ad_image",
    :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: AdsApi#upload_ad_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end