Public Feed API

Access to the Public Feed API is restricted to a limited set of media publishers and usage requires prior approval by Facebook. You cannot apply to use the API at this time.

In this document:

The Public Feed API provides a feed of user status updates and page status updates as they are posted to Facebook. Only status updates that have their privacy set to ‘public’ are included in the feed. The feed isn’t available via an HTTP API endpoint, instead updates are sent to your server over a dedicated HTTPS connection. The feed only includes basic data about the given post. From that basic data you may use the Graph API to request additional metadata to supplement the updates received through the public feed API.

Since users may delete or modify their privacy settings after posts are served, the API also sends reference to these actions. When you’re notified that a post has been removed or hidden, the post must be removed from your service within 24 hours, including any public displays of that post.


Getting Started

In order to start receiving updates from the public feed API, you will need to setup a HTTPS endpoint, where the API will POST all updates. Please note that this endpoint must have a valid SSL certificate that is NOT self-signed in order to receive updates. Once your HTTPS endpoint has been configured, provide this URL to your Facebook representative and confirm that you’re ready to start receiving the large volume of data that will be sent through the public Feed API.

If you have a firewall in front of your endpoint, please refer to our App Security developer documentation showing our current IP ranges and how to programmatically get this list.


Processing Updates

Once your service is enabled to receive updates from the public feed API, you will begin receiving public user status updates and page status updates, in near real-time, as they are posted to Facebook. These updates will be served in the form of XML-based objects that will provide your app with a basic set of information about the particular post. You may wish to also use the Graph API to request additional details about the post to supplement these objects.

The following represents an example user status update:

<entry>
 <title><![CDATA[This is a public user post.]]></title>
  <id>http://www.facebook.com/permalink.php?id=123&story_fbid=123</id>
  <fb:id>123</fb:id>
  <link rel="alternate" type="text/html"
    href="http://www.facebook.com/permalink.php?id=123&story_fbid=123"/>
  <published>2013-04-13T00:02:35-07:00</published>
  <updated>2013-04-13T00:02:35-07:00</updated>
  <author>
    <name>SampleUser</name>
    <fb:id>123</fb:id>
    <uri>http://www.facebook.com/profile.php?id=123</uri>
    <permanent_uri>
        http://www.facebook.com/profile.php?id=123
    </permanent_uri>
    <display_uri>http://www.facebook.com/sample.user</display_uri>
    <icon>http://profile.ak.fbcdn.net/hprofile-ak-ash4/123_q.jpg</icon>
    <is_page>0</is_page>
    <is_verified>0</is_verified>
    <fb:friend_count>142</fb:friend_count>
  </author>
  <category term="Status Update"label="Status Update" />
  <activity:verb>http://activitystrea.ms/schema/1.0/post/</activity:verb>
  <activity:object>
    <content>This is a public user post. </content>
    <published>2013-04-13T00:02:35-07:00</published>
    <activity:object-type>
        http://activitystrea.ms/schema/1.0/status/
    </activity:object-type>
  </activity:object>
  <content type="html"><![CDATA[R This is a public user post.]]></content>
</entry>

The following represents an example page post update:

<entry>
  <title><![CDATA[Sample Page uploaded a photo.]]></title>
  <id>http://www.facebook.com/photo.php?pid=123&id=123</id>
  <fb:id>123</fb:id>
  <link rel="alternate" type="text/html" 
  	href="http://www.facebook.com/photo.php?pid=123&id=123" />
  <published>2013-04-13T00:01:23-07:00</published>
  <updated>2013-04-13T00:01:23-07:00</updated>
  <author>
    <name>Sample Page</name>
    <fb:id>123</fb:id>
    <uri>http://www.facebook.com/profile.php?id=123</uri>
    <permanent_uri>
      http://www.facebook.com/profile.php?id=123
    </permanent_uri>
    <display_uri>http://www.facebook.com/samplepage</display_uri>
    <icon>http://profile.ak.fbcdn.net/hprofile-ak-snc6/123_q.jpg</icon>
    <is_page>1</is_page>
    <fan_count>331</fan_count>
  </author>
  <category term="Upload Photos" label="Upload Photos" />
  <activity:verb>http://activitystrea.ms/schema/1.0/post/</activity:verb>
  <activity:object>
    <id>http://www.facebook.com/photo.php?pid=123&id=123</id>
    <thumbnail>
      https://fbcdn-photos-a-a.akamaihd.net/hphotos-ak-prn1/123_t.png
    </thumbnail>
    <link rel="enclosure" type="text/jpeg" 
    	href="https://fbcdn-photos-c-a-.akamaihd.net/hphotos-ak-ash4/123111_t.jpg" />
    <caption>This is an awesome photo.</caption>
    <published>2013-04-13T00:01:23-07:00</published>
    <link rel="alternate" type="text/html" 
      href="http://www.facebook.com/photo.php?pid=123&id=123" />
    <link rel="preview" type="image/png" 
      href="https://fbcdn-photos-a-a.akamaihd.net/hphotos-ak-prn1/123_t.png" />
    <activity:object-type>
      http://activitystrea.ms/schema/1.0/photo/
    </activity:object-type>
  </activity:object>
</entry>

All <entry> data will be nested in the following data:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
  xmlns:activity="http://activitystrea.ms/spec/1.0/" 
  xmlns:fb="http://www.facebook.com" 
  xmlns:access="http://www.bloglines.com/about/specs/fac-1.0" 
  xmlns:og="http://ogp.me/ns#">
  <access:restriction relationship="deny" />
  <id>http://www.facebook.com/activitystreams/global.php</id>
  <generator uri="http://www.facebook.com/">
    Facebook Syndication
  </generator>
  <title>Global Activity Stream</title>
  <link href="http://www.facebook.com/activitystreams/global.php" />
  <link rel="self" href="http://facebook.com/" />
  <updated>2013-09-06T12:42:50-07:00</updated>
  <icon>
    http://www.facebook.com/favicon.ico
  </icon>
  <logo>
    http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yL/r/HsTZSDw4avx.gif
  </logo>

<entry></entry>
<entry></entry>
...

</feed>

Removing Posts

In order to use the public feed API, your app must properly process posts that indicate the removal of specific posts that were previously received. There are three cases in which such an update can be triggered:

  • A user changes the privacy for an individual post
  • A user changes their Search Engine account privacy settings for “Do you want other search engines to link to your timeline?”
  • A user changes their Follower Settings so they can no longer be followed by the general public

When there are posts to be deleted, the public feed API will notify your service by sending an update with the activity:verb type set to “/delete”. When you receive a delete, you must delete the affected posts.

User changes the privacy for an individual post

A person can change the privacy on an individual post that was previously set to “Public” to another privacy setting. They may also delete the actual post. When this situation occurs, the delete update will contain the “id” tag as part of the update. In this case, your service must delete that particular post from your service storage and from any places where it might be publicly posted.

The following is an example update that represents the case where the privacy level on a previously public user post to a level lower than “Everyone”:

<entry>
  <id>http://www.facebook.com/permalink.php?id=1759767455445&amp;amp;story_fbid=2941352787850360</id>
  <deleted>2013-04-29T17:30:59-07:00</deleted>
  <author>
    <name>Will LuckyUser</name>                                                      
    <fb:id>4997657632224</fb:id>                                                       
    <permanent_uri>http://www.facebook.com/profile.php?id=4997657632224</permanent_uri> 
  </author> 
  <activity:verb>http://activitystrea.ms/schema/1.0/delete[CB24] /</activity:verb>
</entry>

User changes their Search Engine account privacy settings

In this case, the user has changed their Search Engine privacy setting that specifies whether search engines can link to the user’s timeline. When this situation occurs, the delete update will not contain the “id” tag as noted in the individual post case noted above. If the “id” tag is not included in the delete update, your service must delete all posts that have been received for this particular user. In this case, you must lookup all posts for that the user identified by the “fb:id” tag and then delete each of these posts.

The following is an example update that represents the case where the user has changed their Search Engine privacy settings:

<entry>                                                                      
  <deleted>2013-04-29T16:43:22-07:00</deleted>                                    
  <author>                                                                       
    <name>Will LuckUser</name>                                                      
    <fb:id>4997657632224</fb:id>                                                       
    <permanent_uri>http://www.facebook.com/profile.php?id=4997657632224</permanent_uri> 
  </author>                                                                       
  <activity:verb>http://activitystrea.ms/schema/1.0/delete/</activity:verb>                                                           
</entry>

A user changes their Follower Settings

Please follow the instructions in the above section, "User changes their Search Engine account privacy settings".