How to Scrape Instagram User Posts And Media
This tutorial shows how to use Instagram User Posts And Media API to scrape and crawl structured Instagram data in real-time.
Extract full Instagram post feeds for any public account including captions, media URLs, like counts, and comment totals, useful for content benchmarking and competitive research.
Access Instagram Data in 3 Steps
Start crawling Instagram user posts data. Follow these steps to extract social media data in minutes.
Create Your Account
Go to our registration page and make an account. It's free, no credit card, and you get credits right away to play around with.
Verify Your Email Address
You'll get a verification email, click the link in it. Once that's done, you can grab your API token from the dashboard.
Make Your First API Call
Copy the code snippet below, swap in your API key, and run it. You'll get Instagram data back as JSON within a few seconds.
Code Sample
Here's a JavaScript example to get you going. Swap out the token and you're good, works the same way in any language that can make HTTP requests. Start collecting user posts data via our REST API!
| 1 | const root = 'https://ensembledata.com/apis' |
| 2 | const endpoint = '/instagram/user/posts' |
| 3 | const params = { |
| 4 | "user_id": 18428658, |
| 5 | "depth": 1, |
| 6 | "oldest_timestamp": 1666262030, |
| 7 | "chunk_size": 10, |
| 8 | "start_cursor": "", |
| 9 | "alternative_method": false, |
| 10 | "token": "YOUR-TOKEN-HERE" |
| 11 | } |
| 12 | |
| 13 | const queryString = new URLSearchParams(params).toString(); |
| 14 | const url = `${root}${endpoint}?${queryString}`; |
| 15 | |
| 16 | await fetch(url) |
| 17 | .then(response => response.json()) |
| 18 | .then(data => console.log(data)) |
| 19 | .catch(error => console.error(error)); |
| 20 |
Parameters
Example Response
Explore the fields returned by this endpoint. Click a row to expand nested objects and arrays, hover a value to copy it, or use "Expand all" to see everything at once.
dataobject3 fields
postsarray1 item · schema from #0 1 item
nodeobject39 fields
sharing_friction_infoobject2 fields
dimensionsobject2 fields
display_resourcesarray3 items · schema from #0 3 items
edge_media_to_tagged_userobject1 field
edgesarray0 items
edge_media_to_captionobject1 field
edgesarray1 item · schema from #0 1 item
nodeobject1 field
edge_media_to_commentobject2 fields
page_infoobject2 fields
edge_media_to_sponsor_userobject1 field
edgesarray0 items
edge_media_preview_likeobject2 fields
edgesarray0 items
ownerobject2 fields
thumbnail_resourcesarray5 items · schema from #0 5 items
coauthor_producersarray0 items
pinned_for_usersarray0 items
edge_sidecar_to_childrenobject1 field
edgesarray6 items · schema from #0 6 items
nodeobject17 fields
sharing_friction_infoobject2 fields
dimensionsobject2 fields
display_resourcesarray3 items · schema from #0 3 items
edge_media_to_tagged_userobject1 field
edgesarray0 items
Response Codes
Status codes this endpoint can return, so you can handle errors before they surprise you in production.
API Pricing
Fetch Instagram Data at Scale
Collect Instagram posts in bulk for trend analysis, content benchmarking, or building datasets for academic or industry research.
Full Post History
Paginate through a creator's entire public Instagram feed history.
Captions & Media
Get captions and direct media URLs returned for every post.
Engagement Stats
Pull like and comment counts for each post automatically.