Instagram's private API for PHP

dev-master 2018-12-02 10:49 UTC

This package is auto-updated.

Last update: 2024-04-29 04:07:59 UTC


This is Instagram's private API. It has almost all the features the Instagram app has, including media upload, direct messaging, stories and more.

Read the wiki and previous issues before opening a new one! Maybe your issue has already been answered.

Frequently Asked Questions: F.A.Q.

Do you like this project? Support it by donating


  • Paypal Paypal: Donate
  • btc Bitcoin: 1DCEpC9wYXeUGXS58qSsqKzyy7HLTTXNYe


  • Paypal Paypal: Donate
  • btc Bitcoin: 18XF1EmrkpYi4fqkR2XcHkcJxuTMYG4bcv


Using Composer

composer require mgp25/instagram-php
require __DIR__.'/../vendor/autoload.php';

$ig = new \InstagramAPI\Instagram();

If you want to test new and possibly unstable code that is in the master branch, and which hasn't yet been released, then you can use master instead (at your own risk):

composer require mgp25/instagram-php dev-master

I don't have Composer

You can download it here.

Warning about moving data to a different server

Composer checks your system's capabilities and selects libraries based on your current machine (where you are running the composer command). So if you run Composer on machine A to install this library, it will check machine A's capabilities and will install libraries appropriate for that machine (such as installing the PHP 7+ versions of various libraries). If you then move your whole installation to machine B instead, it will not work unless machine B has the exact same capabilities (same or higher PHP version and PHP extensions)! Therefore, you should always run the Composer-command on your intended target machine instead of your local machine.


All examples can be found here.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report any unacceptable behavior.

How do I contribute

If you would like to contribute to this project, please feel free to submit a pull request.

Before you do, take a look at the contributing guide.

Why did I make this API?

After legal measures, Facebook, WhatsApp and Instagram blocked my accounts. In order to use Instagram on my phone I needed a new phone, as they banned my UDID, so that is basically why I made this API.

What is Instagram?

According to the company:

"Instagram is a fun and quirky way to share your life with friends through a series of pictures. Snap a photo with your mobile phone, then choose a filter to transform the image into a memory to keep around forever. We're building Instagram to allow you to experience moments in your friends' lives through pictures as they happen. We imagine a world more connected through photos."


In order help ensure fairness and sharing, this library is dual-licensed. Be aware that all usage, unless otherwise specified, is under the RPL-1.5 license!

You should read the entire license; especially the PREAMBLE at the beginning. In short, the word reciprocal means "giving something back in return for what you are getting". It is not a freeware license. This license requires that you open-source all of your own source code for any project which uses this library! Creating and maintaining this library is endless hard work for us. That's why there is one simple requirement for you: Give something back to the world. Whether that's code or financial support for this project is entirely up to you, but nothing else grants you any right to use this library.

Furthermore, the library is also available to certain entities under a modified version of the RPL-1.5, which has been modified to allow you to use the library without open-sourcing your own project. The modified license (see LICENSE_PREMIUM) is granted to certain entities, at our discretion, and for a limited period of time (unless otherwise agreed), pursuant to our terms. Currently, we are granting this license to all "premium subscribers" for the duration of their subscriptions. You can become a premium subscriber by either contributing substantial amounts of high-quality code, or by subscribing for a fee. This licensing ensures fairness and stimulates the continued growth of this library through both code contributions and the financial support it needs.

You are not required to accept this License since you have not signed it, however nothing else grants you permission to use, copy, distribute, modify, or create derivatives of either the Software (this library) or any Extensions created by a Contributor. These actions are prohibited by law if you do not accept this License. Therefore, by performing any of these actions You indicate Your acceptance of this License and Your agreement to be bound by all its terms and conditions. IF YOU DO NOT AGREE WITH ALL THE TERMS AND CONDITIONS OF THIS LICENSE DO NOT USE, MODIFY, CREATE DERIVATIVES, OR DISTRIBUTE THE SOFTWARE. IF IT IS IMPOSSIBLE FOR YOU TO COMPLY WITH ALL THE TERMS AND CONDITIONS OF THIS LICENSE THEN YOU CAN NOT USE, MODIFY, CREATE DERIVATIVES, OR DISTRIBUTE THE SOFTWARE.

Terms and conditions

  • You will NOT use this API for marketing purposes (spam, botting, harassment, massive bulk messaging...).
  • We do NOT give support to anyone who wants to use this API to send spam or commit other crimes.
  • We reserve the right to block any user of this repository that does not meet these conditions.


This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Instagram or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk.