Instagram API
User Posts
Get recent posts from an Instagram user's profile.
POST
$0.01/call/v1/instagram/user-postsUsage
const res = await fetch('https://api.yepapi.com/v1/instagram/user-posts', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ username: 'natgeo' }),
});
const { data } = await res.json();
console.log(data);curl -X POST https://api.yepapi.com/v1/instagram/user-posts \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"username": "natgeo"}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
username | string | Yes | Instagram username | — |
end_cursor | string | No | Pagination cursor from previous response | — |
Response
{
"ok": true,
"data": {
"has_next_page": true,
"end_cursor": "QVFDcE...",
"posts": [
{
"id": "3456789012345678901",
"shortcode": "C5xAbCdEfGh",
"type": "GraphImage",
"caption": "A stunning sunset over the Sahara Desert. Photo by @photographer_name",
"like_count": 450000,
"comment_count": 1200,
"taken_at": 1712345678,
"display_url": "https://scontent.cdninstagram.com/...",
"thumbnail_url": "https://scontent.cdninstagram.com/...",
"is_video": false,
"video_view_count": null,
"accessibility_caption": "Photo of desert landscape at sunset"
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.has_next_page | boolean | Whether more posts are available |
data.end_cursor | string | Cursor for fetching the next page |
data.posts | object[] | Array of post objects |
data.posts[].id | string | Unique post identifier |
data.posts[].shortcode | string | Post shortcode (used in URLs) |
data.posts[].type | string | Post type: GraphImage, GraphVideo, or GraphSidecar |
data.posts[].caption | string | Post caption text |
data.posts[].like_count | number | Number of likes |
data.posts[].comment_count | number | Number of comments |
data.posts[].taken_at | number | Unix timestamp of when the post was published |
data.posts[].display_url | string | Full-size image URL |
data.posts[].is_video | boolean | Whether the post is a video |
data.posts[].video_view_count | number|null | Video view count (null for images) |
Use the end_cursor value from the response as the end_cursor parameter to fetch the next page of posts.