# User posts

> A page of public posts with captions, media and engagement counts.

- **Request:** `GET https://api.lurkapi.com/v2/instagram/user/posts`
- **Auth:** `x-api-key` header ([get a free key](https://lurkapi.com/login?next=/dashboard))
- **Cost:** 1 credit per call. Validation errors, `401`/`402`/`429` rejections and `5xx` failures are free; `not_found` is charged ([how charging works](https://lurkapi.com/docs.md#credits)).
- **MCP tool:** `instagram_user_posts` on `https://api.lurkapi.com/mcp`
- **Freshness:** responses are cached for up to 3 minutes
- **Try it live:** https://lurkapi.com/docs/instagram/user-posts#try (no signup)
- **Platform:** [Instagram](https://lurkapi.com/docs/instagram.md) (instagram.com)
- **Web page:** https://lurkapi.com/docs/instagram/user-posts

## When to use this

Pass a username or profile URL. Up to 50 posts can be requested; Instagram may return fewer. Preserve end_cursor exactly and pass it as after to continue. Private posts are unavailable. Cached pages cost the same as fresh pages.

## Parameters

All parameters go in the query string.

| Name | Type | Required | Default | Allowed values | Description | Example |
| --- | --- | --- | --- | --- | --- | --- |
| `username` | string | no |  |  | Instagram username, with or without @, or a profile URL. Required unless url is given. | `nike` |
| `url` | string | no |  |  | An instagram.com profile URL. Required unless username is given. |  |
| `first` | integer | no | `12` |  | Requested page size, 1–50; default 12. Instagram may return fewer items. | `12` |
| `after` | string | no |  |  | Pass end_cursor from the previous page unchanged; omit for the first page. |  |

## Example request

Replace `YOUR_API_KEY` with your key, or set `LURKAPI_KEY` for the code. [Get a free key](https://lurkapi.com/login?next=/dashboard).

curl:

```bash
curl "https://api.lurkapi.com/v2/instagram/user/posts?username=nike&first=12" \
  -H "x-api-key: YOUR_API_KEY"
```

JavaScript:

```js
const params = new URLSearchParams({
  username: "nike",
  first: "12",
});
const res = await fetch(`https://api.lurkapi.com/v2/instagram/user/posts?${params}`, {
  headers: { "x-api-key": process.env.LURKAPI_KEY },
});
const data = await res.json();
if (!data.success) throw new Error(`${data.code}: ${data.error}`);
console.log(data.posts);
```

Python:

```python
import os
import requests

res = requests.get(
    "https://api.lurkapi.com/v2/instagram/user/posts",
    params={
        "username": "nike",
        "first": "12",
    },
    headers={"x-api-key": os.environ["LURKAPI_KEY"]},
    timeout=60,
)
data = res.json()
if not data["success"]:
    raise RuntimeError(f"{data['code']}: {data['error']}")
print(data["posts"])
```

## Example response

A real response from this endpoint, captured from the live API and trimmed to a couple of items. Strings over 96 characters (mostly signed media URLs) are cut short and end in `…`.

200 OK (application/json):

```json
{
  "success": true,
  "credits_remaining": 99,
  "credits_charged": 1,
  "posts": [
    {
      "pk": "3991849403537918302",
      "media_type": 2,
      "display_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-15/809201733_186664…",
      "images": [
        {
          "url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-15/809201733_186664…",
          "width": 1080,
          "height": 1920
        }
      ],
      "videos": [
        {
          "url": "https://scontent-iad6-1.cdninstagram.com/o1/v/t2/f2/m86/AQNTYMwiQ36mUhGO…",
          "width": 720,
          "height": 1280
        }
      ],
      "code": "Ddl5eH-u4le",
      "url": "https://www.instagram.com/p/Ddl5eH-u4le/",
      "product_type": "clips",
      "caption": "*Just a normal day for @caitlinclark22.\n\nWake up. Eat cereal. Lace up th…",
      "taken_at": 1790085604,
      "like_count": 67594,
      "comment_count": 1062,
      "play_count": null,
      "view_count": null,
      "accessibility_caption": null,
      "user": {
        "pk": "13460080",
        "username": "nike",
        "full_name": "Nike",
        "profile_pic_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-19/551608484_185671…",
        "is_verified": true
      },
      "coauthor_producers": [
        {
          "pk": "306787899",
          "username": "nikebasketball",
          "full_name": "Nike Basketball",
          "profile_pic_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.2885-19/476165648_5629502…",
          "is_verified": true
        }
      ],
      "is_paid_partnership": false,
      "location": null,
      "carousel_media": []
    },
    {
      "pk": "3989102691637366197",
      "media_type": 8,
      "display_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.82787-15/796460834_186652…",
      "images": [
        {
          "url": "https://scontent-iad3-1.cdninstagram.com/v/t51.82787-15/796460834_186652…",
          "width": 1080,
          "height": 1350
        }
      ],
      "videos": [],
      "code": "DdcI8NLmY21",
      "url": "https://www.instagram.com/p/DdcI8NLmY21/",
      "product_type": "carousel_container",
      "caption": "Nike Atelier for Sha’Carri Richardson reflects the beauty of London afte…",
      "taken_at": 1789758119,
      "like_count": 61729,
      "comment_count": 1308,
      "play_count": null,
      "view_count": null,
      "accessibility_caption": null,
      "user": {
        "pk": "13460080",
        "username": "nike",
        "full_name": "Nike",
        "profile_pic_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-19/551608484_185671…",
        "is_verified": true
      },
      "coauthor_producers": [
        {
          "pk": "342441068",
          "username": "itsshacarri",
          "full_name": "Sha’Carri Richardson",
          "profile_pic_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-19/710700885_185944…",
          "is_verified": true
        },
        {
          "pk": "286654768",
          "username": "nikerunning",
          "full_name": "Nike Running",
          "profile_pic_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-19/586863358_185610…",
          "is_verified": true
        }
      ],
      "is_paid_partnership": false,
      "location": null,
      "carousel_media": [
        {
          "pk": "3989101150044733870",
          "media_type": 1,
          "display_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.82787-15/796460834_186652…",
          "images": [
            {
              "url": "https://scontent-iad3-1.cdninstagram.com/v/t51.82787-15/796460834_186652…",
              "width": 1080,
              "height": 1350
            }
          ],
          "videos": []
        },
        {
          "pk": "3989101151336647994",
          "media_type": 1,
          "display_url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-15/812755144_186652…",
          "images": [
            {
              "url": "https://scontent-iad6-1.cdninstagram.com/v/t51.82787-15/812755144_186652…",
              "width": 1080,
              "height": 1350
            }
          ],
          "videos": []
        }
      ]
    }
  ],
  "end_cursor": "AQHTJo-0f314Mv-BY-dDG3AI2BEyG7vK1jJa1VMBjCp426TIUTLO6UAla2xoA7FYmfyk0FjflaCNbai4iXVSsc-guw",
  "has_next_page": true
}
```

## Response fields

Every field of a successful response. `[]` marks a list: `a[].b` is the `b` of each item in `a`. **nullable** fields can be `null`; **optional** fields can be missing.

| Field | Type | Description |
| --- | --- | --- |
| `success` | `true` | Always true here; errors have `success: false`. |
| `credits_remaining` | `number` | Your balance after this call. On anonymous playground calls: free tries left today. |
| `credits_charged` | `number` | Credits this call cost; 0 on free endpoints. On anonymous playground calls: tries used (1). |
| `posts` | `object[]` | Posts in Instagram's timeline order, which can include pinned posts. |
| `posts[].pk` | `string` | Numeric media id, represented as a string. |
| `posts[].media_type` | `number` | Instagram media type: 1 photo, 2 video, 8 carousel. |
| `posts[].display_url` | `string`, nullable | Preview image URL; CDN links can expire; null when not returned. |
| `posts[].images` | `object[]` | Available image sizes; empty when none are returned. |
| `posts[].images[].url` | `string` | Direct image URL; CDN links can expire. |
| `posts[].images[].width` | `number`, nullable | Image width in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].images[].height` | `number`, nullable | Image height in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].videos` | `object[]` | Available MP4 versions; empty for photos or when video URLs are unavailable. |
| `posts[].videos[].url` | `string` | Direct MP4 URL; CDN links can expire. |
| `posts[].videos[].width` | `number`, nullable | Video width in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].videos[].height` | `number`, nullable | Video height in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].code` | `string` | The post's case-sensitive shortcode. |
| `posts[].url` | `string` | Canonical Instagram post URL. |
| `posts[].product_type` | `string`, nullable | Instagram product type, e.g. clips for a reel or feed for a feed post; null when not returned. |
| `posts[].caption` | `string`, nullable | Post caption as plain text, preserving line breaks; an empty string is an explicitly empty caption; null when not returned. |
| `posts[].taken_at` | `number`, nullable | Published at, Unix seconds; null when not shown or returned. A null count is not zero. |
| `posts[].like_count` | `number`, nullable | Like count; null when not shown or returned. A null count is not zero. |
| `posts[].comment_count` | `number`, nullable | Comment count; null when not shown or returned. A null count is not zero. |
| `posts[].play_count` | `number`, nullable | Play count; usually omitted on logged-out post and timeline queries; null when not shown or returned. A null count is not zero. |
| `posts[].view_count` | `number`, nullable | View count; usually omitted on logged-out post and timeline queries; null when not shown or returned. A null count is not zero. |
| `posts[].accessibility_caption` | `string`, nullable | Instagram's accessibility description; null when not returned. |
| `posts[].user` | `object` | Post author. |
| `posts[].user.pk` | `string` | The account's numeric Instagram id, represented as a string. |
| `posts[].user.username` | `string` | Instagram username, without @. |
| `posts[].user.full_name` | `string`, nullable | Display name; null when not returned. |
| `posts[].user.profile_pic_url` | `string`, nullable | Profile image URL; CDN links can expire; null when not returned. |
| `posts[].user.is_verified` | `boolean`, nullable | Whether Instagram shows a verified badge; null when not returned. |
| `posts[].coauthor_producers` | `object[]` | Coauthors returned by Instagram; empty when none are returned. |
| `posts[].coauthor_producers[].pk` | `string` | The account's numeric Instagram id, represented as a string. |
| `posts[].coauthor_producers[].username` | `string` | Instagram username, without @. |
| `posts[].coauthor_producers[].full_name` | `string`, nullable | Display name; null when not returned. |
| `posts[].coauthor_producers[].profile_pic_url` | `string`, nullable | Profile image URL; CDN links can expire; null when not returned. |
| `posts[].coauthor_producers[].is_verified` | `boolean`, nullable | Whether Instagram shows a verified badge; null when not returned. |
| `posts[].is_paid_partnership` | `boolean`, nullable | Whether Instagram marks the post as a paid partnership; null when not returned. |
| `posts[].location` | `object`, nullable | Tagged location; null when none is returned. |
| `posts[].location.pk` | `string`, nullable | Numeric location id; null when not returned. |
| `posts[].location.name` | `string`, nullable | Location name; null when not returned. |
| `posts[].carousel_media` | `object[]` | Carousel items in order; empty for single-media posts. |
| `posts[].carousel_media[].pk` | `string` | Numeric media id, represented as a string. |
| `posts[].carousel_media[].media_type` | `number` | Instagram media type: 1 photo, 2 video, 8 carousel. |
| `posts[].carousel_media[].display_url` | `string`, nullable | Preview image URL; CDN links can expire; null when not returned. |
| `posts[].carousel_media[].images` | `object[]` | Available image sizes; empty when none are returned. |
| `posts[].carousel_media[].images[].url` | `string` | Direct image URL; CDN links can expire. |
| `posts[].carousel_media[].images[].width` | `number`, nullable | Image width in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].carousel_media[].images[].height` | `number`, nullable | Image height in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].carousel_media[].videos` | `object[]` | Available MP4 versions; empty for photos or when video URLs are unavailable. |
| `posts[].carousel_media[].videos[].url` | `string` | Direct MP4 URL; CDN links can expire. |
| `posts[].carousel_media[].videos[].width` | `number`, nullable | Video width in pixels; null when not shown or returned. A null count is not zero. |
| `posts[].carousel_media[].videos[].height` | `number`, nullable | Video height in pixels; null when not shown or returned. A null count is not zero. |
| `end_cursor` | `string`, nullable | Opaque pagination cursor; pass it as after for the next page; null when not returned. |
| `has_next_page` | `boolean` | Whether Instagram reports another page. A false value ends pagination. |

## Pagination

Pass a cursor from a previous response as `after` to load more (see [When to use this](#when-to-use)). Each call costs 1 credit.

## Caching and freshness

Responses are cached for up to 3 minutes, so a repeat call within that window can return the same data. It still costs 1 credit.

## Errors

Errors return `{ success: false, error, code, docs }` with the HTTP status below. Validation errors, `401`/`402`/`429` rejections and `5xx` failures are free; `not_found` is charged ([how charging works](https://lurkapi.com/docs.md#credits)). [All error codes](https://lurkapi.com/docs.md#errors).

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `missing_api_key` | No API key. Send it in the `x-api-key` header. |
| 401 | `invalid_api_key` | The key is unknown or was revoked. |
| 402 | `insufficient_credits` | Not enough credits for this call. Buy a pack or wait for tomorrow's top-up. |
| 403 | `not_public` | The platform confirmed this account or content isn't available to logged-out visitors. Use a publicly visible target. Charged when the platform was checked. |
| 404 | `not_found` | The endpoint, or the thing you asked for (ad, post, subreddit), doesn't exist. Charged when the platform was checked. |
| 405 | `method_not_allowed` | Endpoints take GET with query params. |
| 429 | `rate_limited` | Too many calls at once. Wait for the `retry-after` seconds, then retry. |
| 500 | `internal_error` | Something broke on our side. Retry; 5xx errors are free. |
| 502 | `upstream_error` | The platform didn't give a usable answer. Retry; 5xx errors are free. |
| 503 | `upstream_busy` | All our connections to the platform are busy. Retry in a few seconds; 5xx errors are free. |
| 504 | `upstream_timeout` | The platform took over 30 seconds to answer. Retry; timeouts are free. |

## Use it in Claude

Once LurkAPI is [connected to Claude](https://lurkapi.com/docs.md#claude), this endpoint is the `instagram_user_posts` tool. Ask in plain English, for example:

Ask Claude:

```text
Use LurkAPI's instagram_user_posts with username "nike", first "12" and summarize what you find.
```

Claude calls `instagram_user_posts` with arguments like these, and each call costs 1 credit:

Tool arguments:

```json
{
  "username": "nike",
  "first": "12"
}
```

Tool results skip nulls and empty lists to save tokens.

---

Previous: [Profile](https://lurkapi.com/docs/instagram/profile.md) · Next: [Post](https://lurkapi.com/docs/instagram/post.md)
