# Instagram 帖子评论 API

> 帖子或 Reel 下的评论，从新到旧，每页约 15 条：内容、评论者、点赞和发布时间。

网页版：https://okdata.online/zh/apis/instagram/posts/comments/list/

- **接口**：`GET /v1/instagram/posts/comments/list`
- **ID**：`instagram.posts.comments.list`
- **价格**：$0.004/次 · 每页约 15 条评论
- **返回**：一页约 15 条评论（`data.items`，Comment 对象）
- **状态**：预览
- **适合**：口碑分析

## 价格

每次调用 $0.004，返回一页，约 15 条评论。抓 1,000 条评论大约要 67 次调用，合计 $0.268。每翻一页是一次单独的调用；失败的调用不扣费。

## 参数

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| `id` | string | 否 |  | 帖子短码：链接里 /p/ 或 /reel/ 后面那一段。id 和 url 二选一。（例：`DeCPVhERA8e`） |
| `url` | string | 否 |  | 分享链接或网页地址，会从中解析出 ID。（例：`https://www.instagram.com/p/DeCPVhERA8e/`） |
| `cursor` | string | 否 |  | 上一次返回的 page.next_cursor，原样传回。每翻一页都是一次单独的调用。 |
| `view` | string: compact / standard / full | 否 | `standard` | 返回多少字段。full 会在 ext 里带上平台特有字段。 |
| `fields` | string[] | 否 |  | 只保留这些字段，按路径写（如 author.name），用来省 token。放在查询参数里时用逗号分隔。 |

id 和 url 给一个就行。 
cursor、view、fields 的用法见 [请求说明](https://okdata.online/zh/docs/requests/)。

## 返回字段

每一条都是一个 [Comment](https://okdata.online/zh/docs/objects/comment/)。

| 字段 | 类型 | 说明 |
|---|---|---|
| `id` | string | 评论 ID。 |
| `post_id` | string | 所属内容的 ID。 |
| `parent_id` | string \| null | 回复的上级评论；一级评论为 null。 |
| `text` | string | 评论内容。 |
| `published_at` | string | 发布时间，ISO 8601，UTC。 |
| `author` | AccountRef | 评论者。 |
| `likes` | integer \| null | 评论点赞数。 |
| `replies` | integer \| null | 回复数。 |
| `ip_location` | string \| null | 平台显示的 IP 属地（有的话）。 |
| `ext` | object | 平台特有字段，只在 view=full 时返回。 |

## 请求示例

### cURL

```bash
curl -G "https://api.okdata.online/v1/instagram/posts/comments/list" \
  -H "Authorization: Bearer $OKDATA_API_KEY" \
  --data-urlencode 'id=DeCPVhERA8e'
```

### Python

```python
import os
import requests

resp = requests.get(
    "https://api.okdata.online/v1/instagram/posts/comments/list",
    headers={"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"},
    params={"id": "DeCPVhERA8e"},
    timeout=60,
)
body = resp.json()
if body["code"] != "ok":
    raise RuntimeError(f"{body['code']}: {body['message']} (charged: {body['charged']})")

for row in body["data"]["items"]:
    print(row["likes"], row["text"])
print("cost: $" + body["meta"]["billing"]["amount"])
```

### TypeScript

```ts
const url = new URL('https://api.okdata.online/v1/instagram/posts/comments/list');
url.searchParams.set('id', "DeCPVhERA8e");

const res = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OKDATA_API_KEY}`,
  },
});
const body = await res.json();
if (body.code !== 'ok') throw new Error(`${body.code}: ${body.message}`);

for (const row of body.data.items) {
  console.log(row.likes, row.text);
}
console.log('cost: $' + body.meta.billing.amount);
```

### MCP

```json
{
  "name": "call",
  "arguments": {
    "capability": "instagram.posts.comments.list",
    "id": "DeCPVhERA8e"
  }
}
```

或者对接好 MCP 的智能体直接说：

> 用「Instagram 帖子评论」读前两页评论，总结大家夸什么、吐槽什么。

## 返回示例

```json
{
  "code": "ok",
  "request_id": "0f6c2a8e-4b1d-4e0a-9a51-3c7d2b9e1f20",
  "data": {
    "items": [
      {
        "id": "7302000000000000001",
        "post_id": "7301234567890123456",
        "parent_id": null,
        "text": "Which tent is that? Looks tiny packed.",
        "published_at": "2026-11-02T11:04:00Z",
        "author": {
          "id": "528817151",
          "username": "trailkit",
          "name": "Trail Kit",
          "avatar_url": "https://cdn.example.com/avatar/trailkit.jpg",
          "followers": 182300,
          "verified": true
        },
        "likes": 214,
        "replies": 9,
        "ip_location": null
      }
    ]
  },
  "page": {
    "next_cursor": "eyJvIjoyMH0",
    "has_more": true
  },
  "warnings": [],
  "meta": {
    "capability": "instagram.posts.comments.list",
    "billing": {
      "amount": "0.004",
      "currency": "USD",
      "balance_after": "9.996"
    },
    "unavailable": {},
    "cached": false,
    "replayed": false,
    "fetched_at": "2026-11-11T08:00:00Z"
  }
}
```

## 错误

所有错误同一种结构：code、request_id、message 和 message_zh（每个 code 一句固定的话）、charged、retry、retry_after_seconds、param 和 docs_url，具体问题写在 problems 里。错误不扣费；只有 settlement_unknown 的扣费结果要查询后才知道。完整列表：https://okdata.online/zh/docs/errors/

## 常见问题

### Instagram 帖子评论接口多少钱？

每次调用 $0.004，返回一页，约 15 条评论。抓 1,000 条评论大约要 67 次调用，合计 $0.268。每翻一页是一次单独的调用；失败的调用不扣费。

### 怎么翻页？

把返回里的 page.next_cursor 原样作为 cursor 参数传回去。page.has_more 为 false 时就没有下一页了。每一页都是一次 $0.004 的调用。

### 需要Instagram账号、Cookie 或扫码登录吗？

不需要。只要带上 okdata 的 API key。返回的是Instagram上的公开数据，不会用到你自己的Instagram账号。

### 调用失败会扣费吗？

不会。所有错误都会返回 charged: false；只有超时返回 charged: null，表示结果还没确定。带同一个 Idempotency-Key 重发，绝不会重复扣费。

### Instagram不展示某个字段怎么办？

这个字段会是 null，meta.unavailable 里会列出它和原因：platform（平台本来就不展示）或 capability（我们暂时取不到）。

## Instagram的其他接口

- [Instagram 账号信息](https://okdata.online/zh/apis/instagram/users/get/)：$0.004/次
- [Instagram 账号帖子](https://okdata.online/zh/apis/instagram/users/posts/list/)：$0.004/次 · 每页约 12 条帖子
- [Instagram 帖子详情](https://okdata.online/zh/apis/instagram/posts/get/)：$0.004/次
- [Instagram 评论回复](https://okdata.online/zh/apis/instagram/comments/replies/list/)：$0.004/次 · 每页约 15 条评论
- [Instagram 话题帖子](https://okdata.online/zh/apis/instagram/hashtags/posts/list/)：$0.004/次 · 每页约 10 条帖子
- [Instagram 视频字幕](https://okdata.online/zh/apis/instagram/posts/transcript/get/)：$0.004/次
- [Instagram 账号搜索](https://okdata.online/zh/apis/instagram/users/search/)：$0.002/次 · 每页约 20 个账号

## 概要

- **简称**：Instagram 帖子评论
- **英文名**：Instagram post comments API
- **分类**：[社交媒体](https://okdata.online/zh/categories/social/)
- **数据类型**：[评论接口](https://okdata.online/zh/roles/posts-comments-list/)
- **状态**：预览。还可能调整，改动会提前公告。
- **价格**：$0.004（约 ¥0.028） / 次 · 出错和超时不收费
- **返回**：每页约 15 条评论，带翻下一页的游标
- **调用出错时**：不收费。一个数据源出错就换下一个；出错和超时都不扣费。

## 什么时候收费

- 返回了数据：$0.004，每次调用收一次
- 参数不合法、出错、超时：不收费

| 情况 | 收费 |
|---|---|
| 每翻一页 | 另算一次调用：$0.004 |
| 单次最高扣费 | $0.004 |
| 空结果 | $0.004 |
| 查无此项（平台上没有） | 不收费 |
| 参数不合法、出错、超时 | 不收费 |
| 24 小时内带同一个 Idempotency-Key 重试 | 只扣一次 |

调用失败不收费；空结果收 $0.004；查无此项不收费。

价格取自价目表版本 1b273c48fea9634e。 [这个平台的全部价格](https://okdata.online/zh/pricing/instagram/)

- 新账号送 $0.10 试用额度，不用绑卡：够调这个接口 25 次。
- 抓 1,000 条评论约要 67 次调用，合计 $0.268。

## 已知限制

- 每页约 15 条评论，条数由平台决定，没有每页条数参数。
- 翻下一页时把 `page.next_cursor` 作为 `cursor` 传回。游标 24 小时内有效。`page.has_more` 为 false 时就没有下一页了。
- `id`、`url` 只给一个。

## 各视图返回的字段

“视图”一列是字段最早出现的 `view`：`compact` 只返回 compact 字段，`standard` 再加上 standard 字段，`full` 返回全部。默认是 `standard`。

- `compact`：`id`, `post_id`, `parent_id`, `text`, `published_at`, `author`, `likes`, `replies`
- `standard`：`ip_location`
- `full`：`ext`

## 这个接口的常见报错

| 状态码 | 代码 | 含义 | 是否扣费 | 能否重试 |
|---|---|---|---|---|
| 400 | `invalid_params` | 参数缺失、类型或取值不对，或者请求方法不对。problems 列出每一处问题，param 是第一个出错的参数。 | 否 | 修正后重试 |
| 400 | `cursor_mismatch` | cursor 发到了别的接口，或者参数和它所在那一页不一样（view 和 fields 可以变）。 | 否 | 修正后重试 |
| 401 | `unauthorized` | Key 缺失、格式不对、已撤销、已停用或已过期（知道原因时 reason 会写明）。 | 否 | 不要重试 |
| 402 | `insufficient_balance` | 余额（available）不够这次调用的最高费用（required）。 | 否 | 修正后重试 |
| 404 | `not_found` | 内容、账号或页面不存在或不公开。charge_when_not_found 大于 0 的接口会对这个结果计费（数据源也向我们收了钱）：这时返回体里 charged 为 true，并给出 amount。 | 否 | 不要重试 |
| 410 | `cursor_expired` | cursor 超过了这个接口的有效期（page.cursor_expires_at 写了到期时间）。 | 否 | 不要重试 |
| 429 | `rate_limited` | 账号这一分钟请求太多（reason: rate），或同时进行的调用太多（reason: concurrency）。 | 否 | 可以重试 |
| 500 | `settlement_unknown` | 数据已返回，但没能确认是否扣费。 | 查询后才知道 | 用同一个 Idempotency-Key 重试 |
| 502 | `upstream_failed` | 这个接口的所有数据源这次都失败了。 | 否 | 可以重试 |
| 503 | `capability_paused` | 这个接口暂时停用了，这次没有执行。 | 否 | 可以重试 |
| 504 | `timeout` | 数据没有及时返回。预扣已退回，这次没有扣费。 | 否 | 可以重试 |

[全部错误码](https://okdata.online/zh/docs/errors/)

## 其他平台的同类数据

- [抖音视频评论](https://okdata.online/zh/apis/douyin/videos/comments/list/)：$0.002/次 · 每页约 20 条评论
- [小红书笔记评论](https://okdata.online/zh/apis/xiaohongshu/notes/comments/list/)：$0.02/次 · 每页约 10 条评论
- [B站视频评论](https://okdata.online/zh/apis/bilibili/videos/comments/list/)：$0.002/次 · 每页约 20 条评论
- [TikTok 视频评论](https://okdata.online/zh/apis/tiktok/videos/comments/list/)：$0.002/次 · 每页约 50 条评论
- [YouTube 视频评论](https://okdata.online/zh/apis/youtube/videos/comments/list/)：$0.002/次 · 每页约 20 条评论
- [Reddit 帖子评论](https://okdata.online/zh/apis/reddit/posts/comments/list/)：$0.002/次 · 每页约 10 条评论
- [快手作品评论](https://okdata.online/zh/apis/kuaishou/videos/comments/list/)：$0.002/次 · 每页约 10 条评论
- [视频号作品评论](https://okdata.online/zh/apis/wechat_channels/videos/comments/list/)：$0.015/次 · 每页约 25 条评论
- [微博评论](https://okdata.online/zh/apis/weibo/posts/comments/list/)：$0.002/次 · 每页约 20 条评论
- [公众号文章评论](https://okdata.online/zh/apis/wechat_mp/articles/comments/list/)：$0.02/次 · 每页约 20 条评论

[评论接口](https://okdata.online/zh/roles/posts-comments-list/)

## 在你的 AI 里用

> 先读 https://okdata.online/zh/apis/instagram/posts/comments/list.md，再用 okdata 帮我调这个接口，key 在环境变量 OKDATA_API_KEY 里。用「Instagram 帖子评论」读前两页评论，总结大家夸什么、吐槽什么。
