Unfortunately, Instagram stopped many of its APIs, including the ones that require authentication. It states in https://www.instagram.com/developer/:
To continuously improve Instagram users privacy and security, we are
accelerating the deprecation of Instagram API Platform, making the
following changes effective immediately.
Some links explaining the details and causes of these changes:
Some unofficial crawling methods have been proposed in (suggested by @Louis B.) https://stackoverflow.com/a/49906525/278840. You should take into consideration that these methods are being transformed each week. Therefore, I definitely prefer to use the private API.
Update 2018:
The old public API (without auth) is working again. We can access by adding ?__a=1
to the end of a profile url, like this:
https://www.instagram.com/leomessi/?__a=1
Update June 2022
The old API ?__a=1 has stopped working again. It seems to be due to an error. The page redirects to the login page as a guest. If you open it after logging in, it shows a weird error:
for (;;);{"__ar":1,"error":1357004,"errorSummary":"Sorry, something went wrong","errorDescription":"Please try closing and re-opening your browser window.","payload":null,"hsrp":{"hblp":{"consistency":{"rev":1005648797}}},"lid":"7106751273377983967"}
Update September 2023
The following link works and returns json (both parameters are required)
https://www.instagram.com/leomessi/?__a=1&__d=dis