### Example response for template document Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/instant-experiences Example JSON response showing the document name and ID for the 'Get New Customers' template. ```json { "document": { "name": "Get New Customers", "id": "397246414010297" }, "id": "133471657203838" } ``` -------------------------------- ### Example response for template element types Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/instant-experiences Example JSON response showing the body_elements array with element types (PHOTO, RICH_TEXT, BUTTON, CAROUSEL) for the 'Get New Customers' template. ```json { "body_elements": [ { "name": "Cover Image or Video", "element_type": "PHOTO", "id": "397271930674412" }, { "name": "Text", "element_type": "RICH_TEXT", "id": "397271920674413" }, { "name": "Text", "element_type": "RICH_TEXT", "id": "397271910674414" }, { "name": "Button", "element_type": "BUTTON", "id": "397271914007747" }, { "name": "Carousel", "element_type": "CAROUSEL", "id": "397271940674411" }, { "name": "Text", "element_type": "RICH_TEXT", "id": "397271917341080" }, { "name": "Button", "element_type": "BUTTON", "id": "397271924007746" } ], "id": "397246414010297" } ``` -------------------------------- ### Response to GET subscribed_apps Request Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/lead-ads/quickstart/webhooks-integration Sample response listing installed apps. If no apps are installed, the API returns an empty data set. ```json { "data": [ { "category": "Business", "link": "https://my-clever-domain-name.com/app", "name": "My Sample App", "id": "{page-id}" } ] } ``` -------------------------------- ### Read Ad Creative: iOS SDK get asset_feed_spec Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-creative.md iOS SDK example to read an ad creative's asset_feed_spec field using FBSDKGraphRequest with HTTPMethod GET. Starts a request with a completion handler. ```objectivec NSDictionary *params = @{ @"fields": @"asset_feed_spec", }; /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"//" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create basic Instant Experience Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/collection-ads Creates a basic Instant Experience by specifying body element IDs (photo/video, product set, footer) and publishing it. Requires the element IDs and page access token. ```bash curl -X POST \ -F 'body_element_ids=[ , , ]' \ -F 'is_published=true' \ -F 'access_token=' \ https://graph.facebook.com/v27.0//canvases ``` -------------------------------- ### Preview request with creative_feature parameter Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/advantage-creative/get-started Adds the creative_feature parameter to an existing preview request to preview an Advantage+ creative feature. Supported features include image_templates, image_touchups, video_auto_crop, enhance_cta, text_optimizations, image_background_gen, image_uncrop, description_automation, translate_voiceover, image_animation, video_filtering, and video_uncrop. Replace , , and with actual values. ```bash curl -X GET -G \ -d 'ad_format="DESKTOP_FEED_STANDARD"' \ -d 'creative_feature= \ -d 'access_token=' \ https://graph.facebook.com/v27.0//previews ``` -------------------------------- ### iOS SDK - Get Business Adspixels Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/adspixels.md iOS SDK example to read the business adspixels. Uses FBSDKGraphRequest with initWithGraphPath and HTTPMethod GET. Starts with a completion handler. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/adspixels" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Example response with recommendation Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-catalog-ads/preview-product-showcase-default.md Example response when Meta has a recommendation. recommendation_status is SUCCESS and the recommended object contains a catalog and one or two product sets. The IDs and names are illustrative. Read recommendation_status first. ```json { "recommendation_status": "SUCCESS", "recommended": { "catalog": { "id": "", "name": "Example Brand Catalog" }, "product_sets": [ { "id": "", "name": "Summer Collection", "recommended_action": "DEFAULT_ON", "strategy_type": "COLLECTION", "description": "Products featured, recommended, or sourced from your destination URL.", "rank": 1 }, { "id": "", "name": "All Products", "recommended_action": "NEEDS_CONFIRMATION", "strategy_type": "ALL_PRODUCTS", "description": "All eligible products in the recommended catalog.", "rank": 2 } ] } } ``` -------------------------------- ### iOS SDK: Get initiated audience sharing requests Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/initiated_audience_sharing_requests.md iOS SDK example using FBSDKGraphRequest to make a GET request. Starts the request with a completion handler. ```objectivec /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/initiated_audience_sharing_requests" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create Instant Experience product set (canvas_product_set) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/collection-ads Creates a canvas_product_set with show_in_feed set to true, required for a collection ad. Includes optional fields like image_overlay_spec, storefront_setting, and retailer_item_ids. ```bash curl -X POST \ -F 'canvas_product_set={ "max_items": 50, "product_set_id": "", "item_headline": "{{product.name}}", "item_description": "{{product.current_price}}" "image_overlay_spec": { "overlay_template": "pill_with_text", "text_type": "price", "text_font": "dynads_hybrid_bold", "position": "top_left", "theme_color": "background_e50900_text_ffffff", "float_with_margin": true, }, "storefront_setting": { "enable_sections": true, "customized_section_titles": [ { "title_id": "popular", "customized_title": "My Populars" }, { "title_id": "favorites", "customized_title": "My Favorites" }], "product_set_layout": { "layout_type": "GRID_3COL" } }, "retailer_item_ids": [0, 0, 0], "show_in_feed": true }' \ https://graph.facebook.com/v27.0//canvas_elements ``` -------------------------------- ### GET /{business-id}/ads_reporting_exports - iOS SDK Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/ads_reporting_exports.md iOS SDK example using FBSDKGraphRequest with HTTPMethod GET. Starts the request with a completion handler that handles the result. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/ads_reporting_exports" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### iOS SDK: Get Ad Images Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-account/adimages.md iOS SDK example to read Ad Images using FBSDKGraphRequest with HTTPMethod GET. Starts the request with a completion handler. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{ad-account-id}/adimages" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create ad with custom video (Advantage+ creative for catalog) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-creative-for-catalog.md Creates an ad using a custom video with FORMAT_AUTOMATION and ad formats CAROUSEL and COLLECTION. Requires adset_id, product_set_id, page_id, video_id, pixel_id, and access token. ```bash curl \ -F 'name=Advantage+ creative for catalog test - custom video' \ -F 'adset_id=' \ -F 'creative={ "name": "Creative For Advantage+ creative for catalog test - custom video", "product_set_id": "", "object_type": "SHARE", "object_story_spec": { "page_id": "", "template_data": { "multi_share_end_card": "true", "link": "", "message": "", "call_to_action": {"type": "SHOP_NOW"}, } }, "asset_feed_spec":{ "optimization_type":"FORMAT_AUTOMATION", "ad_formats": ["CAROUSEL", "COLLECTION"], "videos": [{"video_id": ""}]}, "descriptions": [{"text": "{{product.description}}", "From {{product.current_price}}", ...]} }' \ -F 'tracking_specs=[{"action.type":"offsite_conversion","fb_pixel":}]' \ -F 'access_token=' \ https://graph.facebook.com/v/act_/ads ``` -------------------------------- ### Create Advantage+ Catalog Ads Campaign with curl (POST /campaigns) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/omnichannel-ads Creates an omnichannel campaign with Advantage+ catalog ads enabled by adding the promoted_object parameter with a product_catalog_id. Replace , , and with your values. ```bash curl -X POST \ https://graph.facebook.com/v20.0/act_/campaigns \ -F 'name=My Omni campaign' \ -F 'objective=OUTCOME_SALES' \ -F 'promoted_object={"product_catalog_id":""}' \ -F 'status=ACTIVE' \ -F 'access_token=' ``` -------------------------------- ### Create Advantage+ Catalog Ad with Store-Based Local Inventory (SBLI) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/omnichannel-ads POST to /adcreatives endpoint with recommender_settings product_sales_channel set to omni for store-based local inventory (SBLI) ads. Uses product_set_id from SBLI catalog. ```bash curl -X POST \ https://graph.facebook.com/v20.0/act_/ads \ -F 'name=My Omni Advantage+ Catalog Ad Creative' \ -F 'object_story_spec={ "page_id":"", "template_data":{ "call_to_action":{"type":"SHOP_NOW"}, "link":"", "name":"Headline {{product.price}}", "description": "Description {{product.description}}", "message": "Test {{product.name | titleize}}", } }' \ -F 'product_set_id=""' \ -F 'recommender_settings={"product_sales_channel": "omni"}' \ -F 'status=ACTIVE' \ -F 'access_token=' ``` -------------------------------- ### iOS SDK FBSDKGraphRequest GET pending_owned_pages Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/pending_owned_pages.md iOS SDK example using FBSDKGraphRequest with HTTPMethod GET to fetch pending owned pages. Starts request with completion handler. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/pending_owned_pages" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### iOS SDK: Get owned ad accounts Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/owned_ad_accounts.md iOS SDK example using FBSDKGraphRequest to call the owned_ad_accounts edge with GET method. Starts request with completion handler. ```objectivec /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/owned_ad_accounts" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create a product set with lease offers using curl Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/auto-ads/guides/aoa Use this curl command to create a product set that filters offers to only lease offers. Replace , , and with your values. The filter uses the offer_type field with the eq operator. ```bash curl \ -F 'name=lease offer set' \ -F 'filter={"offer_type":{"eq":"lease"}}' \ -F 'access_token=' \ https://graph.facebook.com///product_sets ``` -------------------------------- ### Create Advantage+ catalog ad Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/omnichannel-ads.md POST to /ads with template_data and product_set_id for Advantage+ catalog ads. ```bash curl -X POST \ https://graph.facebook.com/v20.0/act_/ads \ -F 'name=My Omni Advantage+ Catalog Ad Creative' \ -F 'object_story_spec={ "page_id":"", "template_data":{ "call_to_action":{"type":"SHOP_NOW"}, "link":"", "name":"Headline {{product.price}}", "description": "Description {{product.description}}", "message": "Test {{product.name | titleize}}", } }' \ -F 'product_set_id=""' \ -F 'status=ACTIVE' \ -F 'access_token=' ``` -------------------------------- ### GET //insights Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/insights/best-practices.md Starts an asynchronous job to get all stats for the account and returns an asynchronous job ID. This is an example of using the insights endpoint with a campaign ID. ```APIDOC ## GET //insights ### Description Starts an asynchronous job to get all stats for the account and returns an asynchronous job ID. This is an example of using the insights endpoint with a campaign ID. ### Method GET ### Endpoint `//insights` ### Parameters #### Query Parameters - **level** (string) - Level of insights (e.g., campaign). - **access_token** (string) - User access token. ### Request Example ``` curl \ -F 'level=campaign' \ -F 'access_token=' \ https://graph.facebook.com/v27.0//insights ``` ``` -------------------------------- ### iOS SDK FBSDKGraphRequest GET for assigned_offline_conversion_data_sets Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business-user/assigned_offline_conversion_data_sets.md iOS SDK example using FBSDKGraphRequest with HTTPMethod GET. Starts request with completion handler to handle result. ```objectivec /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-user-id}/assigned_offline_conversion_data_sets" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create ad with creative example request Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/messaging-ads/click-to-messenger Sends a POST request to /act_ad_account_id/ads to create an ad, associating the ad creative and ad set. Required parameters: access_token, adset_id, creative_id, name, and status. Set status to PAUSED initially, then ACTIVE when ready to launch. ```bash curl -X POST "https://graph.facebook.com/v27.0/act_ad_account_id/ads" -H "Content-Type: application/json" -d '{ "access_token": "Your_page_access_token", "adset_id": "Your_ad_set_id", "creative": { "creative_id": "Your_ad_creative_id" }, "status": "PAUSED" }' ``` ```json { "id": "ad_id" } ``` -------------------------------- ### Step 2: Create ad set with audience network placement Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/audience-network Creates an ad set with optimization_goal LINK_CLICKS and targeting that includes publisher_platforms audience_network. Requires campaign ID and access token. ```bash curl \ -F 'name=My Ad Set' \ -F 'optimization_goal=LINK_CLICKS' \ -F 'billing_event=LINK_CLICKS' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id=' \ -F 'targeting={ "device_platforms": ["mobile"], "geo_locations": {"countries":["US"]}, "publisher_platforms": ["facebook","audience_network"] }' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/adsets ``` -------------------------------- ### Example response for format_transformation_spec Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/format-automation Shows the JSON response returned by the API call, containing the format_transformation_spec array and the ad creative ID. ```json { "format_transformation_spec": [ { "data_source": ["catalog"], "format": "da_collection" } ], "id": "" } ``` -------------------------------- ### iOS SDK GET request for received_inprogress_transfer_ownership_agreements Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/received_inprogress_transfer_ownership_agreements.md Use this iOS SDK example to make the API call. It creates an FBSDKGraphRequest with the GET method and starts it with a completion handler to process the result. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/received_inprogress_transfer_ownership_agreements" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create single product Advantage+ catalog ads template with call to action Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-catalog-ads/get-started Creates a template that forces a single product link using force_single_link: true. Uses the SHOP_NOW call-to-action and product placeholders for description, name, and message. ```bash curl \ -F 'name=Advantage+ Catalog Ads Template Creative Sample' \ -F 'object_story_spec={ "page_id": "", "template_data": { "call_to_action": {"type":"SHOP_NOW"}, "description": "Description {{product.description}}", "force_single_link": true, "link": "", "message": "Test {{product.name | titleize}}", "name": "Headline {{product.price}}" } }' \ -F 'product_set_id=' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/adcreatives ``` -------------------------------- ### Create audience for Instant Experience opens Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/collection-ads Creates a custom audience for people who opened the Instant Experience. Set `object_id` to `CANVAS_ID` and use the event `instant_shopping_document_open`. This is a Fullscreen Experience engagement audience. ```bash curl -X POST \ -F 'name=Collection Engagement Audience' \ -F 'description=People who opened this Instant Experience' \ -F 'rule=[{ "object_id":"", "event_name":"instant_shopping_document_open" }]' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/customaudiences ``` -------------------------------- ### iOS SDK GET Request for Ad Study Cells Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-study/cells.md Creates an FBSDKGraphRequest for the /{ad-study-id}/cells endpoint with an HTTP GET method. The request is started with a completion handler that receives the connection, result, and error. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{ad-study-id}/cells" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### cURL example for creating a partner lift study Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/lift-studies Example cURL command that creates a partner lift study with one test group. It includes required parameters such as name, description, start_time, end_time, cells, iso_country, estimated_budget, estimated_reach, and estimated_impressions. The start_time and end_time must be in the future, and the access token is required. ```bash curl \ -F 'name="new partner study"' \ -F 'description="description of my partner study"' \ -F 'start_time=1435622400' \ -F 'end_time=1436918400' \ -F 'cells=[{name:"test group",description:"description of my test group",treatment_percentage:90,control_percentage:10,adaccounts:[,]}]' \ -F 'iso_country="us"' \ -F 'estimated_budget=400000' \ -F 'estimated_reach=600000' \ -F 'estimated_impressions=1200000' \ -F 'access_token=' \ 'https://graph.facebook.com///partner_ad_studies' ``` -------------------------------- ### GET /{business-id}/creatives - iOS SDK Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/creatives.md iOS SDK example using FBSDKGraphRequest to read business creatives. Starts a request with a completion handler. ```objectivec /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/creatives" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Opt-in for media-type-automation optimization Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-creative-for-catalog.md Enables media-type-automation optimization to use catalog videos in supported placements. Requires product video permission. ```bash curl \ -F 'name=Advantage+ creative for catalog test - product video' \ -F 'adset_id=' \ -F 'creative={ "name": "Creative For Advantage+ creative for catalog test - product video", "product_set_id": "", "object_type": "SHARE", "object_story_spec": { "page_id": "", "template_data": { "multi_share_end_card": "true", "link": "", "message": "", "call_to_action": {"type": "SHOP_NOW"}, } }, "asset_feed_spec":{ "optimization_type":"FORMAT_AUTOMATION", "ad_formats": ["CAROUSEL", "COLLECTION"], "descriptions": [{"text": "{{product.description}}", "From {{product.current_price}}", ...] }, "degrees_of_freedom_spec" : { "creative_features_spec": { "media_type_automation": { "enroll_status": "OPT_IN" } } } }' \ -F 'tracking_specs=[{"action.type":"offsite_conversion","fb_pixel":}]' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/ads ``` -------------------------------- ### Ad Campaign Response Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/messaging-ads/click-to-whatsapp.md Example JSON response from the GET request, showing the campaign's name, status, objective, and ID. ```json { "name": "Click to WhatsApp Campaign", "status": "PAUSED", "objective": "OUTCOME_ENGAGEMENT", "id": "" } ``` -------------------------------- ### Example response for get video ads Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/videoads/fbvideoads.md Shows the JSON response structure containing a data array with updated_time and id fields for each video. ```html { "data": [ { "updated_time": "unix_timestamp", "id": "video_id", } ] } ``` -------------------------------- ### Create Ad Set with bid_strategy=LOWEST_COST_WITH_MIN_ROAS Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-shopping-campaigns Creates an ad set with a lowest cost with minimum ROAS bid strategy, using bid constraints for ROAS floor. Note the missing closing quotes and backslashes in the source. ```bash curl \ -F 'name=My Ad Set' \ -F 'optimization_goal=OFFSITE_CONVERSIONS \ -F 'billing_event=IMPRESSIONS' -F 'bid_strategy=LOWEST_COST_WITH_MIN_ROAS -F 'bid_constraints={"roas_average_floor": 1000} \ -F 'daily_budget=1000' \ -F 'campaign_id=' \ -F 'targeting={"geo_locations":{"countries":["US"]}}' \ -F 'status=PAUSED' \ -F 'access_token=' \ https://graph.facebook.com//act_/adsets ``` -------------------------------- ### iOS SDK call for adnetworkanalytics_export Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/adnetworkanalytics_export.md Creates an FBSDKGraphRequest with HTTPMethod GET and starts it with a completion handler. The handler receives the connection, result, and error. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/adnetworkanalytics_export" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Example response for onboarding status check Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/marketing-messages Shows the expected JSON response when whatsapp_activation_status is MARKETING_MESSAGE_ONBOARDED. If the status is MARKETING_MESSAGE_NOT_ONBOARDED or MARKETING_MESSAGE_INELIGIBLE, the placement is not available. ```json { "marketing_messages_settings": { "whatsapp_activation_status": "MARKETING_MESSAGE_ONBOARDED" }, "id": "act_" } ``` -------------------------------- ### Example response for document information Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/instant-experiences.md Shows the JSON response from the previous GET request, containing the document name and ID (397246414010297) used in the next step. ```json { "document": { "name": "Get New Customers", "id": "397246414010297" }, "id": "133471657203838" } ``` -------------------------------- ### Create Advantage+ catalog ad with SBLI catalog Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/omnichannel-ads.md POST to /ads with template_data, product_set_id from SBLI catalog, and recommender_settings with product_sales_channel omni. ```bash curl -X POST \ https://graph.facebook.com/v20.0/act_/ads \ -F 'name=My Omni Advantage+ Catalog Ad Creative' \ -F 'object_story_spec={ "page_id":"", "template_data":{ "call_to_action":{"type":"SHOP_NOW"}, "link":"", "name":"Headline {{product.price}}", "description": "Description {{product.description}}", "message": "Test {{product.name | titleize}}", } }' \ -F 'product_set_id=""' \ -F 'recommender_settings={"product_sales_channel": "omni"}' \ -F 'status=ACTIVE' \ -F 'access_token=' ``` -------------------------------- ### Read ad study with iOS SDK Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-study.md iOS SDK example to read an ad study using FBSDKGraphRequest with HTTPMethod GET. Starts the request with a completion handler. ```objectivec /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{ad-study-id}" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create ad set with OFFSITE_CONVERSIONS optimization and IMPRESSIONS billing Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-catalog-ads/get-started Creates an ad set billed on IMPRESSIONS and optimized for OFFSITE_CONVERSIONS. Requires product_set_id in promoted_object; custom_event_type defaults to PURCHASE. Optionally omit dynamic_audience_ids. ```bash curl \ -F 'name=Product Catalog Sales Adset' \ -F 'bid_amount=3000' \ -F 'billing_event=IMPRESSIONS' \ -F 'optimization_goal=OFFSITE_CONVERSIONS' \ -F 'daily_budget=15000' \ -F 'campaign_id=' \ -F 'targeting={ "geo_locations": {"countries":["US"]}, "dynamic_audience_ids": [""] }' \ -F 'promoted_object={"product_set_id":""}' \ -F 'status=PAUSED' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/adsets ``` -------------------------------- ### iOS SDK Example for Ads Reporting MMM Schedulers Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-account/ads_reporting_mmm_schedulers.md Creates an FBSDKGraphRequest with a GET method and starts the request with a completion handler to process the result. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{ad-account-id}/ads_reporting_mmm_schedulers" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create Instant Experience with a video (canvas_video) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/collection-ads Creates a Canvas Video element for an Instant Experience, required for a collection ad. Uses the page's canvas_elements endpoint. ```bash curl \ -F 'canvas_video={ "video_id": "", }' \ -F 'access_token=' \ https://graph.facebook.com/v27.0//canvas_elements ``` -------------------------------- ### Create collection ad with video first element (object_type VIDEO) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/collection-ads Creates a collection ad creative when the first element of the Instant Experience is a video. Must set object_type to VIDEO. ```bash curl \ -F 'name=Collection Sample Video Creative' \ -F 'object_story_spec={ "video_data": { "call_to_action": { "type":"LEARN_MORE", "value":{ "link":"https://fb.com/canvas_doc/", } }, "image_url": "", "message": "", "title": "", }, "page_id": "" }' \ -F 'object_type=VIDEO' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/adcreatives ``` -------------------------------- ### Response for product ad statistics Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-catalog-ads/get-started Example JSON response from the insights endpoint showing account_id, product_id, date_start, date_stop, impressions, clicks, actions, and account_name. ```json { "data": [ { "account_id": "123456", "product_id": "60750", "date_start": "2015-02-03", "date_stop": "2015-02-03", "impressions": 880, "clicks": 8, "actions": [ { "action_type": "link_click", "value": 6 }, { "action_type": "offsite_conversion.other", "value": 5 }, { "action_type": "offsite_conversion", "value": 5 } ], "account_name": "My Account" }, ], ... } ``` -------------------------------- ### Create Campaign for Product Catalog (curl) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/mobile-app-ads.md Step 1 of Advantage+ catalog ads for mobile app install. Creates a paused campaign with OUTCOME_APP_PROMOTION objective. Requires access token and ad account ID. ```bash curl -X POST \ -F 'name="App Installs Campaign with Dynamic Product Ads"' \ -F 'objective="OUTCOME_APP_PROMOTION"' \ -F 'status="PAUSED"' \ -F 'special_ad_categories=[]' \ -F 'is_adset_budget_sharing_enabled=0' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/campaigns ``` -------------------------------- ### GET /{campaign-id}/copies - iOS SDK Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-campaign-group/copies.md iOS SDK example using FBSDKGraphRequest to read campaign copies. Starts the request with a completion handler. ```objectivec /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{campaign-id}/copies" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### GET video metadata via Marketing API (videos field) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-catalog-ads/get-started Use this curl request to retrieve video metadata for troubleshooting. For Marketing API v23.0 and above, use the `videos` field; for earlier versions, use `videos_metadata`. The example uses v27.0 and the `videos` field. ```bash curl -i -X GET \ "https://graph.facebook.com/v27.0/1234567890?fields=videos&access_token=" ``` -------------------------------- ### GET Request to List Installed Apps Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/lead-ads/quickstart/webhooks-integration Sends a GET request to the Page's subscribed_apps edge to see which apps are installed. Returns an empty data set if no apps are installed. ```bash curl -i -X GET "https://graph.facebook.com/{page-id}/subscribed_apps ?access_token={page-access-token}" ``` -------------------------------- ### Create Instant Experience with a template video (canvas_template_video) Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/creative/collection-ads Creates a Canvas Template Video element for an Instant Experience, required for a collection ad. Uses the page's canvas_elements endpoint. ```bash curl -X POST \ -F canvas_template_video={ "name": "Cover Image or Video", "bottom_padding": "0", "top_padding": "0", "product_set_id": , "template_video_spec": { "customization": { "text_color": "FFFFFF", "text_background_color": "000000", "name_template": "{{product.name}}", "body_template": "{{product.current_price strip_zeros}}" }, } }' \ -F 'access_token=' \ https://graph.facebook.com/v27.0//canvas_elements ``` -------------------------------- ### Add One or More Templates with quick_replies Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/messaging-ads/click-to-messenger Set `*_data.page_welcome_message` to an array with a message template to include multiple templates, such as a quick reply. The example shows a message with `text` and `quick_replies` array. Replace bold, italic values like `page_access_token` with your own. ```json ... "page_welcome_message": "[{ 'message': { 'text':' Your_question_or_directive', 'quick_replies':[ { 'content_type':'text', 'title':' Option_1', 'payload':' Option_1_information_for_webhook' }, { 'content_type':'text', 'title':' Option_2', 'payload':' Option_2_information_for_webhook' }, { 'content_type':'text', 'title':' Option_3', 'payload':' Option_3_information_for_webhook ' } ] } }]", ... ``` -------------------------------- ### iOS SDK FBSDKGraphRequest for /{business-user-id}/assigned_ad_accounts Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business-user/assigned_ad_accounts.md iOS SDK example using FBSDKGraphRequest with HTTPMethod GET. Starts the request and handles the result in the completion handler. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-user-id}/assigned_ad_accounts" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Read client Instagram accounts with iOS SDK Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/client_instagram_accounts.md iOS SDK example that creates an FBSDKGraphRequest with GET method and starts it with a completion handler to handle the result. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/client_instagram_accounts" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Create an ad set with Threads as a placement Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/ad-creative/threads-ads/creation Use this curl command to create an ad set that includes Threads as a placement by specifying both 'instagram' and 'threads' under publisher_platforms. The example uses optimization_goal LINK_CLICKS, billing_event IMPRESSIONS, and a daily budget of 1000. Replace placeholders like and with your actual values. ```bash curl \ -F 'name=Threads Adset' \ -F 'optimization_goal=LINK_CLICKS' \ -F 'billing_event=IMPRESSIONS' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id=' \ -F 'targeting={ "geo_locations": {"countries":["US"]}, "publisher_platforms": ["instagram", "threads"], "user_os": ["iOS"] }' \ -F 'access_token=' \ https://graph.facebook.com/v27.0/act_/adsets ``` -------------------------------- ### iOS SDK Request to Read Shared Audience Permissions Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/shared_audience_permissions.md Creates an FBSDKGraphRequest with GET method for the shared_audience_permissions path and starts it with a completion handler to process the result or error. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/shared_audience_permissions" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### Ad Set Creation Parameters Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/advantage-shopping-campaigns This documentation describes the parameters used when creating an ad set for Advantage+ shopping campaigns. It includes required and optional fields for budget, optimization, bidding, and scheduling. ```APIDOC ## Ad Set Creation Parameters ### Description This documentation describes the parameters used when creating an ad set for Advantage+ shopping campaigns. It includes required and optional fields for budget, optimization, bidding, and scheduling. ### Parameters #### Path Parameters None. #### Query Parameters None. #### Request Body - **end_time** (_datetime_) - Required when `lifetime_budget` is specified. When creating an ad set with a `daily_budget`, specify `end_time=0` to set the ad set as ongoing with no end date. UTC UNIX timestamp. Example: `2015-03-12 23:59:59-07:00` or `2015-03-12 23:59:59 PDT`. - **optimization_goal** (_enum_) - Optional. Select `OFFSITE_CONVERSIONS` to target delivery to individuals more likely to take a specific action on your website. Select `VALUE` as the optimization goal if you want to target delivery to individuals who are more likely to make high-value purchases. In Ads Manager, we display Highest Value as your bid strategy. `VALUE` optimization goal is only available for Website conversion location and requires `promoted_object` to have a specified `pixel_id` for your website and the `custom_event_type=PURCHASE`. - **bid_strategy** (_enum_) - Optional. `LOWEST_COST_WITHOUT_CAP`: Facebook automatically bids on your behalf and gets you the lowest cost results. Automatically increase your effective bid as needed to get the results you want based on your given `optimization_goal`. This is the default `bid_strategy` when `optimization_goal` is `OFFSITE_CONVERSION` or `VALUE`. `LOWEST_COST_WITH_MIN_ROAS`: Specific bidding option for value optimization. You must specify a `roas_average_floor`, which is the minimum return wanted from ads spend. Allows advertisers to keep return on ad spend around an average amount over the course of their campaign. You must specify `roas_average_floor`, which is the minimum return wanted from ads spend, within the `bid_constraints` object. This strategy is available for Website-only conversion location. It is compatible with VALUE as the `optimization_goal`. See Minimum Return on Advertiser Spend Bidding. `COST_CAP`: Get the most results possible while we strive to meet the cost per action you set. You must provide a cap number in the `bid_amount` field. Allows advertisers to scale conversions while keeping costs around their desired average CPA. You must provide a cap number in `bid_amount` to use this strategy. It is available for Website and Website and App conversion locations, and is compatible with `OFFSITE_CONVERSIONS` as the `optimization_goal`. Adherence to cost cap limits is not guaranteed. See Cost Cap. - **bid_amount** - Required if bid_strategy is `COST_CAP`. - **bid_constraints** (_JSON object_) - Optional. `optimization_goal` must be `VALUE`. `bid_strategy` must be `LOWEST_COST_WITH_MIN_ROAS`. Min ROAS bidding uses `bid_constraints` to pass the “ROAS floor”, but you cannot use with `bid_constraints`, use `roas_average_floor` instead. See Minimum Return on Advertiser Spend Bidding. The valid range of `roas_average_floor` is `[100, 10000000]`, inclusive. This means that the valid range of “minimum ROAS” is `[0.01, 1000.0]` or `[1%, 100000.0%]`, inclusive. - **billing_event** (_enum_) - Required. A billing event for the ad set. Only `IMPRESSIONS` is supported for Advantage+ shopping campaigns. - **existing_customer_budget_percentage** (_number_) - Optional. Specifies the maximum percentage of the budget that can be spent on the existing customers associated with this ad account. Lower values may lead to higher costs per conversion. Valid values are between 0-100. - **adlabels** (list) - Optional. Specifies a list of labels to be associated with this object. - **start_time** (_datetime_) - Optional. The start time of the set. UTC UNIX timestamp. Example: `2015-03-12 23:59:59-07:00` or `2015-03-12 23:59:59 PDT`. - **time_start** (_datetime_) - Optional. Time start. - **time_stop** (_datetime_) - Optional. Time stop. - **attribution_spec** (list) - Optional. Conversion attribution spec used for attributing conversions for optimization. ### Response No response schema provided in the source. ``` -------------------------------- ### iOS SDK GET request for business custom pivots Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/business/custom_pivots.md Creates an FBSDKGraphRequest for the /{business-id}/custom_pivots endpoint and starts it with a completion handler. Requires parameters dictionary and access token. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{business-id}/custom_pivots" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ``` -------------------------------- ### iOS SDK Example for Reading Ad Label Ads Source: https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-label/ads.md Creates an FBSDKGraphRequest for the /{ad-label-id}/ads path with GET method. Starts the request with a completion handler that processes the result or error. ```Objective-C /* make the API call */ FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/{ad-label-id}/ads" parameters:params HTTPMethod:@"GET"]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { // Handle the result }]; ```