登录开始免费试用
easyCoexistence 官方 API

通过 API 获取 Instagram 粉丝人口统计数据

Instagram 账户洞察端点在 metric=follower_demographics、period=lifetime、metric_type=total_value 的请求中返回粉丝人口统计数据,需指定 timeframe,并按年龄、性别、城市或国家细分。engaged_audience_demographics 对与内容互动的账户返回同样的数据。Meta 仅返回前 45 个值;粉丝数据要求账户至少有 100 名粉丝,互动受众数据要求 timeframe 内至少有 100 次互动。

easyCoexistence 通过 get_social_insights 读取 Instagram 粉丝与互动受众的人口统计数据,因此 Claude、ChatGPT 或您自己的代码可以询问哪些国家、城市或年龄段关注该账户,并获得所连接账户的 Meta 数据。

100 followers

低于此数值时,账户不会返回 follower_demographics。

100 engagements

在 timeframe 内须达到此数量,才会返回 engaged_audience_demographics。

Top 45

人口统计指标只返回表现最靠前的 45 项,较小的城市和国家会被排除在外。

19 Aug 2024

last_14_days、last_30_days、last_90_days 和 prev_month 对 engaged_audience_demographics 停止生效的时间(所有版本)。

48 hours

账户指标背后数据的延迟时长。

有哪些人口统计指标?

Meta 账户洞察参考文档中有两项指标,均通过 GET /<IG_ID>/insights 读取;另有两组较旧的指标,旧代码仍会请求:

  • follower_demographics:账户粉丝的人口统计特征。
  • engaged_audience_demographics:同样的数据,针对互动受众,即与其内容发生互动的账户。
  • 两者共同参数:period 为 lifetime、metric_type 为 total_value、一个 timeframe,以及按年龄、城市、国家或性别的 breakdown。
  • audience_gender_age、audience_locale、audience_country 和 audience_city:已于 2023 年 12 月 11 日停用。
  • reached_audience_demographics:见于 Meta 2024 年变更日志,但不在其当前指标表中。

如何请求粉丝人口统计数据?

需提供指标、period=lifetime、metric_type=total_value、timeframe 以及一个 breakdown。timeframe 替代 since 和 until,人口统计指标不支持这两者,且 timeframe 为必填。使用 Instagram Login 时,访问令牌需要 instagram_business_basic 和 instagram_business_manage_insights 权限,请求发往 graph.instagram.com:

Followers by country, this month
GET https://graph.instagram.com/<IG_ID>/insights
  ?metric=follower_demographics
  &period=lifetime
  &timeframe=this_month
  &breakdown=country
  &metric_type=total_value
  &access_token=<INSTAGRAM_USER_ACCESS_TOKEN>

响应是什么样的?

计数位于 total_value.breakdowns 中。dimension_keys 列出所请求的 timeframe 与 breakdown,每条结果包含 dimension_values,即 timeframe 与 breakdown 中的一个值,以及一个计数。Meta 的示例展示了按国家统计的互动受众,国家以两位字母代码表示,例如 US 和 ES:

The response shape, broken down by country
{
  "data": [
    {
      "name": "follower_demographics",
      "period": "lifetime",
      "title": "<TITLE>",
      "description": "<DESCRIPTION>",
      "total_value": {
        "breakdowns": [
          {
            "dimension_keys": ["timeframe", "country"],
            "results": [
              { "dimension_values": ["<TIMEFRAME>", "<COUNTRY_CODE>"], "value": <COUNT> },
              { "dimension_values": ["<TIMEFRAME>", "<COUNTRY_CODE>"], "value": <COUNT> }
            ]
          }
        ]
      },
      "id": "<IG_ID>/insights/follower_demographics/lifetime"
    }
  ]
}

哪些时间范围有效?

Meta 参考文档列出两项指标均支持的 last_14_days、last_30_days、last_90_days、prev_month、this_month 和 this_week;对互动受众而言,this_month 表示最近 30 天,this_week 表示最近 7 天。对于 engaged_audience_demographics,前四个时间范围在 v20.0 起以及 2024 年 8 月 19 日的所有版本中均已失效,因此请使用 this_week 或 this_month。该变更日志条目未提及 follower_demographics。

适用哪些门槛与限制?

Meta 账户洞察参考文档为人口统计指标设定以下规则:

  • 粉丝少于 100 人的账户不会返回 follower_demographics。
  • 时间范围内互动少于 100 次的,不会返回 engaged_audience_demographics。
  • 仅返回表现最靠前的项,较小的城市和国家会被排除。
  • 只统计有人口统计数据的观众,因此各项数值之和可能少于粉丝数。
  • 缺失数据返回空集而非 0,数据可能延迟最多 48 小时。
  • 若所请求的指标不支持某个 breakdown 细分,整个调用都会失败,并返回错误“An unknown error has occurred”。

人口统计数据能否与 Instagram Login 配合使用?

可以。Meta 于 2025 年 1 月 21 日向 Instagram Login 应用开放账户与媒体洞察功能,其账户洞察参考文档列出 Instagram Login 所需的 instagram_business_basic 与 instagram_business_manage_insights 权限,并以 graph.instagram.com 为主机。账户必须是商业或创作者账户,这是 Meta 的 Instagram Platform 所要求的。

get_social_insights 如何读取人口统计数据?

将 metrics 设为 follower_demographics 或 engaged_audience_demographics,period 设为 lifetime,并在 params 中携带 timeframe、breakdown 和 metric_type。easyCoexistence 使用所连接账户的访问令牌调用该账户的 GET /<IG_ID>/insights,并原样返回 Meta 的响应,因此 Claude 或 ChatGPT 可以说明哪些国家、城市或年龄段关注该账户。

get_social_insights arguments for followers by age
{
  "account_id": "<ACCOUNT_ID>",
  "metrics": ["follower_demographics"],
  "period": "lifetime",
  "params": {
    "timeframe": "this_month",
    "breakdown": "age",
    "metric_type": "total_value"
  }
}

常见错误

  • 传入 since 和 until。人口统计指标不支持这两个参数:timeframe 设定范围,且为必填。
  • 对互动受众使用 last_30_days 或 last_90_days。这些时间范围自 2024 年 8 月 19 日起,在所有版本中对 engaged_audience_demographics 均已失效。
  • 将某一细分的各项相加来得到粉丝数。只统计有人口统计数据的观众,且只返回前 45 个值,因此合计会偏少。
  • 期望小账户有数据。粉丝人口统计需要 100 名粉丝,互动受众需要时间范围内 100 次互动。
使用 EasyCoexistence 完成这些操作

每个连接每月 US$ 9 至 US$ 0.75,连接越多单价越低,前 3 天免费试用。

常见问题

Instagram 账户需要多少粉丝才能获得人口统计数据?

100 名。低于此数,Meta 不会返回 follower_demographics;engaged_audience_demographics 需要时间范围内 100 次互动。

为什么 Instagram 只返回 45 个城市?

Meta 的人口统计指标只返回表现最靠前的 45 项,因此较小的城市和国家会被排除在外。

什么替代了 Instagram API 中的 audience_gender_age?

follower_demographics,可按年龄、性别、城市或国家细分。Meta 已于 2023 年 12 月 11 日停用 audience_gender_age、audience_locale、audience_country 和 audience_city。

follower_demographics 能否与 since 和 until 一起使用?

不能。人口统计指标不支持 since 和 until;应改用 timeframe 参数设定范围,且该参数为必填。

继续阅读

两分钟连接您的第一个渠道。

无需等待平台审核。连接 WhatsApp、Instagram、TikTok 或其他渠道,然后让您的 AI 发布、回复或生成报告,看它如何运作。

  • 免费试用 3 天
  • 随时取消
  • 仅使用官方 API
  • 全天候 24/7 监控

验证时间