# YouTube 频道链接和编号互查 API (youtube.resolve_channel)

- Canonical page: [https://everyinfra.com/youtube-api/resolve_channel](https://everyinfra.com/youtube-api/resolve_channel?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "resolve_channel", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls 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=youtube&action=resolve_channel

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| channel | not declared | yes | not declared | 要查的频道，四种写法都行：频道链接（youtube.com/@NASA、youtube.com/channel/UC…）、@用户名、UC 开头的频道编号、频道名。传频道名时先当 @用户名查，查不到按名字搜、取第一个，返回的 matched_by 写明是哪一种。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| channel_id | 频道 ID（UC 开头）。 |
| username | 用户名（@handle）。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| url | 该记录在原平台上的可访问链接。 |
| channel_url | 带频道编号的频道链接（youtube.com/channel/UC…）。 |
| matched_by | 这次是怎么对上的，只有 channel 传的是频道名时才有：handle 是把频道名当 @用户名对上了，search 是按名字搜到的第一个频道，要自己核对是不是要找的频道。传频道链接、@用户名或 UC 开头的频道编号时没有这个字段。 |
| 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": "youtube",
  "action": "resolve_channel",
  "params": {
    "channel": "@NASA"
  }
}'
```

```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": "youtube",
        "action": "resolve_channel",
        "params": {
            "channel": "@NASA",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-11-21T07:24:23Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "resolve_channel",
  "results": {
    "channel_id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "url": "https://www.youtube.com/@NASA",
    "channel_url": "https://www.youtube.com/channel/UCLA_DiR1FfKNvjuUpBHmylQ",
    "platform": "youtube"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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