How to use Instagram API to pull photos based on hashtag

This blog article shows how to utilize the Instagram API to fetch Instagram photos through hastags via navigating various social media accounts. We'll also talk about hashtags in Instagram influencer and marketing campaign and how Phyllo can assist with Instagram API.

Table of Content

Instagram has reached 1 billion users. Businesses and influencers may reach and develop their audiences on it. Hashtag search for searching Instagram photos is strong. It help people identify and publish related content material and promote your own content.

This blog article shows how to utilize the Instagram API to fetch Instagram photos through hastags via navigating various social media accounts. We'll also talk about hashtags in Instagram influencer and marketing campaign and how Phyllo can assist with Instagram API Integration.

Importance of Hashtags in Instagram Influencer Marketing

Here’s why Instagram hashtags are so crucial in the world of influencer marketing:

Reach Out to the Right Audience on Instagram:

  • Instagram page algorithms and users utilise a particular hashtag to identify the most recently published photos based on interests.
  • By using the specific tag and Instagram API, you can connect with users who are looking for ways to promote their brand.
  • Statistics from public data shows that most users are between the ages of 18–24, and they are using specific hashtags to view most popular photos or specific location.

Location-Based Content Becomes Easier:

  • Hashtags enable Instagram algorithms to segment content intended for a specific target audience.
  • By using location-based hashtags, you can promote your products and services in specific areas, districts, and cities. Images that are posted geographically gain better visibility.
  • As a result, when your audience searches for postings in their region, they will come across your stuff.

Cost-Effective Instagram Influencer Marketing:

  • Hiring an Instagram influencer to promote your business allows you to reach millions of users.
  • You can avoid the high costs of traditional advertising methods like billboards.
  • By leveraging hashtags and Instagram API, you can promote your services without having to pay thousands.

How Instagram APIs Can Help You Pull Photos Based on Hashtags with PHP

If you want to retrieve photos from Instagram that have a specific hashtag, you can leverage the Instagram API. Here's a step-by-step guide on how you can accomplish this:

Register as a developer on the Instagram Developer Platform:

Create an app and obtain an app ID and app secret:

  • Create an app on the Instagram Developer Platform and acquire an app ID and app secret. These credentials will be used for authentication purposes.

Authenticate the app and obtain an access token:

  • Make an API request to the Instagram API with your app ID, app secret, and grant type to retrieve an access token. This token will grant you permission to access the API's endpoints.

Utilize the access token to retrieve photos with the specified hashtag:

  • Construct an API request URL using the access token and the desired hashtag.
  • After using access token, send a request to the Instagram API with the constructed URL and receive the response containing the photos.

Here's an example of PHP code that demonstrates how to use the Instagram API to pull photos based on specific hashtag's node:

Requirements, Uses, and Limitations of Hashtag Search

Prerequisites for Hashtag Search

To effectively employ the Hashtag Search on Instagram API, certain criteria must be satisfied:

  1. App Review Approval: The application must be reviewed and granted approval for the Instagram basic permission and the Instagram Public Content Access feature.

Hashtag Search API Endpoints

The Hashtag Search of Instagram API is structured around several primary nodes and edges:

  1. GET /ig_hashtag_search — Utilize this endpoint to obtain a unique node ID for a specific hashtag.
  2. GET /{ig-hashtag-id} — This endpoint delivers data related to a given hashtag.
  3. GET /{ig-hashtag-id}/top_media and GET /{ig-hashtag-id}/recent_media — These endpoints retrieve the most popular and most recently published media respectively, tagged with a specific hashtag.
  4. GET /{ig-user-id}/recently_searched_hashtags — This endpoint identifies the unique hashtags that an Instagram Business or Creator Account has searched for within the current week.

Each endpoint comes with its own set of supported fields, parameters, and usage requirements, outlined in the reference documentation.

Typical Applications of Hashtag Search with Instagram API

Retrieving Media Tagged With A Specific Hashtag

To gather all photos and videos associated with a specific hashtag with Instagram API , start by using the /ig_hashtag_search endpoint. This should include the hashtag in question and the ID of the Instagram Business or Creator Account initiating the query.

For instance, to search for media tagged with "#coke" on behalf of the Instagram Business Account with the ID 17841405309211844, you would perform the following query:

Query

This would return the ID for the "#Coke" hashtag node, which can then be used to query its /top_media or /recent_media edge to obtain a collection of media objects tagged with "#coke". For example:

Returning the ID for the #Coke

Constraints of Hashtag Search

While the Hashtag Search via Instagram API is a powerful tool, it does come with certain limitations:

  • Query Restrictions: An Instagram Business or Creator Account can query a maximum of 30 unique hashtags within a rolling, 7-day period. Once a hashtag is queried, it counts towards this limit for 7 days. Repeated queries of the same hashtag within this period do not impact the limit or reset the 7-day timer.
  • Data Privacy: Responses will not contain personally identifiable information.
  • Interaction Limitations: Users are not permitted to comment on hashtagged media objects discovered via the Instagram API.
  • Unsupported Features: Hashtags on Stories, and emojis in hashtag queries, are not supported by the Instagram API.
  • Content Moderation: The Instagram API will return a generic error for requests containing hashtags deemed sensitive or offensive.

Understanding these prerequisites, application possibilities, and constraints of the Hashtag Search API allows for its effective and responsible usage.

Recommended Read: How To Add Instagram API To Your App Or Website?

How Can Phyllo Help with Instagram API to pull photos based on hashtag

Phyllo, with its simple and efficient approach to creator data, facilitates streamlined integration with multiple social media platforms. As an advanced product, Phyllo eliminates the need for developers to individually establish connections with diverse platforms like YouTube, TikTok, Patreon, Spotify, and Instagram. Instead, it offers scalable and trustworthy integrations, enabling developers to work with a single, easy-to-integrate API. Phyllo can provide a wealth of creator data, including:

Phyllo Connect SDK for Instagram: Empowering the Creators

Phyllo Connect SDK for Instagram

Phyllo Connect SDK aims to foster trust among creators by educating them about the connection process, Phyllo's role, and the account information collected post-login. It commits to full transparency and seeks user consent before sharing details with the company. It also provides users with control over their connected account with an option to disconnect at any point.

Overcoming Challenges with Instagram Login Flows : While some platform login flows are seamless, like Twitter, others like Instagram can be more challenging. Instagram login requires connection via Facebook and a professional Instagram account linked to a Facebook page. Phyllo handles these requirements by educating creators before and after login, enhancing connection success rates for Instagram.

Instagram Stories and Graph APIs: Instagram stories represent a leading content format. Unfortunately, their engagement metrics are not publicly accessible and cannot be obtained through third-party scrapers. However, Instagram's Graph APIs, which are covered by Phyllo, provide these metrics, enabling Phyllo to deliver engagement data for photos posted to Instagram Stories. Learn More everything you need to know on Instagram Scraping

Related Read: Instagram Engagement Metrics: Why You Shouldn’t Miss These

Phyllo vs. Third-Party Aggregators for Instagram Data

Instagram's Graph API provides Phyllo with high-quality creator data. It complements the platform and provides a better data flow than data scraping. Phyllo surpasses third-party aggregators with 24 hours or fewer refresh frequency. Webhooks for real-time creator data updates and Instagram APIs for audience data eliminate the need for approximations.

Building Features Using Instagram user Data

Businesses can use creator data of Instagram app in myriad ways to create impressive products. Here are some examples:

  • Automated Verification: Phyllo provides a consented data pipeline that helps creators in Instagram app authenticate their identity and allows developers access to verify a creator's identity, income, and engagement across multiple platforms.
  • Influencer Marketing: Brands can utilize Phyllo's Identity API to access creators' profile-level information, followers, subscribers, and other reputation metrics. This helps them assess a creator's value and ensures they collaborate with trusted creators rather than fraudsters.
  • Creator Tools: Phyllo's data pipeline aids in resolving identity issues on creator tools platforms, ensuring fans can confidently engage with their favorite creators.
  • Fintech: Phyllo's data can be used to authenticate a creator's identity, enabling fintech companies to extend financial services to the right individuals.
  • Web3: By verifying NFT creators' identities and reputations, Phyllo ensures fans are purchasing from genuine artists, thereby enhancing the overall trust in the web3 ecosystem.

Also read: How Beacons uses Phyllo to create the perfect media kit for creators to be successful

Conclusion

Hashtags are crucial for influencer marketing, enhancing content discovery and audience engagement. Instagram APIs allow businesses to pull photos based on these hashtags, providing valuable, marketing insights too. However, understanding the API's requirements and limitations is essential. Phyllo, an integrative tool, simplifies this process by providing a single API that accesses creator data across various social media platforms, including Instagram. By leveraging hashtags, Instagram APIs, and integrative tools like Phyllo, businesses and creators can maximize their Instagram marketing strategies' effectiveness and reach.

Related Read:


Adarsh Agarwal
Prod. Marketing @ Phyllo

Be the first to get insights and updates from Phyllo. Subscribe to our blog.

Ready to get started?

Sign up to get API keys or request us for a demo