IOS developer based in barcelona.

Get data from Instagram's private API

A few weeks ago, I learned how to retrieve data from Instagram's private API. How? I was diving into the app store, searching apps that were using Instagram public API (apparently). Curiously some of them directly didn't use a token to retrieve information: basic user profile, media, relationships... they were pointing to (this endpoint wasn't on 

So I used Charles Proxy to dive into more detail. I configured my iPhone to use Charles as its HTTP proxy. Then I chose one random app, which uses that "Instagram API", and I saw some api calls. One of them was the following one:

The endpoint retrieves Instagram stories from your followers, 

Screen Shot 2017-07-27 at 19.04.52.png

As I said before, the host is, and another important thing is they use cookies to authenticate users.

If you want to retrieve information from Instagram's private API, you need two cookies, ds_user_id and sessionId. If you "inject" these two cookies in every request, you can create another Instagram app with awesome features 😃.

If you don't trust me, you can open Postman, and try it! 

With Postman you can generate code snippets, so you can export this api call into other languages, like Swift 😎. You only need to tap on Code and select the language

Then copy & paste the resulted code in a Playground or in your Xcode project, and try it!

[UPDATE] If you want to know another api calls, open your Instagram app and use Charles Proxy. You will see all api calls used in Instagram app.

I'm all ears to know your feedback, thanks for reading! 😃

Command-line scripts in Swift - Swift Package Manager

Playgrounds - great for prototyping views