# Facebook 主页活动 API (facebook.page_events)

- Canonical page: https://everyinfra.com/facebook-api/page_events
- Endpoint: POST /api/v1/social with {"platform": "facebook", "action": "page_events", "params": {...}}
- Price: $0.000958 per call ($0.96 per 1,000 requests); failed and empty results are not charged
- Returns: list, one page of up to 10 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

Facebook 主页活动按 `url` 列出一个公共主页办的活动，即将开始的和已经结束的都有，每行带名称、链接、开始时间、地点、城市 `city`、主办主页 `host_name`，以及是否线上、是否已结束、是否已取消。它回答「这个主页办过什么、接下来要办什么」，适合盯竞品或合作场地的活动排期。

`url` 填公共主页链接，如 https://www.facebook.com/brickyardoldtown，也收 /p/<名字>-<数字> 形式。联合主办的活动，`host_name` 可能是合作方的主页；`city` 用原平台的语言书写，没有中英归一，按城市统计前要自己归一。每页约 10 个，令牌 24 小时有效。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 公共主页链接，如 https://www.facebook.com/brickyardoldtown，也收 /p/<名字>-<数字> 形式。返回这个主页办的活动，即将开始的和已结束的都有。 |
| page_token | not declared | no | not declared | 翻页令牌：把上一次响应里的 next_page_token 原样传回，拿下一页；不传从第一页开始。令牌 24 小时有效，每页算一次调用。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| starts_at | 活动开始时间（events_search、page_events；ISO 8601，UTC）。 |
| date_text | Facebook 页面上显示的活动时间原文，带当地时区（events_search、page_events），如「Sat, Oct 31 at 8:00 PM CDT」。 |
| place_name | 活动地点名称或地址（events_search、page_events）；线上活动可能没有。 |
| city | 城市名，用原平台的语言书写，未做中英归一。 |
| host_name | 办活动的主页名称（page_events）；联合主办时可能是合作方主页。 |
| is_online | 是否线上活动（events_search、page_events）。 |
| is_past | 活动是否已结束（events_search、page_events）。 |
| is_canceled | 活动是否已取消（page_events）。 |
| next_page_token | 翻页令牌（events_search、page_events）：作为下一次请求的 page_token 原样传回取下一页；同一页每行的值相同，响应顶层也有同一个 next_page_token。没有该字段即到底。 |
| 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": "facebook",
  "action": "page_events",
  "params": {
    "url": "https://www.facebook.com/brickyardoldtown"
  }
}'
```

```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": "facebook",
        "action": "page_events",
        "params": {
            "url": "https://www.facebook.com/brickyardoldtown",
        },
    },
    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": "facebook",
  "action": "page_events",
  "results": [
    {
      "id": …,
      "url": …,
      "name": …,
      "starts_at": …,
      "date_text": …,
      "place_name": …,
      "city": …,
      "host_name": …,
      "is_online": …,
      "is_past": …,
      "is_canceled": …,
      "next_page_token": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 怎么只看还会举办的活动？

这一页把即将开始的和已结束的活动放在一起返回，用 `is_past` 筛出为 false 的行，再排除 `is_canceled` 为真的，剩下的就是还会举办的活动。排期时用 `starts_at` 排序，`date_text` 则是页面上带当地时区的原文。

### `host_name` 为什么不是我查的那个主页？

活动可以联合主办，这时 `host_name` 可能是合作方的主页，而不是你传入的 `url` 对应的主页。统计一个主页自己办了多少场时，要先核对 `host_name`，把合作方主办的场次单独标出来。

### 想知道一场活动的热度，用这一页能看吗？

不能，这一页没有参加和感兴趣的人数。要看这两个数，用活动搜索那一页，它还带票价说明和图片。可以把这里读到的活动名当作关键词去试搜，再按名称和开始时间对上同一场活动。

## Also

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