# 微信公众号 微信指数 API (wechat_oa.wechat_index)

- Canonical page: [https://everyinfra.com/wechat-oa-api/wechat_index](https://everyinfra.com/wechat-oa-api/wechat_index?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "wechat_oa", "action": "wechat_index", "params": {...}}
- Price: $0.005556 per call ($5.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

微信指数按 `keyword` 返回一个词的热度指数：最新一期的指数值 `latest_index`、这一期的日期 `latest_date`、随时间变化的序列 `trend`，以及序列里的数据点数量 `data_points`。给几个候选选题排优先级，或者看一个话题是在升温还是降温，这几项就够用。

一次调用返回一个对象。联想出来的候选词先去搜索联想那一页拿，再逐个交给这个接口读指数，就能按热度挑词。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | article_search 搜文章，account_search 搜公众号，mini_program_search 搜小程序，search_suggestions 取联想词，wechat_index 取关键词指数；这些都不是个人微信聊天搜索。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| keyword | 查询的关键词。 |
| latest_index | 最新一期的指数值。 |
| latest_date | 最新一期的日期。 |
| data_points | 趋势数据点数量。 |
| trend | 指数随时间的变化序列。 |
| 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": "wechat_oa",
  "action": "wechat_index",
  "params": {
    "keyword": "科技"
  }
}'
```

```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": "wechat_oa",
        "action": "wechat_index",
        "params": {
            "keyword": "科技",
        },
    },
    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": "wechat_oa",
  "action": "wechat_index",
  "results": {
    "keyword": …,
    "latest_index": …,
    "latest_date": …,
    "data_points": …,
    "trend": …,
    "platform": …
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `latest_index` 的数值怎么用？

它是最新一期的指数值，只代表一个时点，`latest_date` 标明是哪一期。比较几个词时，各自读出 `latest_index` 再对照；要看走势就读 `trend`，`data_points` 是 `trend` 里数据点的数量，可以用来核对序列长度。

### `trend` 里数据点的间隔是多少？

没有写明。`trend` 是指数随时间变化的序列，`data_points` 给出点数，但相邻两点隔多久、多久更新一次，不要预设成按日或按周，请以实际返回的 `latest_date` 和 `trend` 为准。

### 查到指数之后，怎么看这个词下的具体文章？

指数只回答热度，不返回文章。要看这个词下的内容，把同一个 `keyword` 交给公众号文章搜索；要找相关的公众号或小程序，改用公众号搜索和小程序搜索，它们和指数共用同一个 `keyword` 参数，前者返回账号列表，后者返回小程序列表。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=wechat_oa
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
