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

# Instagram

> Fetch public Instagram profiles and recent posts.

# Instagram

**Base URL:** `https://drain.lat/api/v1/instagram`

<Warning>
  Instagram aggressively rate limits requests. These endpoints may occasionally return a rate limit error. Results are cached for 10 minutes.
</Warning>

<AccordionGroup>
  <Accordion title="GET /profile/:username" icon="user">
    Fetch a public Instagram profile.

    ```
    GET /api/v1/instagram/profile/:username
    ```

    <ParamField path="username" type="string" required>
      The Instagram username to look up.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/instagram/profile/cristiano" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/instagram/profile/cristiano", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

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

      res = requests.get(
          "https://drain.lat/api/v1/instagram/profile/cristiano",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="id" type="string">Instagram user ID.</ResponseField>
    <ResponseField name="username" type="string">Instagram username.</ResponseField>
    <ResponseField name="displayName" type="string">Display name.</ResponseField>
    <ResponseField name="bio" type="string">Profile bio.</ResponseField>
    <ResponseField name="avatarUrl" type="string">Avatar image URL.</ResponseField>
    <ResponseField name="website" type="string">Website link in bio.</ResponseField>
    <ResponseField name="isVerified" type="boolean">Whether the account is verified.</ResponseField>
    <ResponseField name="verified" type="boolean">Alias for isVerified (may appear in some responses).</ResponseField>
    <ResponseField name="isPrivate" type="boolean">Whether the account is private.</ResponseField>
    <ResponseField name="isBusiness" type="boolean">Whether the account is a business account.</ResponseField>
    <ResponseField name="businessCategory" type="string">Business category if applicable.</ResponseField>
    <ResponseField name="followers" type="number">Follower count.</ResponseField>
    <ResponseField name="following" type="number">Following count.</ResponseField>
    <ResponseField name="posts" type="number">Total post count.</ResponseField>
    <ResponseField name="reels" type="number">Total reels count.</ResponseField>
    <ResponseField name="profileUrl" type="string">Link to the Instagram profile.</ResponseField>

    ```json Response theme={null}
    {
      "id": "173560420",
      "username": "cristiano",
      "displayName": "Cristiano Ronaldo",
      "bio": "Siuuu",
      "avatarUrl": "https://instagram.fpac1-4.fna.fbcdn.net/...",
      "website": "https://www.cristianoronaldo.com",
      "isVerified": true,
      "isPrivate": false,
      "isBusiness": false,
      "businessCategory": "",
      "followers": 635000000,
      "following": 567,
      "posts": 3841,
      "reels": 0,
      "profileUrl": "https://www.instagram.com/cristiano/",
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /profile/:username/posts" icon="images">
    Get the last 12 posts from a public Instagram profile.

    ```
    GET /api/v1/instagram/profile/:username/posts
    ```

    <ParamField path="username" type="string" required>
      The Instagram username.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/instagram/profile/cristiano/posts" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/instagram/profile/cristiano/posts", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

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

      res = requests.get(
          "https://drain.lat/api/v1/instagram/profile/cristiano/posts",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="username" type="string">Instagram username.</ResponseField>

    <ResponseField name="posts" type="array">
      <Expandable title="post object">
        <ResponseField name="id" type="string">Post ID.</ResponseField>
        <ResponseField name="shortcode" type="string">Post shortcode used in the URL.</ResponseField>
        <ResponseField name="type" type="string">Post type (e.g. `GraphImage`, `GraphVideo`).</ResponseField>
        <ResponseField name="isVideo" type="boolean">Whether the post is a video.</ResponseField>
        <ResponseField name="thumbnailUrl" type="string">Thumbnail image URL.</ResponseField>
        <ResponseField name="caption" type="string">Post caption.</ResponseField>
        <ResponseField name="likes" type="number">Like count.</ResponseField>
        <ResponseField name="comments" type="number">Comment count.</ResponseField>
        <ResponseField name="views" type="number">View count. Only populated for video posts.</ResponseField>
        <ResponseField name="takenAt" type="string">Post date (ISO 8601).</ResponseField>
        <ResponseField name="url" type="string">Link to the post.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Total posts on the account.</ResponseField>
    <ResponseField name="isPrivate" type="boolean">Whether the account is private.</ResponseField>

    ```json Response theme={null}
    {
      "username": "cristiano",
      "posts": [
        {
          "id": "3012345678901234567",
          "shortcode": "CxAbCdEfGhI",
          "type": "GraphImage",
          "isVideo": false,
          "thumbnailUrl": "https://instagram.fpac1-4.fna.fbcdn.net/...",
          "caption": "Siuuu! ⚽",
          "likes": 12400000,
          "comments": 43200,
          "views": null,
          "takenAt": "2026-04-01T18:00:00.000Z",
          "url": "https://www.instagram.com/p/CxAbCdEfGhI/"
        }
      ],
      "total": 3841,
      "isPrivate": false,
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```

    <Note>Private accounts return an empty `posts` array with `"isPrivate": true`.</Note>
  </Accordion>
</AccordionGroup>
