How Does Instagram’s GET/tags//media/recent Pagination Actually Work?

To get the newest set of grams for a particular tag, use this:

https://api.instagram.com/v1/tags/latergram/media/recent?access_token=TOKEN

From that response, you can get newer grams from the same tag by taking the min_tag_id from the response (under pagination) and build a url like so:

https://api.instagram.com/v1/tags/latergram/media/recent?access_token=TOKEN&min_tag_id=1387332980547

Or you can get the next (older) set of grams by using the next_url parameter from the original response (also under pagination), which looks like:

https://api.instagram.com/v1/tags/latergram/media/recent?access_token=TOKEN&max_tag_id=1387332905573

Make sure your subsequent queries (for new grams of a particular tag) are using the min_tag_id returned by the latest response. I did a few tests and didn’t see duplicates, however I was using #latergram and that one has a high volume of posts

Leave a Comment