Instagram Post Info API: Extract Complete Post Details
Need detailed information about a specific Instagram post or Reel? The Post Info API returns comprehensive data including engagement metrics, media URLs, and metadata.
What Data Can You Extract?
| Field | Description |
|---|---|
id | Unique post identifier |
shortcode | URL-friendly code |
__typename | XDTGraphVideo, XDTGraphImage, XDTGraphSidecar |
edge_media_to_caption | Caption text |
edge_media_preview_like.count | Like count |
edge_media_to_parent_comment.count | Comment count |
video_play_count | View/play count (reels) |
video_url | Video URL |
display_url | Image URL |
owner | Creator profile info |
clips_music_attribution_info | Audio info (reels) |
video_duration | Video length in seconds |
edge_media_to_tagged_user | Tagged accounts |
Using the Post Info API
const response = await fetch(
'https://api.sociavault.com/v1/scrape/instagram/post-info?url=https://www.instagram.com/p/DMA4eb1RC0D/',
{
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY'
}
}
);
const result = await response.json();
const post = result.data.data.xdt_shortcode_media;
You can also pass trim=true to get a smaller response.
Sample Response
The response nests the post data under data.data.xdt_shortcode_media:
{
"success": true,
"data": {
"success": true,
"data": {
"xdt_shortcode_media": {
"__typename": "XDTGraphVideo",
"id": "3675185678007938307",
"shortcode": "DMA4eb1RC0D",
"is_video": true,
"video_url": "https://instagram.ftlv1-1.fna.fbcdn.net/...",
"video_play_count": 3884542,
"video_duration": 8.466,
"display_url": "https://instagram.fhfa1-1.fna.fbcdn.net/...",
"dimensions": { "height": 1923, "width": 1080 },
"edge_media_preview_like": { "count": 504393 },
"edge_media_to_parent_comment": {
"count": 1016,
"edges": {
"0": {
"node": {
"id": "17960408019046201",
"text": "❤️❤️❤️❤️🔥👏",
"created_at": 1768932394,
"owner": { "username": "danial.rahbar11", "is_verified": true }
}
}
}
},
"edge_media_to_caption": {
"edges": {
"0": {
"node": {
"text": "You can see this moment however it resonates with you!🫶🏼"
}
}
}
},
"owner": {
"id": "270702400",
"username": "asal_st",
"full_name": "Asal Torabi",
"is_verified": true,
"edge_followed_by": { "count": 98538 },
"edge_owner_to_timeline_media": { "count": 374 }
},
"clips_music_attribution_info": {
"artist_name": "asal_st",
"song_name": "Original audio",
"audio_id": "1116742380300508"
},
"edge_media_to_tagged_user": {
"edges": {
"0": {
"node": {
"user": { "username": "farnoushsalimian", "full_name": "Farnoush Jajjo" }
}
}
}
},
"product_type": "clips"
}
}
},
"credits_used": 1,
"endpoint": "instagram/post-info"
}
Key fields under data.data.xdt_shortcode_media:
- Caption:
edge_media_to_caption.edges[0].node.text - Likes:
edge_media_preview_like.count - Comments:
edge_media_to_parent_comment.count - Views:
video_play_count(reels/video only) - Video URL:
video_url - Image URL:
display_url - Author:
owner.username - Audio:
clips_music_attribution_info(reels only)
Use Cases
Engagement Analysis
Calculate engagement rate for specific posts:
async function getPostInfo(url) {
const res = await fetch(
`https://api.sociavault.com/v1/scrape/instagram/post-info?url=${encodeURIComponent(url)}`,
{ headers: { 'x-api-key': 'YOUR_API_KEY' } }
);
return res.json();
}
const result = await getPostInfo('https://www.instagram.com/p/DMA4eb1RC0D/');
const post = result.data.data.xdt_shortcode_media;
const likes = post.edge_media_preview_like.count;
const comments = post.edge_media_to_parent_comment.count;
const followers = post.owner.edge_followed_by.count;
const engagementRate = ((likes + comments) / followers) * 100;
console.log(`Engagement rate: ${engagementRate.toFixed(2)}%`);
Track Viral Content
Monitor post performance over time:
async function trackPost(url) {
const result = await getPostInfo(url);
const post = result.data.data.xdt_shortcode_media;
await saveSnapshot({
postId: post.id,
likes: post.edge_media_preview_like.count,
comments: post.edge_media_to_parent_comment.count,
views: post.video_play_count || 0,
timestamp: new Date()
});
}
// Track every hour
setInterval(() => trackPost(targetUrl), 60 * 60 * 1000);
Extract Media URLs
Download post images/videos:
const result = await getPostInfo(url);
const post = result.data.data.xdt_shortcode_media;
if (post.is_video) {
console.log('Video URL:', post.video_url);
console.log('Duration:', post.video_duration, 'seconds');
console.log('Plays:', post.video_play_count);
} else {
console.log('Image URL:', post.display_url);
console.log('Dimensions:', post.dimensions);
}
Reel Audio Analysis
Check audio details for reels:
const result = await getPostInfo(reelUrl);
const post = result.data.data.xdt_shortcode_media;
if (post.clips_music_attribution_info) {
const audio = post.clips_music_attribution_info;
console.log(`Audio: "${audio.song_name}" by ${audio.artist_name}`);
console.log(`Original audio: ${audio.uses_original_audio}`);
}
Related Endpoints
- Instagram Posts Scraper - All posts from a profile
- Instagram Comments - Get post comments
- Instagram Reels API - Profile reels
- Instagram Transcript - Video transcripts
Frequently Asked Questions
Can I use the post shortcode instead of URL?
Yes, you can construct the URL from the shortcode: https://www.instagram.com/p/{shortcode}/
What's the difference between views and plays for Reels?
Views typically count unique viewers, while plays count total playbacks (including repeats).
Can I get data from private account posts?
No, only publicly accessible posts can be scraped. Private accounts restrict access.
Are Instagram Stories supported?
No, Stories are temporary and handled differently. Use the Highlights endpoint for saved story content.
How do I get carousel images in order?
The media array is returned in the order displayed in the carousel, from first to last slide.
Get Started
Sign up free and start extracting Instagram post data.
API documentation: /docs/api-reference/instagram/post-info
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.