Marketing API Version

Ad Creative

Format which provides layout and contains content for the ad. To see available ad creatives, visit Ads Guide. The guide also contains information on size requirements for each ad unit. See also Facebook for Business and Inline page post creation blog post.

Breaking Change: Political Ads

To increase transparency of ads on Facebook, we require advertisers running political ads to complete authorization. We will begin enforcing this in the next upcoming weeks. You must also indicate that your ad is political and provide the name of the funding source for the ad:

  • Your ad account must be authorized by a Page admin to run political ads for this Page. This is done by a Page admin on the Authorizations tab under Page Settings.

  • Ad account users must go through a verification process.

Examples

For example, get information about an ad creative, such as the ID of the newly created unpublished page post:

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdCreativeFields;

$creative = new AdCreative(<CREATIVE_ID>);
$creative->read(array(
  AdCreativeFields::NAME,
  AdCreativeFields::OBJECT_STORY_ID,
));
from facebookads.adobjects.adcreative import AdCreative

creative = AdCreative(<CREATIVE_ID>)
creative.remote_read(
    fields=[AdCreative.Field.name, AdCreative.Field.object_story_id]
)
AdCreative adCreative2 = new AdCreative(<CREATIVE_ID>, context).get()
  .requestNameField()
  .requestObjectStoryIdField()
  .execute();
curl -G \
  -d 'fields=name,object_story_id' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<CREATIVE_ID>

Create a link ad:

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdCreativeLinkData;
use FacebookAds\Object\Fields\AdCreativeLinkDataFields;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeFields;

$link_data = new AdCreativeLinkData();
$link_data->setData(array(
  AdCreativeLinkDataFields::MESSAGE => 'try it out',
  AdCreativeLinkDataFields::LINK => '<URL>',
  AdCreativeLinkDataFields::IMAGE_HASH => '<IMAGE_HASH>',
));

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::LINK_DATA => $link_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.adcreative'<LINK>'data import AdCreativeLinkData
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec

link_data = AdCreativeLinkData()
link_data[AdCreativeLinkData.Field.message] = 'try it out'
link_data[AdCreativeLinkData.Field.link] = '<LINK>'
link_data[AdCreativeLinkData.Field.image_hash] = '<IMAGE_HASH>'

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

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'AdCreative for Link Ad'
creative[AdCreative.Field.object_story_spec] = object_story_spec
creative.remote_create()

print(creative)
AdCreative adCreative = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdCreative()
  .setName("Sample Creative")
  .setObjectStorySpec(
    new AdCreativeObjectStorySpec()
      .setFieldLinkData(
        new AdCreativeLinkData()
          .setFieldCaption("My caption")
          .setFieldImageHash(<IMAGE_HASH>)
          .setFieldLink(<URL>)
          .setFieldMessage("try it out")
      )
      .setFieldPageId(<PAGE_ID>)
  )
  .execute();
String ad_creative_id = adCreative.getId();
curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "link_data": { 
      "image_hash": "<IMAGE_HASH>", 
      "link": "<URL>", 
      "message": "try it out" 
    }, 
    "page_id": "<PAGE_ID>" 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

You can replace picture with image_hash to specify an image from your ad account's image library. You can also specify image cropping with image_crops in link_data. See Image Crop, Reference.

To create a political ad creative, use the field authorization_category with value POLITICAL. For example:

curl \
-F 'authorization_category=POLITICAL' \
-F 'object_story_spec={
    ...
}' \
-F 'access_token=<TOKEN>' \
https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adcreatives 

For guidelines on Facebook ads see Ad Guidelines.

Related Resources

Limits

Only returns 50,000 ad creatives, pagination past this is unavailable.

Fields-Level Limits

LimitValue

Maximum ad title length

25 characters, recommended

Minimum ad title length

1 character

Maximum ad body length

90 characters, recommended

Minimum ad body length

1 character

Maximum length of a URL

1024 characters

Maximum length of an individual word in title or body

30 characters, recommended

Title and Body Limits

  • Should be between minimum and maximum title and body lengths.
  • Cannot start with punctuation \ / ! . ? - * ( ) , ; :
  • Cannot have consecutive punctuation except of three full-stops ...
  • Words no longer than 30 characters
  • Only three 1-character words allowed

The following characters are not allowed:

  • IPA Symbols. Except: ə, ɚ, ɛ, ɜ, ɝ, ɞ, ɟ
  • Diacritical Marks. Precomposed version of a character + diacritical mark are allowed. Standalone diacritical marks are not allowed.
  • Superscript and subscript characters except ™ and ℠
  • These characters ^~_={}[]|<>

Exceptions

  • Link Ads cannot use special characters
  • Page Posts Ads allow special characters such as

Placement

See Placement Validation for restrictions on placement of your ad based on creative.