Retrieve Instagram posts, captions, and engagement metrics programmatically. Get a user's media feed with likes, comments, and post metadata in structured JSON.
Get Free API Key →Pass a public Instagram username and get its media feed as JSON. The documented username endpoint handles the profile lookup and media request for you.
# Get recent posts for a public Instagram username curl -H 'Authorization: Bearer gs_your_api_key' \ 'https://gramscraper.com/api/instagram/v1/user/medias/by/username?username=instagram'
import requests url = "https://gramscraper.com/api/instagram/v1/user/medias/by/username" headers = {"Authorization": "Bearer gs_your_api_key"} params = {"username": "instagram"} response = requests.get(url, headers=headers, params=params) response.raise_for_status() print(response.json())
const response = await fetch( 'https://gramscraper.com/api/instagram/v1/user/medias/by/username?username=instagram', { headers: { 'Authorization': 'Bearer gs_your_api_key' } } ); if (!response.ok) throw new Error(`HTTP ${response.status}`); console.log(await response.json());
A media item can include fields like these. The enclosing response and available fields depend on the post type and current API schema.
{
"id": "...",
"media_type": 1,
"code": "...",
"caption_text": "Example caption",
"like_count": 123,
"comment_count": 12,
"taken_at": "2026-08-16T12:00:00Z",
"thumbnail_url": "https://..."
}
id
Unique post identifier
media_type
1 = image, 2 = video, 8 = carousel
code
Post shortcode (for URL)
caption_text
Full post caption
like_count
Number of likes
comment_count
Number of comments
taken_at
Post timestamp
thumbnail_url
Thumbnail URL when supplied
video_url
Video URL when supplied
user
Post author details
resources
Child resources for multi-item media
product_type
Instagram media product type
Use GramScraper's /v1/user/medias/by/username endpoint. Pass a public Instagram username and receive that user's media feed as JSON.
The API returns post captions, like counts, comment counts, media type (image, video, or carousel), media URLs at multiple resolutions, timestamps, shortcodes, and author information.
The API returns publicly available posts from public Instagram accounts. Posts from private accounts are not accessible via the API.
Start with 100 free credits. Standard adds 15,400 credits for $29.
Get Free API Key →