Publishing API
How the international publishing service relates to the convert API and the CLI draft flow.
Publishing API
The Publishing API is the international publishing service at https://md2wechat.com/api/v1. It is a separate service surface from the Convert API.
Convert vs publishing
- The Convert API (
https://www.md2wechat.cn/api/convert) renders Markdown into WeChat-ready HTML. It never creates WeChat drafts. - The Publishing API (
https://md2wechat.com/api/v1) is the publishing surface. Draft creation is driven by the md2wechat CLI through this service.
If your workflow only needs HTML, stop at the Convert API. Draft creation is a publishing side effect and always requires explicit user intent.
Prerequisites
- WeChat AppID and AppSecret for the target official account
- WeChat API permissions for draft and material endpoints
- An IP whitelist entry when the WeChat platform requires one — see Whitelist
- Explicit confirmation before any draft side effect
The CLI draft flow
md2wechat inspect article.md --json
md2wechat convert article.md --preview
md2wechat convert article.md --draft --cover cover.jpgStep by step:
inspect --jsonresolves metadata (title ≤ 32 chars, author ≤ 16, digest ≤ 128) and returnsreadiness.targetswithready/blocked/degradedstates plus blockers such asMISSING_COVERorMISSING_WECHAT_CONFIG.- Preflight validates intent, assets, and cover before any remote call.
- Convert renders the HTML through the Convert API.
--uploaduploads and replaces article images as WeChat materials;--coveruploads the cover and yields amedia_id.- Draft creation lands in the WeChat draft box and returns
draft_idanddraft_url. --save-draft <file>saves the draft JSON without submitting;create_draft <json>submits it later;test-draft <html> <cover>is the minimal smoke path.
Error notes
- WeChat error
45004means an invalid digest — check the digest length first. - Readiness blockers (
MISSING_API_KEY,MISSING_WECHAT_CONFIG,MISSING_COVER,LOCAL_IMAGE_MISSING) must be cleared before retrying.
Related
- Auth
- Convert
- Multi-Account Publishing
- Publishing API overview on md2wechat.cn: https://www.md2wechat.cn/wechat-publishing-api