# Instagram 用户内容 API (instagram.user_posts)

- Canonical page: https://everyinfra.com/instagram-api/user_posts
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "instagram", "action": "user_posts", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 30, max 200 per call
- Mode: async by default (202 + job_id, poll GET /api/v1/jobs/{job_id})

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=instagram&action=user_posts

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | Instagram 账号 handle，建议不带 @ 或完整主页 URL。profile/persona/user_posts/reels 查询账号数据；followers 只查粉丝数量，followers_list/following_list 才查粉丝/关注账号列表。 |
| limit | integer (1–200) | no | 30 | 这次调用最多返回的条数，整数，1–200；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| post_id | 帖子 ID。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| media_type | 媒体类型（图/视频/轮播）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| view_count | 浏览/播放数。null 表示不公开，不等于 0。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_name | 作者昵称（显示名）。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| location | 地理位置描述，原文透传，格式随平台而异。 |
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| video_url | platform-native meaning |
| author_id | 作者在原平台的唯一 ID。 |
| width | platform-native meaning |
| height | platform-native meaning |
| is_comments_disabled | 帖子是否关闭评论。 |
| author_follower_count | 作者粉丝数。null 表示不公开。 |
| hashtags | 正文里的话题标签数组，按出现顺序；没有时不出现这个字段。 |
| top_comments | 帖子下展示的几条评论，每项含正文（text）和评论人（author_username）；没有时不出现这个字段。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "instagram",
  "action": "user_posts",
  "params": {
    "username": "nasa"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "instagram",
        "action": "user_posts",
        "params": {
            "username": "nasa",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-10-24T18:28:34Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 30. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "instagram",
  "action": "user_posts",
  "results": [
    {
      "post_id": "De2t82PPyx9",
      "url": "https://www.instagram.com/p/De2t82PPyx9/",
      "text": "We are not slowing down. 🚀\n\nOur #Artemis III mission will send four astronauts to low Earth orbit next year to test critical systems needed for future lunar landings and we’re accelerating efforts to ensure the success of Artemis IV, the first Artemis mission on the lunar surface…",
      "media_type": "image",
      "like_count": 46089,
      "comment_count": 364,
      "author_username": "nasa",
      "author_name": "NASA",
      "posted_at": "2026-10-23T23:20:57+00:00",
      "id": "4014598211346836605_528817151",
      "image_url": "https://instagram.fuba2-1.fna.fbcdn.net/v/t51.82787-15/859070372_18661402093049152_3071139610491516778_n.jpg?stp=dst-jpg_e15_tt6&_nc_cat=1&ig_cache_key=NDAxNDU5ODIxMTM0NjgzNjYwNTE4NjYxNDAyMDg3MDQ5MTUy.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI6IkNMSVBTLnhwaWRzLjcyMC5…",
      "video_url": "https://instagram.fuba2-1.fna.fbcdn.net/o1/v/t2/f2/m86/AQNTkECBw2suz97dudN4wjd5tp7fZgWYJZB6PwTVUGMQU9r4E08_w4KcBLpaInhz4kASzQbv8D4AqHGg8nn8IWBidZ5OR5QfmdqpvN0.mp4?_nc_cat=102&_nc_oc=Adq5bLzGCWm2kVZWdS8bGQwb60nMRQoz0Yl-AbZ3EdrSsTV4Mt8qEBWTMMUiwkNKBeQ&_nc_sid=5e9851&_nc_ht=instagra…",
      "author_id": "•••",
      "width": 1080,
      "height": 1920
    },
    {
      "post_id": "De1wbZ6l2Vy",
      "url": "https://www.instagram.com/p/De1wbZ6l2Vy/",
      "text": "This disc is 50,000 light-years wide!\n\nIt's the Sombrero Galaxy — seen here by our orbiting @••• telescope. Its unique appearance could be the result of a long-ago merger with other galaxies.\n\n#NASA #Space #Galaxy",
      "media_type": "image",
      "like_count": 693209,
      "comment_count": 2199,
      "author_username": "nasa",
      "author_name": "NASA",
      "posted_at": "2026-10-23T14:19:41+00:00",
      "id": "4014327632355616114_528817151",
      "image_url": "https://instagram.fuba2-1.fna.fbcdn.net/v/t51.82787-15/862320651_18661289491049152_6188246238745863140_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=1&ig_cache_key=NDAxNDMyNzU3MzgyODI5NTU0MQ%3D%3D.3-ccb7-5&ccb=7-5&_nc_sid=58cdad&efg=eyJ2ZW5jb2RlX3RhZyI6IkNBUk9VU0VMX0lURU0ueHBpZHMuMTQ0MC5zZHI…",
      "author_id": "•••",
      "width": 1440,
      "height": 1440
    }
  ],
  "count": 30,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=instagram
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
