Cover image for 💡 Quick tip: Fetch JSON data from a public Instagram profile without Graph API

💡 Quick tip: Fetch JSON data from a public Instagram profile without Graph API

elvticc profile image Benjamin Grand ・1 min read

I hate Instagram's Graph API for its complex configuration...

Thanks to a Google search, I discovered a magic query string to use with the official Instagram website:


Using the query string __a=1 allows you to fetch the JSON content of any public Instagram profile.

Below is one of the solutions with JavaScript:

async function getInstagramPictures (profileName) {
  const baseUrl = "https://www.instagram.com";
  const profileUrl = `${baseUrl}/${profileName}`;
  const jsonDataUrl = `${profileUrl}/?__a=1`;

  const response = await fetch(jsonDataUrl);
  const jsonData = await response.json();
  const pictures = jsonData.graphql.user.edge_owner_to_timeline_media.edges;

  if (response.ok) {
    return pictures;
  } else {
    throw new Error(pictures);
  .then(pictures => console.log("Pictures:", pictures))
  .catch(error => console.error("Error:", error));

By looping pictures, you can display each image or its thumbnails:

  • picture.node.display_url
  • picture.node.thumbnail_resources
    • [0].src = 150x150
    • [1].src = 240x240
    • [2].src = 320x320
    • [3].src = 480x480
    • [4].src = 640x640


Posted on by:


Editor guide

From my experience, this only works if you have recently logged into an Instagram account with the same IP address. But mostly does not work from a server/proxy.


❌ Unfortunately, this quick tip no longer works today...

If someone knows a good tutorial for using the Graph API, I am interested...


It does seem to be useable again strange.


✔️ Welcome back!