Support needed? Reach out! ๐Ÿ“ง

How to Scrape Instagram Post Comments

This tutorial shows how to use Instagram Post Comments API to scrape and crawl structured Instagram data in real-time.
Collect Instagram comment threads in bulk including commenter usernames, text, timestamps, and reply counts for sentiment and community research.

Access Instagram Data in 3 Steps

Start crawling Instagram post comments data. Follow these steps to extract social media data in minutes.

1

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.

2

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.

3

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 post comments data via our REST API!

javascript-logo JavaScript
Instagram Post Comments
1 const root = 'https://ensembledata.com/apis'
2 const endpoint = '/instagram/post/comments'
3 const params = {
4   "media_id""3511510130787749851",
5   "cursor""",
6   "sorting""popular",
7   "token""YOUR-TOKEN-HERE"
8 }
9  
10 const queryString = new URLSearchParams(params).toString();
11 const url = `${root}${endpoint}?${queryString}`;
12  
13 await fetch(url)
14   .then(response => response.json())
15   .then(data => console.log(data))
16   .catch(error => console.error(error));
17  

Parameters

media_id (integer) Media ID can be found using the other APIs. REQUIRED
cursor (string) Parameter to manually handle pagination. Each response contains a `nextCursor` which can be used to retrieve the next page of results by sending it as the next `cursor`. If the `nextCursor` is not present in the response, it means that there are no more results to retrieve. REQUIRED
sorting Fetch TOP comments (only 15 allowed) OR RECENT (start from most recent and iterate) REQUIRED
token (string) Private token assigned to each client to access the APIs. REQUIRED

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.

JSON
Instagram Post Comments
dataobject2 fields
commentsarray1 item ยท schema from #0 1 item
nodeobject13 fields
pkstring"18079390237903009"
userobject7 fields
is_verifiedbooleanfalse
idstring"64490093540"
pkstring"64490093540"
is_unpublishednullnull
profile_pic_urlstring"https://scontent-scl2-1.cdninstagram.com/v/t51.2885-19/522369108_17915โ€ฆ"
usernamestring"zeeshankhan_abbasi6"
fbid_v2string"17841464486221261"
is_coveredbooleanfalse
child_comment_countnumber0
restricted_statusnullnull
has_translationnullnull
has_liked_commentnullnull
textstring"๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ"
giphy_media_infonullnull
created_atnumber1754086530
parent_comment_idnullnull
comment_like_countnullnull
__typenamestring"XDTCommentDict"
cursorstring""
nextCursorstring"{\"server_cursor\": \"QVFEZC01eGxyeUlfUXFfRU5VNHNJcFlFZkxNODl1bFh3clBXโ€ฆ"

Response Codes

Status codes this endpoint can return, so you can handle errors before they surprise you in production.

200SuccessSuccessful Response
422Client ErrorValidation Error
491Client ErrorToken not found
492Client ErrorEmail not verified
493Client ErrorSubscription expired
495Client ErrorAll daily units used
500Server ErrorSomething went wrong

API Pricing

2 units Cost per successful call to this endpoint.

Fetch Instagram Data at Scale

Use Instagram comment data to run sentiment analysis, monitor community discussions, and improve how you engage with your target audience.

deco-icon

Full Comment Data

Get commenter usernames, text, and timestamps per comment.

deco-icon

Reply Threads

Reconstruct nested reply conversations under any Instagram post.

deco-icon

Sentiment Ready

Feed clean comment text straight into sentiment analysis tools.