md2wechat Agent API markAgent API Docs
md2wechat Agent API markAgent API Docs
Homepage

Start

Markdown to WeChat API DocsQuickstartAuth

APIs

Integrations

Operations

ErrorsPricingContact
X (Twitter)

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.jpg

Step by step:

  1. inspect --json resolves metadata (title ≤ 32 chars, author ≤ 16, digest ≤ 128) and returns readiness.targets with ready/blocked/degraded states plus blockers such as MISSING_COVER or MISSING_WECHAT_CONFIG.
  2. Preflight validates intent, assets, and cover before any remote call.
  3. Convert renders the HTML through the Convert API.
  4. --upload uploads and replaces article images as WeChat materials; --cover uploads the cover and yields a media_id.
  5. Draft creation lands in the WeChat draft box and returns draft_id and draft_url.
  6. --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 45004 means 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

Table of Contents

Publishing API
Convert vs publishing
Prerequisites
The CLI draft flow
Error notes
Related