Graph API Version

Canvas Photo

Reading

A photo inside a canvas

Example

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;

$params = array(
  'fields' => array(
    'action',
    'id',
    'name',
    'photo',
  ),
);

$data = Api::instance()->call(
  '/' . <CANVAS_PHOTO_ID>,
  RequestInterface::METHOD_GET,
  $params)->getContent();
curl -G \
  --data-urlencode 'fields=[ 
    "action", 
    "id", 
    "name", 
    "photo" 
  ]' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<CANVAS_PHOTO_ID>

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription
id
numeric string

The id of the element

action
CanvasOpenURLAction

The action associated with the photo

bottom_padding
numeric string

The padding below the element

deep_link
string

Deep link destination only for mobile apps (used for mobile install or engagement ads, and app link is supported)

element_group_key
string

The element group key to bundle multiple elements in editing

element_type
enum

The type of the element

hide_product_prices
bool

Flag to determine whether or not to hide prices for tagged products

name
string

The name of the element

photo

The facebook photo node

product_tags
list<CanvasProductTag>

The product tags on the photo

style
enum

The presentation style of the photo node

top_padding
numeric string

The padding above the element

Error Codes

ErrorDescription
368The action attempted has been deemed abusive or is otherwise disallowed

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.

Add Product Tags

Create an ads experience that mimics browsing a printed, lifestyle catalog featuring desired products to promote. You can tag featured products in the image and a tag appears on the image.

This API is available on a limited basis to partners and advertisers that are on the allow list. Contact your Facebook representative if you want to use this API.

When someone taps the tag, a thumbnail for that product appears in a rotating group of thumbnails, including all tagged products. Someone can tap the thumbnail to be taken to the product's product detail page. This uses the photo with product tags element API. For example:

curl -F 'canvas_photo={ "bottom_padding": 20, "name": "Instant Experience Photo Name", "open_url_action": {"url":"URL"}, "photo_id": "PHOTO_ID", "style": "FIT_TO_WIDTH", "top_padding": 20, "product_tags": "[{product_id: PRODUCT_ID, coordinates: [0.65, 0.58]}, {product_id: PRODUCT_ID}]" }' }' -F 'access_token=ACCESS_TOKEN' https://graph.facebook.com/VERSION/PAGE_ID/canvas_elements

The options available for product tags are:

Field Name Description Type Required

product_tags

Provide a list of products for the photo

array

Yes

product_id

Product id for tapped photo

number

Yes

coordinates

Spot coordinates on the photo.

array, where x and y greater than zero and less than 1

No. If none specified, there is no spot on the photo