采集为异步:提交 run → 轮询状态 → 取数。完整端到端流程见 快速开始;统一响应信封、run 状态机、计费与错误码见 认证与错误处理。本页只列各端点的提交参数(target 字段)与输出记录字段。
快速说明
- Base URL:
https://api.antsdata.com/v1 - 提交 run:
POST /v1/scraper/instagram/<资源>,请求体{ deliveryMode, recordLimit, targets:[…] }
💡 也可用
deliveryMode: "sync"同步模式(小任务阻塞等终态,超时自动 fallback 转轮询)——详见 快速开始 · 同步模式。
- 鉴权:请求头
Authorization: Bearer ants_xxxxxxxxxxxx(静态 API Key) - Content-Type:
application/json - targets:数组入参(≥1);每个元素的字段 = 各端点下表的「target 字段」。单目标成败在 run 的
tasks[],不在结果记录里。 - 取数:提交返回
201+{ id, status:"queued" };按id轮询GET /v1/scraper/runs/{id}至succeeded,再按id分页取记录或下载(见快速开始)。
端点一览
| 端点 | 说明 | target 字段 |
|---|---|---|
POST /v1/scraper/instagram/profile |
账号资料 | username |
POST /v1/scraper/instagram/posts |
账号帖子 | username |
POST /v1/scraper/instagram/reels |
账号短视频(Reels) | username |
POST /v1/scraper/instagram/comments |
帖子评论 | post |
Profile — 账号资料
采集一个或多个账号的公开资料。
端点:POST /v1/scraper/instagram/profile
target 字段(targets[] 每个元素):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
username |
string | ✅ | 账号用户名 |
输出记录字段(records 每条):
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
username |
string | 用户名 | nike |
fullName |
string | 显示名称 | Nike |
biography |
string | Bio / 简介 | Just do it. |
externalUrl |
string | 外链 URL | https://nike.com |
followersCount |
number | 粉丝数 | 305000000 |
followsCount |
number | 关注数 | 185 |
postsCount |
number | 帖子总数 | 987 |
isVerified |
boolean | 是否蓝 V 认证 | true |
isBusinessAccount |
boolean | 是否商业账号 | true |
businessCategory |
string | 商业类目 | Sports Apparel |
profilePicUrl |
string | 头像 URL | https://instagram.fcdn.net/.../xxx.jpg |
profileUrl |
string | 主页链接 | https://instagram.com/nike |
提交示例:
curl -X POST "https://api.antsdata.com/v1/scraper/instagram/profile" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"deliveryMode": "async",
"recordLimit": 1000,
"targets": [
{ "username": "nike" },
{ "username": "instagram" }
]
}'
返回 201 + { "id": <run 号>, "status": "queued" };随后按 id 轮询状态、取数(见快速开始)。
Posts — 账号帖子
采集指定账号发布的帖子列表。
端点:POST /v1/scraper/instagram/posts
target 字段(targets[] 每个元素):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
username |
string | ✅ | 账号用户名 |
每个账号返回的帖子数由 run 的
recordLimit控制(默认 1000)。
输出记录字段(records 每条):
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
id |
string | 帖子 ID | 3201234567890123456 |
shortCode |
string | 短链 code | C1aB2c3DEF |
url |
string | 帖子链接 | https://instagram.com/p/C1aB2c3DEF/ |
type |
string | Image / Video / Sidecar / Carousel | Sidecar |
caption |
string | 文案/配文 | Introducing the new Air Max. |
createdAt |
string | 发布时间 | 2026-05-20T10:00:00Z |
owner |
object | 作者信息 | |
owner.username |
string | 作者用户名 | nike |
owner.fullName |
string | 作者显示名 | Nike |
metrics |
object | 互动指标 | |
metrics.likesCount |
number | 点赞数 | 1250000 |
metrics.commentsCount |
number | 评论数 | 5600 |
metrics.sharesCount |
number | 分享数 | 8900 |
metrics.savesCount |
number | 收藏数 | 45000 |
metrics.viewsCount |
number | 视频浏览量 | 2300000 |
media |
array | 媒体列表 | |
media.type |
string | image / video | image |
media.url |
string | 高清图片/视频 URL | https://instagram.fcdn.net/.../xxx.jpg |
media.width |
number | 宽度 px | 1080 |
media.height |
number | 高度 px | 1350 |
hashtags |
array | 标签列表 | ["nike", "airmax"] |
mentions |
array | @提及 | ["@nikesoccer"] |
location |
object | 地点信息 | |
location.name |
string | 地点名称 | Beaverton, Oregon |
location.lat |
string | 纬度 | 45.4871 |
location.lng |
string | 经度 | -122.8037 |
comments |
array | 评论列表 | |
comments.id |
string | 评论 ID | 17862345678901234 |
comments.text |
string | 评论内容 | Love these! |
comments.createdAt |
string | 评论时间 | 2026-05-20T11:00:00Z |
comments.authorUsername |
string | 评论者用户名 | sneakerhead_99 |
comments.likesCount |
number | 评论点赞数 | 45 |
提交示例:
curl -X POST "https://api.antsdata.com/v1/scraper/instagram/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"deliveryMode": "async",
"recordLimit": 500,
"targets": [
{ "username": "nike" }
]
}'
返回 201 + { "id": <run 号>, "status": "queued" };随后按 id 轮询状态、取数(见快速开始)。
Reels — 账号短视频
采集指定账号的 Reels 短视频列表。
端点:POST /v1/scraper/instagram/reels
target 字段(targets[] 每个元素):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
username |
string | ✅ | 账号用户名 |
每个账号返回的短视频数由 run 的
recordLimit控制(默认 1000)。
输出记录字段(records 每条):
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
id |
string | Reel ID | 3109876543210987654 |
shortCode |
string | 短链 code | CxxY2z3ABC |
url |
string | Reel 链接 | https://instagram.com/reel/CxxY2z3ABC/ |
caption |
string | 文案 | Behind the design process |
createdAt |
string | 发布时间 | 2026-04-15T08:30:00Z |
videoUrl |
string | 视频直链 | https://instagram.fcdn.net/.../xxx.mp4 |
thumbnailUrl |
string | 封面缩略图 URL | https://instagram.fcdn.net/.../xxx.jpg |
duration |
string | 视频时长(秒) | 45.5 |
owner |
object | 作者信息 | |
owner.username |
string | 用户名 | nike |
owner.fullName |
string | 显示名 | Nike |
metrics |
object | 互动指标 | |
metrics.playCount |
number | 播放次数 | 8500000 |
metrics.likesCount |
number | 点赞数 | 420000 |
metrics.commentsCount |
number | 评论数 | 3200 |
metrics.sharesCount |
number | 分享数 | 15000 |
musicInfo |
object | 音乐信息 | |
musicInfo.trackName |
string | 曲目名称 | Original Sound - Nike |
musicInfo.artistName |
string | 艺术家名 | Nike Official |
musicInfo.musicUrl |
string | 音乐片段 URL | https://instagram.com/reuse/audio/xxx/ |
hashtags |
array | 标签列表 | ["nike"] |
mentions |
array | @提及 | [] |
transcript |
string | 音频转写文本(仅 transcribeAudio=true 时返回) | Welcome back to our channel... |
提交示例:
curl -X POST "https://api.antsdata.com/v1/scraper/instagram/reels" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"deliveryMode": "async",
"recordLimit": 300,
"targets": [
{ "username": "nike" }
]
}'
返回 201 + { "id": <run 号>, "status": "queued" };随后按 id 轮询状态、取数(见快速开始)。
Comments — 帖子评论
按帖子 URL 采集评论。
端点:POST /v1/scraper/instagram/comments
target 字段(targets[] 每个元素):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
post |
string | ✅ | 帖子 URL(如 https://www.instagram.com/p/DZyno24tbY2/) |
每个帖子返回的评论数由 run 的
recordLimit控制(默认 1000)。
输出记录字段(records 每条):
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
postShortCode |
string | 所属帖子 shortCode | C1aB2c3DEF |
comments |
array | 评论列表 | |
comments.id |
string | 评论 ID | 17862345678901234 |
comments.text |
string | 评论内容 | Love these! |
comments.createdAt |
string | 评论时间 | 2026-05-20T11:00:00Z |
comments.author |
object | 评论者信息 | |
comments.author.username |
string | 用户名 | sneakerhead_99 |
comments.author.fullName |
string | 显示名 | Mike |
comments.author.profilePicUrl |
string | 头像 URL | https://instagram.fcdn.net/.../xxx.jpg |
comments.author.isVerified |
boolean | 是否认证 | false |
comments.likesCount |
number | 评论点赞数 | 45 |
comments.repliesCount |
number | 该评论的回复数 | 3 |
comments.replies |
array | 回复列表 | |
comments.replies.id |
string | 回复 ID | 17862345678905678 |
comments.replies.text |
string | 回复内容 | Same here! |
comments.replies.authorUsername |
string | 回复者用户名 | jane.doe |
comments.replies.likesCount |
number | 回复点赞数 | 5 |
comments.replies.createdAt |
string | 回复时间 | 2026-05-20T11:15:00Z |
提交示例:
curl -X POST "https://api.antsdata.com/v1/scraper/instagram/comments" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"deliveryMode": "async",
"recordLimit": 200,
"targets": [
{ "post": "https://www.instagram.com/p/DZyno24tbY2/" }
]
}'
返回 201 + { "id": <run 号>, "status": "queued" };随后按 id 轮询状态、取数(见快速开始)。
取数与生命周期
提交 run 后:
- 轮询:
GET /v1/scraper/runs/{id}至status进入终态succeeded/failed(建议退避 1s→2s→5s)。 - 取数:
succeeded后GET /v1/scraper/runs/{id}/records?page=1&pageSize=20分页取记录,或GET /v1/scraper/runs/{id}/download?format=json|csv|excel下载整份产物。 - 部分成功:单目标失败不影响其余目标 —— 失败目标在
tasks[].status=failed且带errorMessage,只要 ≥1 目标成功 run 即succeeded并按成功条数出数。
字段完整说明、run 状态机、计费与错误码见 认证与错误处理。
FAQ
Q: 一次能采集多个账号 / 帖子吗?
可以。targets 是数组,一个 run 可含多个目标,内部并行执行,逐目标状态见 run 的 tasks[]。
Q: 私密或不存在的账号会怎样?
该目标在 tasks[] 里标记 status:"failed" 并带 errorMessage,其余目标照常出数,run 仍可 succeeded。
Q: 采集失败会扣费吗?
不会。计费按成功产出的记录条数结算,全部目标失败则释放冻结、不计费(详见 认证与错误处理)。
Q: recordLimit 是什么?
每个 target 的记录上限(默认 1000)。例如 posts 端点传 3 个 username、recordLimit: 500,则每个账号最多采 500 条帖子。
