> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scraper.creatorlookup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get User Posts

> Retrieve recent posts from an Instagram user

## Request

### Headers

| Name        | Required | Description  |
| ----------- | -------- | ------------ |
| `x-api-key` | Yes      | Your API key |

### Query parameters

<ParamField query="username" type="string" required>
  The Instagram username to fetch posts from.
</ParamField>

<ParamField query="limit" type="number" default={12}>
  Number of posts to return. Min: 1, max: 50. Defaults to 12.
</ParamField>

## Response

<ResponseField name="data" type="InstagramPost[]">
  Array of post objects.

  <Expandable title="InstagramPost">
    <ResponseField name="shortcode" type="string">Unique post identifier (used in URLs)</ResponseField>
    <ResponseField name="caption" type="string | null">Post caption text</ResponseField>
    <ResponseField name="timestamp" type="number">Unix timestamp of when the post was created</ResponseField>
    <ResponseField name="like_count" type="number">Number of likes</ResponseField>
    <ResponseField name="comment_count" type="number">Number of comments</ResponseField>
    <ResponseField name="media_type" type="string">One of: `image`, `video`, `carousel`</ResponseField>
    <ResponseField name="media_url" type="string">URL of the primary media</ResponseField>
    <ResponseField name="thumbnail_url" type="string | null">Thumbnail URL (for videos)</ResponseField>
    <ResponseField name="is_video" type="boolean">Whether the post is a video</ResponseField>
    <ResponseField name="video_view_count" type="number | null">View count (videos only)</ResponseField>
    <ResponseField name="location" type="string | null">Tagged location name</ResponseField>
    <ResponseField name="tagged_users" type="string[]">Usernames tagged in the post</ResponseField>
    <ResponseField name="hashtags" type="string[]">Hashtags extracted from the caption</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="credits_used" type="number">Credits deducted (2)</ResponseField>
<ResponseField name="credits_remaining" type="number">Remaining credit balance</ResponseField>

**Cost:** 2 credits

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -H "x-api-key: sk-your-api-key" \
    "https://api.scraper.creatorlookup.com/v1/instagram/user/posts?username=instagram&limit=3"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch(
    "https://api.scraper.creatorlookup.com/v1/instagram/user/posts?username=instagram&limit=3",
    { headers: { "x-api-key": "sk-your-api-key" } }
  );

  const { data } = await res.json();
  data.forEach((post) => {
    console.log(`${post.shortcode}: ${post.like_count} likes`);
  });
  ```

  ```python Python theme={null}
  import requests

  res = requests.get(
      "https://api.scraper.creatorlookup.com/v1/instagram/user/posts",
      params={"username": "instagram", "limit": 3},
      headers={"x-api-key": "sk-your-api-key"},
  )

  for post in res.json()["data"]:
      print(f"{post['shortcode']}: {post['like_count']} likes")
  ```
</CodeGroup>

### 200 — Success

```json theme={null}
{
  "data": [
    {
      "shortcode": "CxAbCdEfGh",
      "caption": "Welcome to Instagram! #photography",
      "timestamp": 1700000000,
      "like_count": 150000,
      "comment_count": 2500,
      "media_type": "image",
      "media_url": "https://scontent.cdninstagram.com/...",
      "thumbnail_url": null,
      "is_video": false,
      "video_view_count": null,
      "location": "New York, New York",
      "tagged_users": ["photographer"],
      "hashtags": ["photography"]
    }
  ],
  "credits_used": 2,
  "credits_remaining": 9998
}
```

### 402 — Insufficient credits

```json theme={null}
{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "This endpoint requires 2 credits, you have 1"
  }
}
```
