Marketing API Version

Ad Creative Video Data

Video Data is one field within the creative that is used to create video ads. The Reading section of this document outlines the specific fields within Video Data. While you cannot create a Video Data object on its own, you would nest the call within an ad creative creation call.

Create Examples

Create a Video Page Like ad

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdCreativeVideoData;
use FacebookAds\Object\Fields\AdCreativeVideoDataFields;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$video_data = new AdCreativeVideoData();
$video_data->setData(array(
  AdCreativeVideoDataFields::IMAGE_URL => '<THUMBNAIL_URL>',
  AdCreativeVideoDataFields::VIDEO_ID => <VIDEO_ID>,
  AdCreativeVideoDataFields::CALL_TO_ACTION => array(
    'type' => AdCreativeCallToActionTypeValues::LIKE_PAGE,
    'value' => array(
      'page' => <PAGE_ID>,
    ),
  ),
));

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data,
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');

$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));

$creative->create();
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec
from facebookads.adobjects.adcreativevideodata \
    import AdCreativeVideoData

video_data = AdCreativeVideoData()
video_data[AdCreativeVideoData.Field.video_id] = <VIDEO_ID>
video_data[AdCreativeVideoData.Field.image_url] = '<IMAGE_URL>'
video_data[AdCreativeVideoData.Field.call_to_action] = {
    'type': 'LIKE_PAGE',
    'value': {
        'page': <PAGE_ID>,
    },
}

object_story_spec = AdCreativeObjectStorySpec()
object_story_spec[AdCreativeObjectStorySpec.Field.page_id] = <PAGE_ID>
object_story_spec[AdCreativeObjectStorySpec.Field.video_data] = video_data

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'Video Ad Creative'
creative[AdCreative.Field.object_story_spec] = object_story_spec
creative.remote_create()
AdCreative adCreative = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdCreative()
  .setName("Sample Creative")
  .setObjectStorySpec(
    new AdCreativeObjectStorySpec()
      .setFieldPageId(<PAGE_ID>)
      .setFieldVideoData(
        new AdCreativeVideoData()
          .setFieldCallToAction(
            new AdCreativeLinkDataCallToAction()
              .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LIKE_PAGE)
              .setFieldValue(
                new AdCreativeLinkDataCallToActionValue()
                  .setFieldPage(<PAGE_ID>)
              )
          )
          .setFieldDescription("try it out")
          .setFieldImageUrl(<THUMBNAIL_URL>)
          .setFieldVideoId(<VIDEO_ID>)
      )
  )
  .execute();
String ad_creative_id = adCreative.getId();
curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "video_data": { 
      "call_to_action": {"type":"LIKE_PAGE","value":{"page":"<PAGE_ID>"}}, 
      "image_url": "<THUMBNAIL_URL>", 
      "video_id": "<VIDEO_ID>" 
    } 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

Reading

The specification for a video ad.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription
branded_content_shared_to_sponsor_status
string

The branded content shared to sponsor option.

branded_content_sponsor_page_id
numeric string

The branded content sponsor page id.

branded_content_sponsor_relationship
string

The branded content sponsor relationship option.

call_to_action

An optional call to action. Additionally you can specify a LIKE_PAGE call to action when the ad is in a PAGE_LIKES campaign.

image_hash
string

Hash of an image in your image library with Facebook to use as thumbnail

image_url
string

URL of image to use as thumbnail. You should not use image URLs returned from the FB CDN but instead have the image hosted on your own servers. The image specified at the URL will be saved into the ad accounts image library

link_description
string

Link description of the video. Overwrites the description in the video post on Facebook. You need to specify a call to action to use this field. Note that this field cannot be used with LIKE_PAGE call to action. See post for more info.

message
string

The main body of the video post. See post for more info.

offer_id
numeric string

The id of a Facebook native offer.

page_welcome_message
string

A welcome text from page to user on Messenger once a user performs send message action on an ad.

post_click_configuration
AdCreativePostClickConfiguration

Customized contents provided by the advertiser for an ad post-click experience.

retailer_item_ids
list<string>

List of product IDs provided by the advertiser for Collections

targeting

The post gating for the video.

title
string

The title of the video. This cannot be used with LIKE_PAGE call to action.

video_id
numeric string

ID of video that user has permission to or a video in ad account video library.

Edges

No edges

Creating

You can't perform this operation on this endpoint.

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.