# Instagram 单条内容 API (instagram.post)

- Canonical page: https://everyinfra.com/instagram-api/post
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "instagram", "action": "post", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 11, max 11 per call
- Mode: sync; add "mode": "async" for slow tasks

Instagram 单条内容按 `urls` 读取指定帖子的公开数据：正文和媒体类型，点赞、评论、浏览数，作者的用户名、ID 和粉丝数，发布时间和地点，展示的几条评论 `top_comments`，以及图片、视频链接和宽高。它回答「这几条帖子现在是什么数据」，适合复盘合作帖的效果、核对竞品内容，或者把话题内容里发现的帖子补读一遍。

`urls` 是数组，每项是完整帖子链接，形如 /p/<shortcode>/ 或 /reel/<shortcode>/；单次最多 11 条，按目标链接数计费，多链接的费用不能按一条估算。评论接口只处理单个链接，不要把这里的多链接写法直接套过去。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| urls | not declared | yes | not declared | post 的帖子完整链接数组，例如 /p/<shortcode>/ 或 /reel/<shortcode>/；按目标链接数计费。comments 只处理单个 url，不要把 post 的多链接请求形状直接套过去。 |
| limit | integer (1–11) | no | 11 | 这次调用最多返回的条数，整数，1–11；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 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": "post",
  "params": {
    "urls": [
      "https://www.instagram.com/p/<POST_SHORTCODE>/"
    ]
  }
}'
```

```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": "post",
        "params": {
            "urls": [
                "https://www.instagram.com/p/<POST_SHORTCODE>/",
            ],
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "instagram",
  "action": "post",
  "results": [
    {
      "post_id": …,
      "url": …,
      "text": …,
      "media_type": …,
      "like_count": …,
      "comment_count": …,
      "view_count": …,
      "author_username": …,
      "author_name": …,
      "posted_at": …,
      "location": …,
      "id": …,
      "image_url": …,
      "video_url": …,
      "author_id": …,
      "width": …,
      "height": …,
      "is_comments_disabled": …,
      "author_follower_count": …,
      "hashtags": …,
      "top_comments": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `urls` 应该怎么填？

填一个数组，每项是一条帖子的完整链接，形如 /p/<shortcode>/ 或 /reel/<shortcode>/。示例里的 <POST_SHORTCODE> 要换成真实公开帖子的短码，用户主页链接不行。单次最多返回 11 条，链接多时分几次传。

### 一次传多个链接怎么计费？

按目标链接数计费，传几个链接就按几个算，不是一次请求算一次。所以估算费用时不能按一条帖子算，批量读取前先数清楚链接数。

### `hashtags` 和 `top_comments` 为什么有时不在结果里？

正文里没有话题标签时，就没有 `hashtags`；帖子下没有展示评论时，就没有 `top_comments`。这是字段缺席，处理时用「字段是否存在」判断。`view_count` 则是 null 表示不公开，不等于 0。

## 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
