17

I'd like to ask if there is any way to get thumbnail image for media returned from Instagram Graph API? I can get an image URL by using following endpoint: /{InstagramUserId}/media?fields=media_url

However it only returns one size. Old Instagram API returned various sizes like low_resolution, thumbnail, standard_size. Is it possible to get similar result by using Instagram Grahp API?

Krystian
  • 996
  • 9
  • 24
  • 1
    i'm also interested in this. – Francois Oct 04 '18 at 00:24
  • 1
    @Francois I received info from Facebook team that currently it is not possible. They advice to store the picture on your side and create thumbnails via ImageMagick:/ – Krystian Oct 08 '18 at 19:37
  • Thanks for posting an update. How did you get hold of FB team to ask btw? – Francois Oct 09 '18 at 20:05
  • 2
    @Francois I created a ticket via https://developers.facebook.com/support/ :) – Krystian Oct 10 '18 at 14:25
  • I would really love to have image dimensions at the least for the thumbnail. Does anyone know how in the Graph API to do this? – Michael Giovanni Pumo Jul 12 '19 at 13:26
  • 2
    I would also like this ability. Seems like this is a step back for the api. – joeshmoe301 Sep 30 '19 at 19:56
  • i too need a solution for this, if anyone know kindly update. – Sathish Sundar Jan 14 '20 at 11:42
  • I have been trying to get instgram api setup to fetch media from public accounts ( for example footballers) in order to get notified in real-time if someone has posted something. Have you been ae to do anything like that? – akshay pai Mar 11 '20 at 17:29
  • @akshaypai Probably you can try https://developers.facebook.com/docs/instagram-api/guides/business-discovery with webhooks, but not really sure if your use case will pass the App Review. For real time notification I would suggest looking at Webhooks:) – Krystian Mar 12 '20 at 17:57
  • The webhooks currently are only for notifying if there is a like or comment, no webhooks for media and whatever instagram used to provide will be shut by end of March 2020, so there is no use implementing that either – akshay pai Mar 15 '20 at 06:26
  • Quick question, how did you get signed up to use the Insta Graph API? Did you have to submit your app for review first? – Akash Kundu Dec 23 '20 at 23:21

2 Answers2

19

After searching for some time to a solution i finally found one.

So, include in the fields query string the permalink field and it should give as following (Sorry, for using Kim Kardashian as an example):

https://www.instagram.com/p/CAYDz52gSLh

then append this at the end media?size=t or simply media like this:

https://www.instagram.com/p/CAYDz52gSLh/media?size=t

  • media?size=t will give a 150x150 px image
  • media?size=m will give a 320x320 px image
  • media?size=l will give a 1080x1080 px image
Alvin Konda
  • 2,898
  • 1
  • 22
  • 22
  • 4
    The problem with this is that `media?size=[x]` returns a redirect link so can't include this in an ``unfortunately. The Instagram API is very difficult to work it. Hoping the fb team would update it. – Sha Dec 02 '20 at 14:15
  • Now, when reel and tv videos are there, it doesn't work with those videos. Plus, if you include it in the browser, it will check for CORS before plugging the thumbnail. – Jamshaid K. Jul 10 '22 at 23:07
0

I can not find a way to get the thumbnails in one step. But in the next step after receiving the data, the thumbnail of each image and video can be found in this way using oEmbed:

https://graph.facebook.com/v9.0/instagram_oembed?url={permalink}&maxwidth=320&fields=thumbnail_url,author_name,provider_name,provider_url&access_token={accessToken}

permalink: The url received from the previous stage (business_discovery)

Example:

https://graph.facebook.com/v9.0/instagram_oembed?url=https://www.instagram.com/p/CBOuPY1AcMQ/&maxwidth=320&fields=thumbnail_url,author_name,provider_name,provider_url&access_token={accessToken}

More Details

Tiam
  • 27
  • 5