> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# How do I find a WeChat account ID from an article URL and retrieve its history?

> Extract data.content.user_name from wechat_mp.v2.fetch_article_detail_h5 and pass that exact value as username to wechat_mp.v2.fetch_account_articles without substituting nick_name, author, __biz, or legacy fakeid.

To find a WeChat Official Account’s earlier articles from one article link, read `data.content.user_name` from the [article details](/faq/wechat-article-full-text) and pass `data.content.user_name` unchanged as `username` to `wechat_mp.v2.fetch_account_articles`. The display name, the author byline, and the `__biz` value of a long link cannot be passed as `username`. If you already have a successful saved detail response or a verified account ID, pass the verified account ID directly as `username`.

## Fetch the first article page using `username`

Replace `<user_name_from_article>` in the sample with the returned account ID. `wechat_mp.v2.fetch_account_articles` accepts `gh_…`, `gh_…@app` and custom WeChat IDs as `username`. Start the first page with an empty `offset`.

```bash
curl -sS https://api.beatapi.io/v1/social-data/call \
  -H "Authorization: Bearer $BEATAPI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"action":"wechat_mp.v2.fetch_account_articles","params":{"username":"<user_name_from_article>","raw":false,"item_show_type":0,"offset":""}}' \
  -o wechat-articles-page-1.json
```

Check that the response belongs to the intended account and that `data.articles` reaches the dates you need. For more articles, continue with the returned cursor as the [article history guide](/guides/wechat-account-articles) describes.

## What can you do with each identifier?

| Value you have              | How to use the value                                                                                                                                                                             |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data.content.user_name`    | Pass `data.content.user_name` as `username` for the profile or the article list. Keep the returned value unchanged.                                                                              |
| `nick_name` or `author`     | `nick_name` is the account display name and `author` is the article byline; use `nick_name` and `author` for manual review only. With only a name, first find a public article from the account. |
| `__biz` from a long link    | Keep `__biz` with the original URL. Use the URL to get article details, then read `user_name`.                                                                                                   |
| `fakeid` from an old export | Keep the old value as `legacy_fakeid` and verify the account from an original source.                                                                                                            |

If two articles show “City Observer” as the display name, compare the account ID in each article’s details before joining the records. Fetching one article’s details and one account-list page are two separate requests; reuse a saved detail response when you have one. [BeatAPI pricing](https://beatapi.io/pricing)

If an older sheet has only a `fakeid` but a teammate has the original article link, reuse the saved article detail if available and read `data.content.user_name`. Keep the old `fakeid` value in its own column and pass the verified `user_name` value as `username` for the article list. When display names coincide, match accounts by the verified ID.

## Turn a saved article into a checked history request

Suppose a colleague sends an article and asks for the account’s earlier posts. Reuse an existing successful H5 detail response if you have one. Otherwise retrieve the article once with `wechat_mp.v2.fetch_article_detail_h5`, and record `url` and an explicit `raw:true` or `raw:false`. Both raw modes return `data.content.user_name`. When you reuse saved details, you pay only for the list pages you actually request; see the [pricing page](https://beatapi.io/pricing) for current rates.

Save `detail-meta.json` beside `article.json`:

```json
{"action":"wechat_mp.v2.fetch_article_detail_h5","params":{"url":"https://mp.weixin.qq.com/s/example-token","raw":false},"http_status":200,"collected_at":"2026-11-17T03:15:00+08:00","response_file":"article.json"}
```

Replace the example URL and time with the exact original request and the actual collection time. Save the script below as `account_handoff.py` and run `python3 account_handoff.py detail-meta.json account-handoff`. `account_handoff.py` checks the action, the successful envelope, the source URL, and the documented `username` syntax, then writes the unchanged source response, `source_sha256`, `account-evidence.json`, and `history-request.json`. `account_handoff.py` sends no network request and adds no charge. When the response URL differs from the recorded request URL, `account_handoff.py` stops instead of treating the response as the same article; resolve the provenance before continuing.

```python
import hashlib, json, pathlib, re, sys
from datetime import datetime
from urllib.parse import urlsplit, parse_qs
metadata, target = map(pathlib.Path, sys.argv[1:3])
metadata_bytes = metadata.read_bytes()
m = json.loads(metadata_bytes)
if m['action'] != 'wechat_mp.v2.fetch_article_detail_h5' or type(m.get('http_status')) is not int or m['http_status'] != 200:
    raise ValueError('Require a successful H5 detail request')
p = m['params']
if set(p) != {'url','raw'} or type(p['raw']) is not bool:
    raise ValueError('Record url and explicit raw mode')
url = p['url']
if not isinstance(url,str) or not url or any(c.isspace() or ord(c)<32 or ord(c)==127 for c in url):
    raise ValueError('Use an intact public URL without whitespace/control characters')
u = urlsplit(url); q = parse_qs(u.query, keep_blank_values=True)
if any(k.startswith('amp;') for k in q) or any(k.lower() in ('pass_ticket','key','uin','ticket','access_token') for k in q):
    raise ValueError('Use a public share URL, not HTML markup or browser-session parameters')
for k in ('__biz','mid','idx','sn'):
    if k in q and (len(q[k])!=1 or not q[k][0] or any(c.isspace() or ord(c)<32 or ord(c)==127 for c in q[k][0])):
        raise ValueError('Ambiguous or invalid article component')
if u.scheme not in ('http','https') or u.hostname != 'mp.weixin.qq.com' or u.username is not None or u.password is not None or u.port not in (None,80,443):
    raise ValueError('Not a WeChat article URL')
short = u.path.startswith('/s/') and bool(u.path[3:]) and '/' not in u.path[3:]
long = u.path == '/s' and all(len(q.get(k,[])) == 1 and q[k][0] for k in ('__biz','mid','idx'))
long = long and q['mid'][0].isascii() and q['mid'][0].isdigit() and int(q['mid'][0]) >= 1 and q['idx'][0].isascii() and q['idx'][0].isdigit() and int(q['idx'][0]) >= 1
if not short and not long: raise ValueError('Missing article locator')
t = datetime.fromisoformat(m['collected_at'].replace('Z','+00:00'))
if t.tzinfo is None: raise ValueError('Use a timezone-aware collection time')
raw = (metadata.parent / m['response_file']).read_bytes(); body = json.loads(raw)
if body.get('status') != 'succeeded' or body.get('action') != m['action'] or body.get('error') is not None:
    raise ValueError('Response is not the recorded successful action')
rid = body.get('request_id')
if not isinstance(rid,str) or not rid.strip(): raise ValueError('Missing request ID')
data = body['data']
if data.get('url') != url: raise ValueError('Response URL differs from recorded request')
content = data['content']; username = content.get('user_name')
if not isinstance(username,str) or len(username)>80 or not re.fullmatch(r'[0-9A-Za-z][-_0-9A-Za-z]{1,63}(@[0-9A-Za-z]{1,16})?',username):
    raise ValueError('Missing or invalid account username; never infer from name/byline')
request = {'action':'wechat_mp.v2.fetch_account_articles','params':{'username':username,'offset':'','item_show_type':0,'raw':False}}
evidence = {'source_url':url,'collected_at':m['collected_at'],'request_id':rid,'source_sha256':hashlib.sha256(raw).hexdigest(),
            'metadata_sha256':hashlib.sha256(metadata_bytes).hexdigest(),
            'canonical_gh_candidate': bool(re.fullmatch(r'gh_[A-Za-z0-9_]+',username)),
            'username':username,'nick_name':content.get('nick_name'),'author_byline':content.get('author'),
            'identity_scope':'returned account identifier; not proof of legal ownership','next_request_executed':False}
target.mkdir(parents=True,exist_ok=False)
(target/'source.json').write_bytes(raw)
(target/'request-metadata.json').write_bytes(metadata_bytes)
for name,value in [('account-evidence.json',evidence),('history-request.json',request)]:
    (target/name).write_text(json.dumps(value,ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps({'username':username,'next_request_executed':False}))

```

Review `history-request.json`, then send the exact body to the social-data call endpoint within your own budget. A custom username or `gh_…@app` stays as returned; `account_handoff.py` never rewrites a custom username or `gh_…@app` identifier into a synthetic `gh_` ID. `history-request.json` starts from an empty `offset` with `raw=false` and the article tab. Do not pass the source article’s `mid`, `comment_id`, author, or display name as `username`.

Check the handoff package before sending `history-request.json`: the generated `username` must exactly equal `data.content.user_name` in `source.json`, and `source_sha256` must match `source.json`. A missing ID, a numeric ID, a nickname containing spaces, or a failed response produces no handoff, and an existing output directory is refused. Valid syntax does not prove that the account still exists or owns a brand; the next successful list response is the separate retrieval check. The linked history and daily-sync helpers currently require a canonical `gh_` account and a matching response account. A custom username that the API accepts can still fail the stricter `gh_`-only helpers; do not rename the username to bypass those helpers’ identity checks.

If you have only a nickname, first establish the intended account from an article or a validated account-search result. Matching names alone do not establish identity.

## Why decoding \_\_biz does not give you the history username

The long-link query component `__biz` identifies the account context of the article link. `__biz` is not the same identifier as `gh_…`, and `mid` plus `idx` distinguish articles within the `__biz` context. Keep the full URL: dropping `mid` and `idx` or decoding a Base64-looking `__biz` value does not create a valid history request. The published BeatAPI input and output contracts have no conversion from `__biz` to `gh_`.

A custom username that passes the syntax check is also not proof of the correct account. Do not assume that an arbitrary `__biz` value is always rejected before billing: some strings fit the broad `username` pattern. Verify that the `username` value came from `data.content.user_name`, not only that the characters are valid.

For a long link such as `https://mp.weixin.qq.com/s?__biz=Example%2B&mid=123&idx=1`, the [offline link audit](/faq/wechat-link-parameters) keeps the decoded query component and the original URL; the link audit makes no API call and derives no `gh_` value. To build a history request, `account_handoff.py` requires a saved detail response whose echoed request URL exactly matches the URL in `detail-meta.json`. A short link follows the same route from article detail to `user_name`; you do not need to build a long link first.

`account_handoff.py` also archives `request-metadata.json` byte for byte and records the SHA-256 of `request-metadata.json` beside `source_sha256`. `canonical_gh_candidate` flags only a bare `gh_` identifier under the handoff’s conservative syntax rule. `canonical_gh_candidate: false` does not mean the API rejects the username; `canonical_gh_candidate: false` means the non-`gh_` alias should not be fed into the `gh_`-only helpers or renamed. `canonical_gh_candidate` does not check whether the account exists.

Before handing `history-request.json` to another person, confirm the source URL, the returned `username`, the collection time, and the hashes of both saved files. Keep `author` and `nick_name` as descriptive fields only. `account_handoff.py` stops before creating the output directory when the response has an explicitly non-null gateway `error` or a blank `request_id`, or when the URL contains embedded userinfo or a browser-session parameter. `account_handoff.py` sends no request and schedules no follow-up.

## What is fakeid in an older WeChat export, and can I reuse fakeid as username?

Treat `fakeid` as a field of the specific old tool or route, not a universal alias for the BeatAPI `username`. In [wechat-article-exporter issue 117](https://github.com/wechat-article/wechat-article-exporter/issues/117), the maintainer uses the name fakeid for an article’s biz parameter in the route under discussion. The naming in issue 117 does not establish that every backend or tool field called fakeid has the same representation, or that a fakeid is a `gh_` ID.

The current `wechat_mp.v2.fetch_account_articles` input has `username` and no fakeid parameter. Do not rename the old column and run the request, do not prefix the old value with `gh_`, and do not assume that decoding `__biz` resolves the account. A string that matches the input pattern is not thereby the right account. You also do not need to capture a WeChat session to use the public BeatAPI action.

To move an old archive that contains fakeid, nickname and article links to the `username` route:

1. Keep the old column as `legacy_fakeid` and record which tool or file supplied the value. Do not overwrite `legacy_fakeid` with a new identifier.
2. Choose one intact public article URL from the intended account. The nickname is supporting context, not the join key. A stale, private or session-bearing URL is not a valid public source, even when the old tool stored the URL.
3. Reuse a saved matching detail response, or budget one separate detail retrieval. `account_handoff.py` validates the original request URL, the echoed URL and the returned `data.content.user_name`; `account-evidence.json` records which account the article belongs to.
4. Review `account-evidence.json` and `history-request.json`. Keep `legacy_fakeid`, the verified username and the source article as separate columns. Merge another old record only after the other record’s own account is verified; an identical nickname is not enough.
5. Start the new route from an empty `offset`. Do not copy the old fakeid, backend cursor, cookie, uin, key or pass_ticket into BeatAPI parameters or a support ticket. The [frequency-error answer](/faq/wechat-frequency-error) covers a failed legacy synchronization without deleting local files.

If the only surviving value is a fakeid and no public article or independently verified account source exists, the handoff has no supported conversion step. Keep the row unresolved instead of issuing speculative paid calls. The handoff produces a checked request and an evidence package; the handoff is not a bulk importer, not an identity registry and not a completed download of the new history.