canonical: https://jentic.com/apis/instagram.com/instagram

# Instagram API

Query and interact with Instagram content through 27 endpoints covering media, users, tags, locations, comments, and likes. Supports searching for media by geographic coordinates and hashtags, retrieving user feeds and relationship data, and moderating comments on media posts. Provides OAuth 2.0 implicit flow for user authorization with granular scopes for read and write access.

## For AI agents

Retrieve Instagram media, search by hashtag or location, manage user relationships, and moderate comments. Covers 27 endpoints for user content and social interactions.

## Scope

Does not handle media publishing, Instagram Stories, Reels, or ad management - use for reading content, comments, and user data only.

## Capabilities

- Search for media by geographic coordinates within a radius or by hashtag
- Retrieve a user's feed, liked media, and follower/following relationships
- Fetch individual media objects with full metadata, comments, and like counts
- Post and delete comments on media items with authenticated user context
- Look up locations by geographic coordinates and retrieve location-tagged media
- Follow, unfollow, and check relationship status between users
- Browse trending and popular media across the platform

## Use cases

### AI Agent Hashtag Monitoring

An AI agent tracks media posted with specific hashtags by calling /tags/{tag-name}/media/recent, analyzing engagement patterns and content volume over time. Through Jentic, the agent discovers the hashtag media endpoint by searching 'find instagram posts by hashtag', loads the schema with pagination parameters, and executes without manual API configuration. Returns media objects with like counts, comment counts, and user attribution.

Example prompt: Retrieve the 20 most recent media posts tagged with 'travel' via GET /tags/travel/media/recent and return each post's like count and comment count

### Location-Based Media Discovery

Search for Instagram media posted near specific geographic coordinates using /media/search with lat and lng parameters, or find locations via /locations/search and then retrieve their recent media. Supports radius filtering in meters and returns media with full metadata including timestamps, captions, and engagement counts.

Example prompt: Search for media posted within 1000 meters of latitude 40.7128, longitude -74.0060 via GET /media/search?lat=40.7128&lng=-74.0060&distance=1000

### User Profile and Relationship Analysis

Retrieve user profiles via /users/{user-id} including media count, follower count, and following count. Check relationship status between users with /users/{user-id}/relationship and retrieve follower/following lists for social graph analysis. Supports pagination for large follower lists.

Example prompt: Retrieve the profile for user-id 12345 via GET /users/12345 and then fetch their follower list via GET /users/12345/followed-by

### Comment Moderation and Engagement

Monitor comments on media posts using GET /media/{media-id}/comments and remove inappropriate content with DELETE /media/{media-id}/comments/{comment-id}. Post replies and new comments via POST /media/{media-id}/comments. Enables automated moderation workflows for brand accounts managing high-volume comment sections.

Example prompt: Retrieve all comments on media-id 67890 via GET /media/67890/comments and delete comments containing blocked keywords via DELETE /media/67890/comments/{comment-id}

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /users/{user-id} | Retrieve a user's profile information |
| GET | /users/self/feed | Get the authenticated user's feed |
| GET | /media/search | Search for media by location |
| GET | /tags/{tag-name}/media/recent | Get recent media by hashtag |
| GET | /media/{media-id}/comments | List comments on a media item |
| POST | /media/{media-id}/comments | Post a comment on media |
| GET | /locations/search | Search for locations |
| GET | /users/{user-id}/followed-by | List a user's followers |

## Key resources

- **Users** — Retrieve profiles, relationships, feeds, and follower data
- **Media** — Search, retrieve, and interact with photo and video posts
- **Comments** — List, create, and delete comments on media items
- **Likes** — Retrieve and toggle likes on media posts
- **Tags** — Search hashtags and retrieve tagged media
- **Locations** — Search locations and retrieve location-tagged media

## Why Jentic

- **Setup:** Wiring the Instagram API by hand means choosing between an access_token query parameter and the OAuth 2.0 flow, then mapping its read endpoints on the api.instagram.com/v1 host yourself. Through Jentic you install once, import the Instagram API from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** This API is read-focused, exposing user, media, tag, and location lookups, so limit the agent to the operations it needs, such as fetching recent media for a tag or reading comments. You choose which operations are allowed, so posting a comment is not included unless you add it.
- **Credential handling:** Your Instagram access token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'search Instagram posts by hashtag', and Jentic returns the matching recent-media operation with its input schema so the agent constructs valid requests without reading Instagram's developer docs.

## Related APIs

- **Facebook Graph API** — Parent platform's API providing Instagram Business account management and media publishing capabilities
- **Pinterest API** — Visual discovery platform focused on pinning and organizing images into thematic boards
- **Twitter API v2** — Text-first social platform with real-time search and streaming for public conversations

## FAQ

### What authentication does the Instagram API use?

The Instagram API supports two authentication methods: OAuth 2.0 implicit flow for user-authorized requests (accessing feeds, posting comments) and an API key passed as an access_token query parameter for client-level access. The OAuth flow grants scopes like basic, comments, relationships, and likes. Through Jentic, these credentials are stored encrypted in your Jentic One instance - agents receive scoped tokens without handling raw client secrets.

### Can I search for Instagram media by hashtag?

Yes. Use GET /tags/{tag-name}/media/recent to retrieve the most recent media tagged with a specific hashtag. The response includes media objects with image URLs, captions, like counts, comment counts, and the posting user's information. Pagination is handled via the max_tag_id parameter for retrieving older results.

### What are the rate limits for the Instagram API?

The Instagram API enforces a limit of 200 requests per hour per access token for sandbox mode applications. Approved live applications have higher limits that vary by endpoint. Rate limit information is returned in response headers (X-Ratelimit-Remaining, X-Ratelimit-Limit) with each API call.

### How do I find media near a specific location through Jentic?

Install the Jentic SDK with pip install jentic, then search for 'search instagram media by location'. Jentic returns the GET /media/search operation with its schema showing required lat and lng parameters plus optional distance (default 1000m, max 5000m). Load the schema and execute with your coordinates. Get started with Jentic One, the self-hosted execution layer.

### Can I moderate comments on Instagram posts?

Yes. Retrieve comments with GET /media/{media-id}/comments, post new comments with POST /media/{media-id}/comments (requires comments scope), and delete your own comments with DELETE /media/{media-id}/comments/{comment-id}. The comments scope must be granted during OAuth authorization for write operations.

### Does the Instagram API support posting new media?

This version of the Instagram API (v1) does not support uploading new photos or videos. It provides read access to media, comments, likes, and user data, plus write access for comments and likes. Media publishing requires the Instagram Graph API (accessed through the Facebook Graph API platform) with specific business account permissions.

### Can I limit what my agent is allowed to do with the Instagram API?

Yes. Because you run Jentic One yourself, you decide which Instagram operations your agent may call, so you can allow only the read endpoints it needs, such as fetching recent media for a hashtag with GET /tags/{tag-name}/media/recent or reading comments with GET /media/{media-id}/comments. Write actions like posting a comment via POST /media/{media-id}/comments stay out of reach unless you explicitly add them. Your own rules also govern which stored credential the agent uses, so its scoped access token is only applied to the operations you permit.
