# GitHub 用户资料 API (github.user)

- Canonical page: https://everyinfra.com/github-api/user
- Endpoint: POST /api/v1/social with {"platform": "github", "action": "user", "params": {...}}
- Price: $0.000958 per call ($0.96 per 1,000 requests); failed and empty results are not charged
- Returns: single object
- 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=github&action=user

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | GitHub 用户名或主页链接，例如 torvalds；组织账号也可以。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| username | 用户名（@handle）。 |
| id | GitHub 内部数字 ID（字符串）。 |
| display_name | 显示名，可能与 username 不同。 |
| bio | 个人简介，账号自己填写的文本。可能含换行和 emoji。 |
| company | 个人资料里填的公司；没填时没有。 |
| location | 地理位置描述，原文透传，格式随平台而异。 |
| website | 账号或商家填写的外链网址。 |
| twitter_username | 个人资料里填的 X（Twitter）用户名；没填时没有。 |
| follower_count | 粉丝数。null 表示不公开，不等于 0。 |
| following_count | 关注数。null 表示不公开，不等于 0。 |
| public_repo_count | 公开仓库数。 |
| public_gist_count | 公开 Gist 数。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| url | 该记录在原平台上的可访问链接。 |
| account_type | 账号类型：User、Bot 或 Organization。 |
| created_at | 创建时间，格式同 posted_at。 |
| 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": "github",
  "action": "user",
  "params": {
    "username": "torvalds"
  }
}'
```

```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": "github",
        "action": "user",
        "params": {
            "username": "torvalds",
        },
    },
    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": "github",
  "action": "user",
  "results": {
    "username": …,
    "id": …,
    "display_name": …,
    "bio": …,
    "company": …,
    "location": …,
    "website": …,
    "twitter_username": …,
    "follower_count": …,
    "following_count": …,
    "public_repo_count": …,
    "public_gist_count": …,
    "avatar_url": …,
    "url": …,
    "account_type": …,
    "created_at": …,
    "platform": …
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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