get_ad_creatives_by_ad_id
Fetch ad creatives for a Facebook ad by ad ID, returning creative content, media, and specifications. Choose relevant fields and paginate through results.
Instructions
Retrieves the ad creatives associated with a specific Facebook ad.
This function accesses the Facebook Graph API to retrieve the creative objects used by a specific ad, including details about the creative content, media, and specifications.
Args: ad_id (str): The ID of the ad to retrieve creatives for. fields (Optional[List[str]]): A list of specific fields to retrieve for each creative. If None, a default set of fields will be returned. Available fields include: - 'id': The creative's ID - 'name': The creative's name - 'account_id': The ID of the ad account this creative belongs to - 'actor_id': ID of the Facebook actor associated with creative - 'adlabels': Ad labels applied to the creative - 'applink_treatment': App link treatment type - 'asset_feed_spec': Specifications for dynamic ad creatives - 'authorization_category': Political ad authorization category - 'body': Ad body text content - 'branded_content_sponsor_page_id': ID of sponsoring page for branded content - 'call_to_action_type': Type of call to action button - 'effective_authorization_category': Effective authorization category - 'effective_instagram_media_id': Instagram media ID used - 'effective_instagram_story_id': Instagram story ID used - 'effective_object_story_id': Object story ID used - 'image_hash': Hash of the image used in the creative - 'image_url': URL of the image used - 'instagram_actor_id': Instagram actor ID (deprecated) - 'instagram_permalink_url': Instagram permalink URL - 'instagram_story_id': Instagram story ID - 'instagram_user_id': Instagram user ID associated with creative - 'link_og_id': Open Graph ID for the link - 'link_url': URL being advertised - 'object_id': ID of the Facebook object being advertised - 'object_story_id': ID of the page post used in the ad - 'object_story_spec': Specification for the page post - 'object_type': Type of the object being advertised ('PAGE', 'DOMAIN', etc.) - 'object_url': URL of the object being advertised - 'platform_customizations': Custom specifications for different platforms - 'product_set_id': ID of the product set for product ads - 'status': Status of this creative ('ACTIVE', 'IN_PROCESS', etc.) - 'template_url': URL of the template used - 'thumbnail_url': URL of the creative thumbnail - 'title': Ad headline/title text - 'url_tags': URL tags appended to landing pages for tracking - 'use_page_actor_override': Whether to use the page actor instead of account actor - 'video_id': ID of the video used in the ad limit (Optional[int]): Maximum number of creatives to return per page. Default is 25. after (Optional[str]): Pagination cursor for the next page. From response['paging']['cursors']['after']. before (Optional[str]): Pagination cursor for the previous page. From response['paging']['cursors']['before']. date_format (Optional[str]): Format for date responses. Options: - 'U': Unix timestamp (seconds since epoch) - 'Y-m-d H:i:s': MySQL datetime format - None: ISO 8601 format (default)
Returns: Dict: A dictionary containing the requested ad creatives. The main results are in the 'data' list, and pagination info is in the 'paging' object.
Example: ```python # Get basic creative information for an ad creatives = get_ad_creatives( ad_id="23843211234567", fields=["name", "image_url", "body", "title", "status"] )
# Get detailed creative specifications with pagination
detailed_creatives = get_ad_creatives(
ad_id="23843211234567",
fields=["name", "object_story_spec", "image_url", "call_to_action_type"],
limit=50
)
# Fetch the next page if available using the pagination cursor
next_page_cursor = creatives.get("paging", {}).get("cursors", {}).get("after")
if next_page_cursor:
next_page = get_ad_creatives(
ad_id="23843211234567",
fields=["name", "image_url", "body", "title"],
limit=50,
after=next_page_cursor
)
```
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ad_id | Yes | ||
| after | No | ||
| limit | No | ||
| before | No | ||
| fields | No | ||
| date_format | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |