# Instagram 话题内容 API (instagram.hashtag)

- Canonical page: https://everyinfra.com/instagram-api/hashtag
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "instagram", "action": "hashtag", "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 100 per call
- Mode: sync; add "mode": "async" for slow tasks

Instagram 话题内容按 `hashtag` 列出一个话题标签下的帖子，每条带链接、正文、媒体类型、点赞评论和浏览数、作者用户名与昵称、发布时间、地点，以及正文里的话题数组 `hashtags` 和展示的几条评论 `top_comments`。它回答「这个话题下大家在发什么、哪些互动高」，适合选题调研、活动话题监测和寻找在这个话题里发帖的创作者。

`hashtag` 不带 #，例如 photography，列的是标签下的内容，不是账号。默认返回 30 条，单次最多 100 条。`author_follower_count` 直接给出发帖人的粉丝数，null 表示不公开；`is_comments_disabled` 标出帖子是否关了评论。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| hashtag | not declared | yes | not declared | Instagram 话题标签，不带 #，例如 coffee；用于列该标签下的 posts/reels，不是账号 handle。 |
| results_type | enum: reel / reels | no | not declared | discover/hashtag 省略此参数时返回 posts（普通帖子）；显式传参只接受 reel 或 reels，均切换到短视频结果。posts 不是可显式提交的枚举值，其他显式值也会在公开 API 参数校验阶段返回 422；该参数不是 JSON/CSV 输出格式选择。 |
| tag | not declared | no | not declared | hashtag 的兼容输入，去掉开头 #；hashtag 同时存在时优先 hashtag，公开请求仍须提供必填 hashtag。 |
| limit | integer (1–100) | no | 30 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 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）；没有时不出现这个字段。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## 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": "hashtag",
  "params": {
    "hashtag": "photography"
  }
}'
```

```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": "hashtag",
        "params": {
            "hashtag": "photography",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `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": "hashtag",
  "results": [
    {
      "post_id": "DdvvbQ1ufeL",
      "url": "https://www.instagram.com/p/DdvvbQ1ufeL/",
      "text": "📸@••• \n\n@••• \n@••• \n\n#photography #hobbymodel #jewelry #tattoo #quarry",
      "media_type": "image",
      "like_count": 0,
      "comment_count": 0,
      "author_username": "•••",
      "author_name": "•••",
      "posted_at": "2026-09-26T09:43:53+00:00",
      "location": "Aschaffenburg, Germany",
      "hashtags": [
        "photography",
        "hobbymodel",
        "jewelry"
      ],
      "platform": "instagram"
    },
    {
      "post_id": "Ddvva9EEUmp",
      "url": "https://www.instagram.com/p/Ddvva9EEUmp/",
      "text": "✨..♠️❤️..✨\n\n#instareels #viralpost #malvan #instagram #photography",
      "media_type": "image",
      "like_count": 0,
      "comment_count": 0,
      "author_username": "•••",
      "author_name": "•••",
      "posted_at": "2026-09-26T09:43:48+00:00",
      "location": "Malvan , Sindhudurg",
      "hashtags": [
        "instareels",
        "viralpost",
        "malvan"
      ],
      "platform": "instagram"
    }
  ],
  "count": 30,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 话题内容怎么只看 Reels？

给 `results_type` 传 `reel` 或 `reels`，两个值都会切换到短视频结果；不传这个参数，返回的就是普通帖子。普通帖子不能显式提交，写 posts 或其他任何值，公开接口在参数校验阶段都会返回 422。

### `hashtag` 和 `tag` 该填哪一个？

填 `hashtag`，不带 #。`tag` 是它的兼容写法，同样要去掉开头的 #；两个都传时以 `hashtag` 为准，而且公开请求里 `hashtag` 仍然必填，只传 `tag` 过不了校验。

### 话题内容和单条内容那一页怎么分工？

话题内容是发现用的：给一个标签，返回一批帖子。手里已经有具体帖子链接时，用单条内容那一页，传链接数组读指定的帖子。两页的字段基本一致，所以可以先在这里发现，再用 `url` 到那一页补读。

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