Instagram API
Post Comments
Get comments on an Instagram post with pagination.
POST
$0.01/call/v1/instagram/post-commentsUsage
const res = await fetch('https://api.yepapi.com/v1/instagram/post-comments', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ shortcode: 'C5xAbCdEfGh' }),
});
const { data } = await res.json();
console.log(data);curl -X POST https://api.yepapi.com/v1/instagram/post-comments \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"shortcode": "C5xAbCdEfGh"}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
shortcode | string | Yes | Post shortcode from the Instagram URL | — |
end_cursor | string | No | Pagination cursor from previous response | — |
Response
{
"ok": true,
"data": {
"has_next_page": true,
"end_cursor": "QVFDcE...",
"comment_count": 1200,
"comments": [
{
"id": "17891234567890123",
"text": "Absolutely breathtaking!",
"created_at": 1712346000,
"like_count": 4500,
"reply_count": 12,
"owner": {
"username": "photo_fan",
"profile_pic_url": "https://scontent.cdninstagram.com/...",
"is_verified": false
}
},
{
"id": "17891234567890124",
"text": "Where was this taken?",
"created_at": 1712347000,
"like_count": 230,
"reply_count": 3,
"owner": {
"username": "traveler_mike",
"profile_pic_url": "https://scontent.cdninstagram.com/...",
"is_verified": false
}
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.has_next_page | boolean | Whether more comments are available |
data.end_cursor | string | Cursor for fetching the next page |
data.comment_count | number | Total number of comments on the post |
data.comments | object[] | Array of comment objects |
data.comments[].id | string | Unique comment identifier |
data.comments[].text | string | Comment text |
data.comments[].created_at | number | Unix timestamp of when the comment was posted |
data.comments[].like_count | number | Number of likes on the comment |
data.comments[].reply_count | number | Number of replies to this comment |
data.comments[].owner | object | Comment author information |
Use the end_cursor value from the response to paginate through comments.