# Google 趋势 搜索热度走势 API (google_trends.interest_over_time)

- Canonical page: https://everyinfra.com/google-trends-api/interest_over_time
- Endpoint: POST /api/v1/social with {"platform": "google_trends", "action": "interest_over_time", "params": {...}}
- Price: $0.008806 per call ($8.81 per 1,000 requests); failed and empty results are not charged
- Returns: list
- Mode: sync; add "mode": "async" for slow tasks

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keywords | not declared | yes | not declared | 要比较的搜索词，1–5 个的数组（如 ["openai", "anthropic"]），每个最多 80 字、10 个词。 |
| country | not declared | no | not declared | 看哪个国家的热度，两位国家代码（如 us、gb、jp）；不填看全球。 |
| language | not declared | no | not declared | 语言，两位语言代码（如 en、ja）；一般不用填。 |
| search_type | not declared | no | not declared | 看哪种搜索的热度：web（网页，默认）、news、youtube、images、shopping。 |
| time_window | not declared | no | not declared | 时间范围：day（过去一天）、week（7 天）、month（30 天）、quarter（90 天）、year（12 个月，默认）、five_years（5 年）。 |
| limit | integer (1–) | no | not declared | 这次调用最多返回的条数，整数，至少为 1；不传按默认值，实际返回可能少于这个数。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| time | 这个时间点的起始时刻，UTC，ISO 8601；day、week 时间范围下按分钟或小时取点，看这个字段。 |
| date_from | 这个时间点的起始日期（YYYY-MM-DD）；按周统计时是一周的第一天。 |
| date_to | 这个时间点的结束日期（YYYY-MM-DD）；按小时、分钟取点时没有。 |
| values | 每个关键词在这个时间点的热度，0–100，以本次查询里所有关键词、所有时间点的最高值为 100；键是关键词。 |
| period_averages | 每个关键词在整个时间段的平均热度（每行相同），键是关键词。 |
| partial | true 表示这个时间点的数据还没统计完（通常是最后一个点）。 |
| 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": "google_trends",
  "action": "interest_over_time",
  "params": {
    "keywords": [
      "openai",
      "anthropic"
    ]
  }
}'
```

```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": "google_trends",
        "action": "interest_over_time",
        "params": {
            "keywords": [
                "openai",
                "anthropic",
            ],
        },
    },
    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": "google_trends",
  "action": "interest_over_time",
  "results": [
    {
      "time": …,
      "date_from": …,
      "date_to": …,
      "values": …,
      "period_averages": …,
      "partial": …,
      "platform": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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