Graph API Version

Page Canvas Elements

Reading

The canvas elements associated with this page

Graph API Explorer
GET /v2.10/{page-id}/canvas_elements HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{page-id}/canvas_elements'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{page-id}/canvas_elements",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/canvas_elements",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/canvas_elements"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Parameters

This endpoint doesn't have any parameters.

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A list of CanvasBodyElement nodes.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter

Creating

You can make a POST request to canvas_elements edge from the following paths:
When posting to this edge, a CanvasBodyElement will be created.

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
  • ads_management
  • manage_pages
  • publish_pages
  • pages_show_list
Page management Apps
  • manage_pages
  • publish_pages
  • pages_show_list
Other Apps
No data

Parameters

NameDescription
canvas_button
Object

Create a canvas button that belongs to a page

name
string
Default value: Button

Name of the button

button_color
string
Default value: FF000000

The color of the button

rich_text
Object

The text inside the button

Required
button_style
enum {BUTTON_OUTLINE, BUTTON_FILLED}
Default value: BUTTON_OUTLINE

The style of the button

open_url_action
Object

the destination url after user clicks the button, by setting this, the canvas button will have action with OPEN URL type

text_alignment
enum {LEFT, CENTER, RIGHT}
Default value: CENTER

The alignment of the text on the button

text_color
string
Default value: FF777777

The color of the text on the button

font_size
int64
Default value: 15

The size of the font for the text on the button

font_family
string
Default value: sans-serif

The font family of the text on the button

line_height
float
Default value: 1

The line height of the text on the button

top_padding
float
Default value: 0

The padding above the button

deep_link
string
bottom_padding
float
Default value: 0

The padding below the button

background_color
string
Default value: FFFFFFFF

Background color of the button

canvas_carousel
Object

Create a canvas carousel that belongs to a page

name
string
Default value: Carousel

Name of the carousel element

child_elements
list<id>

The child elements of the carousel. Typically, they are canvas photo elements

Required
style
enum {FIT_TO_WIDTH, FIT_TO_HEIGHT}
Default value: FIT_TO_WIDTH

The presentation style of the carousel

top_padding
float
Default value: 0

The padding above the carousel

bottom_padding
float
Default value: 0

The padding below the carousel

canvas_footer
Object

Create a canvas footer that belongs to a page

name
string
Default value: Footer

Name of the footer element

child_elements
list<id>

The child elements inside a footer, typically, it is a canvas button element.

Required
background_color
string
Default value: FFFFFFFF

Background color of the button

canvas_header
Object

Create a canvas header that belongs to a page

name
string
Default value: Header

Name of the header element

child_elements
list<id>

The child elements (typically a photo) inside the header

Required
background_color
string

The background color of the header

canvas_photo
Object

Create a canvas photo that belongs to a page

photo_id
id

ID of Facebook photo used in the photo element

open_url_action
Object

The action associated with the photo

style
enum {FIT_TO_WIDTH, FIT_TO_WIDTH_EXPANDABLE, FIT_TO_HEIGHT}

The presentation style of the photo

name
string
Default value: Photo

Name of the photo element

top_padding
float
Default value: 0

The padding above the photo element

bottom_padding
float
Default value: 0

The padding below the photo element

product_tags
list<Object>
product_id
numeric string or integer
Required
coordinates
list<float>
canvas_product_set
Object

Creat a canvas product set that belongs to a page

name
string
Default value: Product

Name of the product set element

max_items
int64

Maximum number of products to show

Required
product_set_id
id

The product set id which contains a subset of products within a product catalog

top_padding
float
Default value: 0

The padding above the product set

bottom_padding
float
Default value: 0

The padding below the product set

canvas_store_locator
Object

Create a canvas store locator that belongs to a page

page_set_id
numeric string or integer

The page set id used for the store locator

Required
name
string
Default value: Store Locator

Name of the store locator element

typeface
string
Default value: HelveticaNeue-Light

Font used to display info about the store

header_background_color
string
Default value: FF000000

Header background color for the store locator

canvas_text
Object

Create a canvas text that belongs to a page

name
string
Default value: Text

Name of the text element

rich_text
Object

The text content of the text element

Required
text_alignment
enum {LEFT, CENTER, RIGHT}
Default value: CENTER

The alignment of the text

text_color
string
Default value: FF777777

The color of the text

font_size
int64
Default value: 15

The size of the font for the text

font_family
string
Default value: sans-serif

The font family of the text

line_height
float
Default value: 1

The line height of the text

top_padding
float
Default value: 0

The padding above the text

bottom_padding
float
Default value: 0

The padding below the text

background_color
string

The color of the background for the text

canvas_video
Object

Create a canvas video that belongs to a page

name
string
Default value: Video

Name of the video element

video_id
id

ID of Facebook video used in the video element

style
enum {FIT_TO_WIDTH, FIT_TO_HEIGHT}
Default value: FIT_TO_WIDTH

The presentation style of the video

top_padding
float
Default value: 0

The padding above the video

bottom_padding
float
Default value: 0

The padding below the video

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error
105The number of parameters exceeded the maximum for this operation

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.