Lately, I have been working with Instagram API to build a social networking website where I used many of its features including showing public images under a specific #hashtag.

The hashtag is a brilliant social media feature, which is already being used in all major social networking websites including Facebook and Twitter. In this post, you will see how we can grab all images from Instagram with a specific hashtag using its API and PHP.

Step 1:

Each API needs registration before you can use its features. Please note, for showing images under a specific hashtag, we don’t need any authentication but for connecting to Instagram API we do need client ID and client secret keys which we will get once we will register an app on the Instagram API platform.

So our first step will be to register an app on the Instagram API page and click on the “Register Your Application” button.


Step 2:

The next page is the Manage Clients page, where we need to add a client to get the required authentication keys, i.e. Client ID and Client Secret. Please click on the “Register New Client” button to see the client registration form.


Step 3:

In this form, we will provide an app name that should represent your website or company name for easily understandable for the end users. I used the “99Points Hashtag” here as an example. Provide a short but clear description to let the user know what is this app for. Add website and redirect URL. Both URLs can be the same as we don’t need them here for showing the images only. Enter the information and click on the “Register” button.


Step 4:

The next screen shows the success message with the Client ID and Client Secret keys which we will use in our last step.


Step 5:

Finally, we have created the app on Instagram, and now its PHP-Action-Time. The below API URL is a direct way to bring all the images having a specific hashtag. It takes the hashtag and client ID which we already have above and then it brings the results in JSON format. Is it not easy?

Similar Posts


  1. Hi, thanks for the share.

    Do you have a video or pictures of the end result?

    How would this integrate with wordpress using the genesis theme and child theme?

    Also, ive noticed that instagram feeds affects the speed of the internet. I use google page speed insights. Will performance be affected?

    Thanks heaps :)

  2. Hello,

    Thanks for the share this code

    I have tested in my wordpress site and it’s work but when i code put in server so it’s not work

    echo ‘

    when i run above code give a null value any idea what's error. Also i have checked server config
    cURL is Enable
  3. Fini, ne marche plus, il faut que Instagram valide l’utilisation par une soumission !!! N’importe quoi…

  4. Hi there,

    I am using your tutorial and now i get this error

    [pagination] => Array
    [deprecation_warning] => next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead

    [meta] => Array
    [code] => 200

    [data] => Array


  5. It is a real problem of the API. You need your application out of the Sandbox state and do it alone hiring intermediaries so they can rid your app.
    Says clearly Instagram:

    “This use case is not supported. We do not approve the public_content permission for one-off projects such as displaying hashtag based content on your website. As alternative solution, you can show your own Instagram content, or find a company that offers this type of service (content discover, moderation, and display).

    You can find more information in the Permission Review documentation.”

  6. Instagram recently started showing view counts on videos. Is there any way to pull this data from the API?

    I checked some mobile IOS APP’s that provide total video view counts

    for example: IOS Mobile APP 6000 Followers

  7. how to get hashtag from Instagram ..I need to grape another user command and get user profile pic as well as command ….

    please tell me how its possible

    i am successfully fetch all my profile records here..but try to fetch another user records

    please help me

  8. error come “Array ( [meta] => Array ( [error_type] => OAuthAccessTokenException [code] => 400 [error_message] => The access_token provided is invalid. ) )”
    can any one explain me what happen

  9. Array ( [meta] => Array ( [error_message] => The access_token provided is invalid. [error_type] => OAuthAccessTokenException [code] => 400 ) )

  10. The error message says “The access_token provided is invalid”. To get rid of that you have to uncheck “Disable implicit OAuth” in the Security tab of your client.

Comments are closed.