# 公眾號的原始 ID（gh_ 開頭）是什麼？

> 原始 ID 是 gh_ 加一串十六進位制字元，註冊時生成、之後不變。它和微訊號、AppID、__biz 有什麼區別，介面怎麼收、怎麼返回它。

網頁版：https://okdata.online/zh-hant/answers/wechat-gh-original-id/

**簡短回答：**它是帳號永久不變的內部名稱：gh_ 後面跟一串十六進位制字元，通常 12 位，比如 gh_7a41c09e2b5d，註冊時生成，之後不能改。它不像微訊號那樣可以修改，也不像 AppID 那樣是開發者憑證。okdata 的公眾號搜尋把它作為 id 返回（每個搜到的號 $0.058），歷史文章介面用它列出文章，每頁 $0.02。

每個公眾號註冊時都會拿到一個原始 ID：字母 `gh_` 後面跟一串十六進位制字元，通常是 12 位，比如 `gh_7a41c09e2b5d`。號主在 mp.weixin.qq.com 後臺的帳號設定裡能看到它，在註冊資訊那一欄，寫作“原始ID”。讀者幾乎看不到它，所以投放方案裡列的一串公眾號名稱，沒法直接導進監測工具：這些工具都以 gh_ ID 為主鍵，因為它是唯一永遠不變的標識。名稱可以改，微訊號可以後設、可以改，原始 ID 卻跟著帳號一輩子。

## 四種帳號標識

| 標識 | 長什麼樣 | 誰定的 | 會不會變 | 用在哪裡 |
|---|---|---|---|---|
| 原始 ID | `gh_7a41c09e2b5d` | 微信，註冊時生成 | 不會 | 監測工具、歷史文章、第三方資料 |
| 微訊號 | `brand_news` | 號主自己，可不設 | 可以後設 | 告訴別人怎麼搜到這個號 |
| AppID | `wx` 開頭 | 微信，給開發者的 | 不會 | 呼叫微信官方介面操作自己的號 |
| `__biz` | `MzA5NTI3MjIwMA==` | 微信 | 不會 | 文章和主頁的網頁連結，見 [__biz 是什麼](/zh/answers/wechat-biz-parameter/) |

有兩點要留意。gh_ 開頭不代表一定是公眾號：小程式也有同樣 `gh_` 格式的原始 ID，微信官方文件裡網頁跳轉小程式時要填的就是小程式的 gh_ ID。另外，AppID 是你自己帳號的開發憑證，不能拿來查別人的號。

## 介面怎麼收、怎麼返回

- [公眾號搜尋](/zh/apis/wechat_mp/accounts/search/)按名稱或關鍵詞找號，每個結果帶 `id`（gh_ ID）、`username`（設定了的話是微訊號）和 `name`。按返回的帳號數計費。
- [公眾號歷史文章](/zh/apis/wechat_mp/accounts/articles/list/)用 gh_ ID 或微訊號作為 `id`，從新到舊列出已釋出的文章。它不認 `__biz`。
- [文章詳情](/zh/apis/wechat_mp/articles/get/)對任意文章連結返回 `author.id`，也就是發文帳號的 gh_ ID。

| 任務 | 呼叫次數 | 費用 |
|---|---|---|
| 名稱換 gh_ ID | 1 | 每個返回的號 $0.058，最多 $0.58 |
| 一條文章連結換髮文帳號的 gh_ ID | 1 | $0.02 |
| 某個 gh_ ID 最新 10 篇文章 | 1 | $0.02 |

## 示例

```bash
curl -G "https://api.okdata.online/v1/wechat_mp/accounts/articles/list" \
  -H "Authorization: Bearer $OKDATA_API_KEY" \
  --data-urlencode 'id=gh_7a41c09e2b5d' \
  --data-urlencode 'fields=id,title,published_at,url'
```

## 限制

- 做過帳號遷移的公眾號，遷移後原始 ID 會變成新號的。存著的 gh_ ID 突然拉不到新文章，就按名稱重新搜一次。
- 常見名稱可能搜出好幾個長得像的號，存 ID 之前先核對 `name`。
- 把一批名稱換成 gh_ ID，或者免費從文章網頁原始碼裡找，見[查公眾號的 biz 和原始 ID](/zh/answers/find-wechat-official-account-id/)；整號匯出見[匯出公眾號全部文章](/zh/answers/export-wechat-official-account-articles/)。

## 用到的介面

- [公眾號搜尋](https://okdata.online/zh/apis/wechat_mp/accounts/search/) `wechat_mp.accounts.search`：$0.058/條 · 每次最多 $0.58
- [公眾號歷史文章](https://okdata.online/zh/apis/wechat_mp/accounts/articles/list/) `wechat_mp.accounts.articles.list`：$0.02/次 · 每頁約 10 篇文章
- [公眾號文章詳情](https://okdata.online/zh/apis/wechat_mp/articles/get/) `wechat_mp.articles.get`：$0.02/次

## 更多微信公眾號內容

- [微信公眾號 API](https://okdata.online/zh/apis/wechat_mp/)
- [公眾號 API Python 教程：把文章轉成 Markdown 給 RAG 用（2026）](https://okdata.online/zh/guides/wechat-official-account-api-python/)
- [怎麼拿到一個公眾號的歷史文章和全文](https://okdata.online/zh/guides/wechat-official-account-articles/)
- [公眾號文章資料 API 多少錢？](https://okdata.online/zh/answers/wechat-official-account-api-price/)
- [為什麼 ChatGPT、Claude 打不開公眾號文章連結？怎麼讓 AI 讀到全文？](https://okdata.online/zh/answers/ai-read-wechat-article-link/)
- [怎麼不登入匯出一個公眾號的全部歷史文章？](https://okdata.online/zh/answers/export-wechat-official-account-articles/)
- [怎麼監控競品公眾號每天發了什麼？](https://okdata.online/zh/answers/monitor-competitor-wechat-official-accounts/)
- [公眾號文章連結裡的 __biz 是什麼？](https://okdata.online/zh/answers/wechat-biz-parameter/)
- [公眾號的原始 ID（gh_ 開頭）是什麼？](https://okdata.online/zh/answers/wechat-gh-original-id/)
- [平台官方 API 和第三方資料介面怎麼選（2026）](https://okdata.online/zh/compare/official-apis-vs-data-apis/)
- [社媒資料 MCP 伺服器：自己部署還是用託管的](https://okdata.online/zh/compare/social-media-data-mcp-servers/)
- [公眾號文章和閱讀數介面有哪些？官方介面、第三方 API、開源工具、資料平台 4 類方案怎麼選（2026）](https://okdata.online/zh/compare/wechat-article-data-apis/)
- [獲取微信公眾號資料的幾種辦法：官方介面、RSS 橋接和資料介面](https://okdata.online/zh/compare/wechat-official-account-data-apis/)
- [讓 AI 讀小紅書、抖音、公眾號的 MCP 有哪些？開源自部署、瀏覽器自動化、託管 3 類怎麼選（Claude、Cursor、豆包）](https://okdata.online/zh/compare/xiaohongshu-douyin-wechat-mcp-servers/)

## 資料來源

- [WeChat open tags (微信開放文件): appid is the ID starting with wx, username the original ID starting with gh_](https://developers.weixin.qq.com/doc/service/guide/h5/opentag.html) (讀取於 2026-11-12)
- [Feed request listing an account's name, gh_ ID and biz together (feeddd/feeds issue #3438)](https://github.com/feeddd/feeds/issues/3438) (讀取於 2026-11-12)

這個問題出現過的地方（讀取於 2026-11-12）：

- https://developers.weixin.qq.com/community/personal/oCJUswyaeSsHJf1a36Pk7VXvxtCc/question
- https://github.com/feeddd/feeds/issues/3438

更新於 2026-11-12
