# Gab 用户内容 API (gab.user_posts)

- Canonical page: [https://everyinfra.com/gab-api/user_posts](https://everyinfra.com/gab-api/user_posts?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "gab", "action": "user_posts", "params": {...}}
- Price: $0.001389 per call ($1.39 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

用户内容按 `username` 读取一个 Gab 账号的公开帖子，一行一条，带正文、点赞转发回复数、媒体链接和 UTC 发布时间。它回答「这个账号发了什么」，适合持续跟踪一个账号的发言，或者挑出它互动最高的几条。

`username` 填 Gab 的账号用户名，不带 @，也可以填账号主页的完整 URL。这一页按账号查，不是按人名搜索，所以填真名搜不到人。账号资料属于另一类能力，这一页只读帖子。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | Gab 账号用户名（不带 @）或完整账号主页 URL；profile 查账号资料，user_posts 查该账号公开帖子。不是按人名搜索。 |
| limit | integer (1–100) | no | 20 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_name | 作者昵称（显示名）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| repost_count | 转发数（区别于引用转发）。null 表示不公开。 |
| reply_count | 回复数，通常用于评论的子回复。null 表示不公开。 |
| media_urls | 媒体文件链接。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| 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": "gab",
  "action": "user_posts",
  "params": {
    "username": "a"
  }
}'
```

```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": "gab",
        "action": "user_posts",
        "params": {
            "username": "a",
        },
    },
    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 20. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "gab",
  "action": "user_posts",
  "results": [
    {
      "id": "•••",
      "url": "https://gab.com/a/posts/117335894018810516",
      "text": "The rise of AI is the biggest Gospel opportunity in our lifetimes for this reason btw. When your identity is in Christ you don't worry about such things.",
      "author_username": "•••",
      "author_name": "•••",
      "like_count": 21,
      "repost_count": 4,
      "reply_count": 7,
      "media_urls": [
        "https://m3.gab.com/media_attachments/6e/1a/8a/6e1a8a522b253d8f0bfb4fd3cb1e8d52.jpg"
      ],
      "posted_at": "2026-09-26T06:20:56.315000+00:00",
      "platform": "gab"
    },
    {
      "id": "•••",
      "url": "https://gab.com/a/posts/117334988995901537",
      "text": "imagine. You don’t need to worship the technology, but you also don’t need to fear it either. You need to understand it and put it to work in service of things that matter. Be humble enough to learn. Be disciplined enough to practice. The promise and vision that we have for AI is…",
      "author_username": "•••",
      "author_name": "•••",
      "like_count": 58,
      "repost_count": 7,
      "reply_count": 11,
      "posted_at": "2026-09-26T02:30:46.751000+00:00",
      "platform": "gab"
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `username` 可以填人名吗？

不可以。这一页不是按人名搜索，要填账号用户名，不带 @，或者账号主页的完整 URL。拿不准用户名时，先在 Gab 上确认主页，再填进来。

### 单次能读多少条？

不传 `limit` 时读 20 条，最多 100 条。没有翻页参数，一次调用只能拿到其中一部分；定期读取时，可以把 `id` 存下来，下次只看没见过的帖子。

### 读到某条帖子后怎么看它的回复？

把那条帖子的 `url` 交给回复列表那一页，读它相关的回复；想只看这一条的数据，把同一个 `url` 交给单条内容。这一页不返回回复内容，`reply_count` 只给回复数。

## Also

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