Facebook Ads API Configuration
Request
POST https://api.fivetran.com/v1/connections
{
"group_id": "group_id",
"service": "facebook_ads",
"trust_certificates": true,
"trust_fingerprints": true,
"run_setup_tests": true,
"paused": false,
"pause_after_trial": false,
"sync_frequency": 1440,
"data_delay_sensitivity": "NORMAL",
"data_delay_threshold": 0,
"daily_sync_time": "14:00",
"schedule_type": "auto",
"connect_card_config": {
"redirect_uri": "https://your.site/path",
"hide_setup_guide": true
},
"proxy_agent_id": "proxy_agent_id",
"private_link_id": "private_link_id",
"networking_method": "Directly",
"hybrid_deployment_agent_id": "hybrid_deployment_agent_id",
"config": {
"custom_tables": [
{
"prebuilt_report_name": "string",
"use_unified_attribution_setting": true,
"view_attribution_window": "DAY_1 | DAY_1_EV | DAY_7 | NONE | DAY_28",
"level": "ad | adset | campaign | none | account",
"breakdowns": [
"country | skan_campaign_id | gender | hourly_stats_aggregated_by_advertiser_time_zone | skan_conversion_id | link_url_asset | title_asset | action_converted_product_id | fidelity_type | mmm | call_to_action_asset | image_asset | product_id | hsid | app_id | impression_device | user_segment_key | body_asset | frequency_value | place_page_id | video_asset | redownload | hourly_stats_aggregated_by_audience_time_zone | ad_format_asset | platform_position | postback_sequence_index | dma | device_platform | placement | publisher_platform | region | is_conversion_id_modeled | coarse_conversion_value | age | description_asset"
],
"click_attribution_window": "DAY_1 | DAY_1_EV | DAY_7 | NONE | DAY_28",
"aggregation": "Month | Lifetime | Day | Week",
"table_name": "table_1",
"action_report_time": "impression | mixed | conversion",
"engaged_view_attribution_window": "DAY_1 | DAY_1_EV | DAY_7 | NONE | DAY_28",
"action_breakdowns": [
"action_canvas_component_name | action_carousel_card_id | action_video_sound | action_link_click_destination | action_type | action_video_type | action_carousel_card_name | action_target_id | action_destination | action_device | action_reaction"
],
"config_type": "Prebuilt | Custom",
"fields": [
"cost_per_estimated_ad_recallers | optimization_goal | video_thruplay_watched_actions | reach | click_to_app_store | cost_per_unique_action_type | total_actions | website_clicks | place_page_name | social_impressions | buying_type | objective | video_30_sec_watched_actions | canvas_component_avg_pct_view | cost_per_thruplay | instant_experience_outbound_clicks | unique_clicks | unique_outbound_clicks | total_unique_actions | video_p75_watched_actions | cost_per_unique_inline_link_click | canvas_avg_view_time | social_clicks | inline_link_click_ctr | newsfeed_avg_position | ctr | instagram_upcoming_event_reminders_set | deeplink_clicks | video_avg_time_watched_actions | unique_impressions | video_play_retention_20_to_60s_actions | ad_click_actions | labels | cost_per_ad_click | newsfeed_impressions | unique_link_clicks_ctr | video_p95_watched_actions | ad_id | full_view_reach | catalog_segment_value | cost_per_unique_outbound_click | inline_post_engagement | auction_competitiveness | actions | catalog_segment_value_omni_purchase_roas | video_continuous_2_sec_watched_actions | unique_outbound_clicks_ctr | conversions | video_10_sec_watched_actions | estimated_ad_recall_rate | attribution_setting | video_play_retention_0_to_15s_actions | cost_per_action_type | dda_countby_convs | outbound_clicks_ctr | unique_inline_link_click_ctr | catalog_segment_actions | cost_per_15_sec_video_view | social_reach | account_name | video_time_watched_actions | wish_bid | unique_inline_link_clicks | video_p100_watched_actions | cost_per_conversion | video_p50_watched_actions | outbound_clicks | cost_per_one_thousand_ad_impression | app_store_clicks | interactive_component_tap | converted_product_quantity | unique_social_clicks | qualifying_question_qualify_answer_rate | ad_name | impressions | full_view_impressions | cost_per_10_sec_video_view | account_id | website_purchase_roas | instant_experience_clicks_to_open | adset_name | social_spend | video_play_curve_actions | frequency | action_values | call_to_action_clicks | cpc | cost_per_dda_countby_convs | campaign_id | cpm | created_time | cpp | conversion_rate_ranking | click_to_app_deeplink | cost_per_inline_link_click | video_play_retention_graph_actions | date_start | conversion_values | adset_id | purchase_roas | estimated_ad_recallers | cost_per_unique_click | account_currency | inline_link_clicks | video_15_sec_watched_actions | website_ctr | auction_max_competitor_bid | converted_product_value | auction_bid | catalog_segment_value_website_purchase_roas | campaign_name | cost_per_inline_post_engagement | unique_actions | click_to_website | video_avg_percent_watched_actions | spend | date_stop | video_play_actions | catalog_segment_value_mobile_purchase_roas | video_p25_watched_actions | cost_per_outbound_click | canvas_avg_view_percent | quality_ranking | total_action_value | unique_ctr | user_segment_key | cost_per_total_action | instant_experience_clicks_to_start | cost_per_2_sec_continuous_video_view | relevance_score | newsfeed_clicks | clicks | engagement_rate_ranking | location | gender_targeting | mobile_app_purchase_roas | ad_impression_actions"
]
}
],
"sync_mode": "AllAccounts | SpecificAccounts",
"sync_metadata": true,
"timeframe_months": "TWENTY_FOUR | SIX | ALL_TIME | TWELVE | THREE",
"accounts": [
"string"
],
"schema": "schema_name"
},
"auth": {
"access_token": "my_access_token",
"client_access": {
"client_secret": "my_client_secret",
"client_id": "my_client_id"
},
"user_access_token": "string"
}
}
Config parameters
Name | Description |
---|---|
custom_tables | List of custom tables. Each custom table corresponds to a table within the schema to which connector will sync the data. |
custom_tables[0].prebuilt_report_name | The report name to which connector will sync the data. Possible prebuilt_report values. |
custom_tables[0].use_unified_attribution_setting | |
custom_tables[0].view_attribution_window | Time period to attribute conversions based on views. Possible view_attribution_window values. |
custom_tables[0].level | |
custom_tables[0].breakdowns | List of breakdowns which connector will sync. Possible breakdowns values. |
custom_tables[0].click_attribution_window | Time period to attribute conversions based on clicks. Possible click_attribution_window values. |
custom_tables[0].aggregation | Options to select aggregation duration. Possible aggregation values. |
custom_tables[0].table_name | The table name within the schema to which the connector will sync the data. It must be unique within the connector and must comply with Fivetran's naming conventions. |
custom_tables[0].action_report_time | The report time of action stats. Possible action_report time values. |
custom_tables[0].engaged_view_attribution_window | Time period to attribute conversions based on engaged views. Possible view_attribution_window values. |
custom_tables[0].action_breakdowns | List of action_breakdowns which connector will sync. Possible action_breakdowns values. |
custom_tables[0].config_type | Option to select Prebuilt Reports or Custom Reports. Possible config_type values. |
custom_tables[0].fields | List of fields which connector will sync. Possible field values. |
sync_mode | Option to select connector should sync all accounts or specific accounts. Possible sync_mode values. |
sync_metadata | Parameter defining whether to enable or disable metadata synchronisation. Default value: TRUE . |
timeframe_months | Number of months' worth of reporting data you'd like to include in your initial sync. This cannot be modified once the connector is created. Default value: THREE . |
accounts | List of accounts of which connector will sync the data. |
schema | Destination schema name. Schema name is permanent and cannot be changed after connection creation |
Authorization
There are two ways to authorize this connector type:
By specifying the values for the
client_access
andaccess_token
parameters in theauth
section.POST https://api.fivetran.com/v1/connections
{ "service": "facebook_ads", "group_id": "group_id", "auth": { "client_access": { "client_secret": "my_client_secret", "client_id": "my_client_id" }, "access_token": "my_access_token" } }
Auth Parameters
Name Description access_token
The long-lived Access token
along with theclient_id
andclient_secret
parameters carry the information necessary to query the Facebook Ads APIclient_access
Your application client access fields.`` client_access.client_secret
Client Secret
of your Facebook client application.client_access.client_id
Client ID
of your Facebook client application.By using the Connect Card or the Fivetran dashboard.