{
  "openapi": "3.1.0",
  "info": {
    "title": "md2wechat Convert API",
    "version": "1.1.0",
    "description": "Markdown to WeChat-ready HTML conversion API served by md2wechat.cn. Auth: a single API key (prefixes wme_ v1 / wme2_ v2 / wmt_ trial) sent via any one of three equivalent headers. Per-request limits: body <= 256 KB, markdown <= 50,000 chars, <= 100 images, <= 50 fenced code blocks, <= 20 Mermaid blocks (each <= 10,000 chars); violations return a non-zero code such as markdown_too_long. Rate limit: 100 requests / 60s per key. CORS is open. Conversion never creates WeChat drafts and requires no WeChat AppID/AppSecret or IP whitelist."
  },
  "servers": [
    {
      "url": "https://www.md2wechat.cn",
      "description": "Primary"
    },
    {
      "url": "https://md2wechat.app",
      "description": "Backup domain"
    }
  ],
  "security": [
    {
      "Md2wechatAPIKey": []
    },
    {
      "XApiKey": []
    },
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/api/convert": {
      "post": {
        "summary": "Convert Markdown into WeChat-ready HTML",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "markdown"
                ],
                "properties": {
                  "markdown": {
                    "type": "string"
                  },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "default",
                      "bytedance",
                      "apple",
                      "sports",
                      "chinese",
                      "cyber",
                      "wechat-native",
                      "nyt-classic",
                      "github-readme",
                      "sspai-red",
                      "mint-fresh",
                      "sunset-amber",
                      "ink-minimal",
                      "lavender-dream",
                      "coffee-house",
                      "bauhaus-primary",
                      "elegant-gold",
                      "elegant-green",
                      "elegant-blue",
                      "elegant-orange",
                      "elegant-red",
                      "elegant-navy",
                      "elegant-gray",
                      "elegant-sky",
                      "focus-gold",
                      "focus-green",
                      "focus-blue",
                      "focus-orange",
                      "focus-red",
                      "focus-navy",
                      "focus-gray",
                      "focus-sky",
                      "bold-gold",
                      "bold-green",
                      "bold-blue",
                      "bold-orange",
                      "bold-red",
                      "bold-navy",
                      "bold-gray",
                      "bold-sky",
                      "minimal-gold",
                      "minimal-green",
                      "minimal-blue",
                      "minimal-orange",
                      "minimal-red",
                      "minimal-navy",
                      "minimal-gray",
                      "minimal-sky"
                    ]
                  },
                  "fontSize": {
                    "type": "string",
                    "enum": [
                      "small",
                      "medium",
                      "large"
                    ]
                  },
                  "backgroundType": {
                    "type": "string",
                    "enum": [
                      "default",
                      "grid",
                      "none"
                    ]
                  }
                }
              },
              "examples": {
                "minimal": {
                  "value": {
                    "markdown": "# Hello\n\nBody",
                    "theme": "default",
                    "fontSize": "medium",
                    "backgroundType": "default"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "code 0 with data.html; limit violations return a non-zero code",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "msg": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "html": {
                          "type": "string"
                        },
                        "theme": {
                          "type": "string"
                        },
                        "fontSize": {
                          "type": "string"
                        },
                        "backgroundType": {
                          "type": "string"
                        },
                        "wordCount": {
                          "type": "integer"
                        },
                        "estimatedReadTime": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/validate": {
      "get": {
        "summary": "Validate the API key",
        "responses": {
          "200": {
            "description": "Key is valid"
          },
          "204": {
            "description": "Key is valid (HEAD)"
          }
        }
      },
      "head": {
        "summary": "Validate the API key without a body",
        "responses": {
          "204": {
            "description": "Key is valid"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Md2wechatAPIKey": {
        "type": "apiKey",
        "in": "header",
        "name": "Md2wechat-API-Key"
      },
      "XApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
