Apps already approved for the Pages API have until August 1, 2018, to undergo the new App Review process or lose access to the API.

Getting Started

With the Pages API people can update and manage Facebook Pages from your page-related app. People can publish content to Facebook or Messenger with a Page's identity. Use cases for Pages API include:

  • Building a Pages management tool for customers or for your company
  • Building apps so content creators and editors can easily publish as a Page
  • Marketing and advertising for a business using the Marketing API. For more information, see Ads Management API and Unpublished Page Posts

App Review

The Pages API requires App Review. Request approval for the following features and permissions.

Features

Note that Page Public Content Access is only necessary if your app needs to access public data on Pages for which it lacks the manage_page login permission.

Permissions

  • manage_pages
  • pages_manage_instant_articles
  • pages_show_list
  • publish_pages
  • read_insights
  • read_page_mailboxes

You may need to request approval for additional permissions, depending on the Graph API endpoints you will be using. The reference documents for Page-related nodes and edges list all required permissions.

Business Verification

In addition to general App Review, you will be asked to complete Business Verification.

Implementation Steps

1. Create a Page

2. Developer Account

3. Create a Facebook App

4. Select your Tools

5. Ask for Permissions

6. Get a Page Access Token

7. Post as a Page


1. Create a Page

Use an existing page or create a new one.

Using the UI

For full instructions, see Help Center, How do I create a Page?

Using the API

Use the /user/accounts edge to create a Facebook Page.

Requirements

  • Your app must be whitelisted to use the Pages API. (You can apply through your Facebook representative.)
  • A User access token with manage_pages permissions.
  • The category_enum parameter with a Page Category.
  • Other requirements vary depending on the type of page you are creating but may include name, about, picture, and cover_photo.

Sample Request

POST graph.facebook.com/your-user-id/accounts
  ?name=My Personal Blog
  &category_enum=PERSONAL_BLOG
  &about=Just trying some things with the API
  &picture=http://url-of-my-picture.jpg 
  &cover_photo=http://url-of-my-cover-picture.jpg
  &access_token=your-user-access-token

Sample Response

{
  "id": "your-new-page-id"
}

Use the page_id returned in the response to visit the page.

https://www.facebook.com/your-page-id

2. Developer Account

If you don't have a Facebook developer account, you will need to create one. A Facebook developer account will give you access to our developer tools and allow you to create Facebook apps.


3. Create a Facebook App

This step creates an App ID which is used when making API calls and allows you to add products, such as webhooks and analytics, to your app. Access to the Marketing API requires you create a Facebook App ID.


4. Select Your Tools

Choose one of the following tools:

Graph API Explorer - Test Pages API using the Graph API Explorer tool. Learn more about using the Graph API Explorer and the Graph API.

Facebook SDKs - If you want to go beyond testing select one or more of our SDKs. Our SDKs give you easy access to the Graph API as well as Facebook Login which you will need to get access tokens.


5. Ask for Permissions

Your app needs to ask for permissions to manage a page or post as a page.

Be sure to know the limitations of access of apps in Development Mode versus Live Apps.

In the Graph API Explorer or via using one of our SDKs ask for the following permissions:

  • manage_pages - Enables your app to retrieve Page Access Tokens for the Pages and Apps that the person administrates.
  • publish_pages - Gives your app the ability to post, comment, and like as any of the Pages managed by a person using your app.

Tip: In the Graph API Explorer select permissions by clicking Get Token, then Get User Access Token.

Advanced Permissions

In this getting started guide we will only use the basic permissions manage_pages and publish_pages. To learn more about the advanced permissions read_page_mailboxes, pages_show_list, and pages_manage_cta read our Page Access Tokens & Permissions guide.


6. Get a Page Access Token

Now that you have a User Access Token with the needed permissions, you can get a Page Access Token. Make an API request using your user access token and your Facebook Page ID.

GET https://graph.facebook.com/your-page-id?fields=access_token&access_token=your-user-access-token

The response will look like this:

{
  "access_token": "CAACEdEose0cBACCZBZA5qz1ZBjUX...", 
  "id": "your-page-id"
}

The access_token field in the sample response contains the Page Access Token for the requested page. Use it to manage the Page, post as a Page, and so forth. Learn more about Page Access Tokens and Permissions.


7. Post as a Page

Now you can make a post as the Page. Send a POST request to the /{page-id}/feed endpoint using the message field to define your message text. You can do this using the Graph API Explorer to test and to show you the code you can use.

Graph API Explorer Request and Response - The id returned is the message_id.

To get a list of page_ids in the Graph API Explorer send a GET request to me?fields=id,name,accounts where me is you with your User Access Token. This will return a list of pages you manage.

The Result in Your Page Feed

Getting the Code Snippet - At the bottom of the Graph API Explorer you can get the code for this, or any, request.

The Code Snippet - Select Android, iOS, JavaScript, PHP, or cURL.

You can also verify that your post was published by sending a GET request to the /page-id/feed endpoint.

Limitations

To access public data of Pages, such as page posts, page comments, etc., your app must go through App Review. You can test by querying your own pages' public data while your app is in Development Mode.

Apps in Development Mode can only access the User node of users who have one of the following App Developer Roles: An admin, a developer, or a tester.

Calls to the API are subject to rate limiting. Please view our Graph API Rate Limiting Guide for more information.