title: Facebook's 5000 Post API Limit
body: <p>I have a question about the way Facebook limits your api calls.</p>
  
  <p>Toward the bottom of this article: <a href="http://developers.facebook.com/blog/post/478/">http://developers.facebook.com/blog/post/478/</a> facebook says:</p>
  
  <blockquote>
    <p>In addition to the limits mentioned in the documentation for each of the tables and connections listed above, it is helpful to know that the maximum number of results we will fetch before running the visibility checks is 5,000.</p>
  </blockquote>
  
  <p>I am wondering how one would page through public data like this. For example, take Shakira: she gets many, many likes on each photo she uploads, this api call:</p>
  
  <p><a href="https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&amp;limit=1000&amp;offset=0&amp;__after_id=100002349968919">https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&amp;limit=1000&amp;offset=0&amp;__after_id=100002349968919</a></p>
  
  <p>ends up stopping at 5000 likes. </p>
  
  <p><a href="https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&amp;limit=1000&amp;offset=5000&amp;__after_id=100000881924617">https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&amp;limit=1000&amp;offset=5000&amp;__after_id=100000881924617</a></p>
  
  <p>One interesting point is, this data is all public, I do not have to be logged into Facebook to see it. I know there are privacy policies on <em>how</em> you use the data, that is not my question. If the data is public, which this data is, why can't we get it all, and if we can, how?</p>
  
  <p>The main questions are:</p>
  
  <ol>
  <li><p>Can you get more than 5000 results for a specific API call, as in the one above?</p></li>
  <li><p>Is it the most recent 5000 likes? So if you started collecting data on this post right away and then went back every 10 minutes or so to look for new likes, would you be able to get all the data with this method of preventing the 5000 limit?</p></li>
  <li><p>Is it a limit on API calls, or on just the number of results they send one user, or on the amount of results they send back for a certain post, etc.?</p></li>
  <li><p>Does this apply to posts, tagged and the comments and like paging? </p></li>
  </ol>
  
  <p>I know this question is a bit open-ended, but I have looked all over the place for an answer and it is not well documented. Any help would be great, and I think a lot of people may refer to this information in the future.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>When running this API call: </p>
  
  <p><a href="https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&amp;limit=1000&amp;offset=4964&amp;__after_id=100000881924617">https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&amp;limit=1000&amp;offset=4964&amp;__after_id=100000881924617</a></p>
  
  <p>You get back one result, and thus hit the limit (well at least close to it). Someone suggested using FQL and that might return more. But I tried doing the same thing in PHP with FQL and got back only 1 record.</p>
  
  <pre><code>$select = urlencode("SELECT user_id, object_id, post_id FROM like WHERE post_id='5027904559_10150854808869560' LIMIT 1000 OFFSET 4964");
          $fql_query_url = 'https://graph.facebook.com/fql?q=' . $select;
          $fql_query_result = file_get_contents($fql_query_url);
          $fql_query_obj = json_decode($fql_query_result, true);
  </code></pre>
  
  <p><strong>So, so far, the only answer is 'no', you are always limited to 5000 results. And I do not think/know if a specific access_token with some specific permission helps.</strong></p>
  
  <p>One more update, when I go to Shakira's page and click on 'x amount of people like this' and start scrolling down through the list, I also hit a limit. So not only is Facebook limiting the API and FQL returns, they are limiting their own pages.</p>
  
  <p>I would be interested to see if anyone knows why? They only have 5k in cache at a time, and they would not be able to handle the scale if people were hitting the database with so many requests? Just a guess.</p>