{
  "openapi": "3.1.0",
  "info": {
    "title": "md2wechat Agent API",
    "version": "1.0.0",
    "description": "Agent-first WeChat formatting, draft, and media upload APIs."
  },
  "servers": [
    {
      "url": "https://md2wechat.com"
    }
  ],
  "paths": {
    "/api/v1/convert": {
      "post": {
        "summary": "Convert Markdown into WeChat-ready HTML",
        "parameters": [
          {
            "name": "Md2wechat-API-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["markdown"],
                "properties": {
                  "markdown": { "type": "string" },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "default",
                      "bytedance",
                      "chinese",
                      "apple",
                      "sports"
                    ]
                  },
                  "fontSize": { "type": "string" },
                  "convertVersion": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "HTML conversion result"
          }
        }
      }
    },
    "/api/v1/article-draft": {
      "post": {
        "summary": "Create a WeChat article draft",
        "parameters": [
          {
            "name": "Wechat-Appid",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "Wechat-App-Secret",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "Md2wechat-API-Key",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["markdown"],
                "properties": {
                  "markdown": { "type": "string" },
                  "theme": { "type": "string" },
                  "fontSize": { "type": "string" },
                  "convertVersion": { "type": "string" },
                  "coverImageUrl": { "type": "string", "format": "uri" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft creation result"
          }
        }
      }
    },
    "/api/v1/newspic-draft": {
      "post": {
        "summary": "Create a WeChat newspic draft",
        "parameters": [
          {
            "name": "Wechat-Appid",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "Wechat-App-Secret",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "Md2wechat-API-Key",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["title", "content", "imageUrls"],
                "properties": {
                  "title": { "type": "string" },
                  "content": { "type": "string" },
                  "imageUrls": {
                    "type": "array",
                    "items": { "type": "string", "format": "uri" }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Newspic draft result"
          }
        }
      }
    },
    "/api/v1/batch-upload": {
      "post": {
        "summary": "Upload remote images as WeChat materials",
        "parameters": [
          {
            "name": "Wechat-Appid",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "Wechat-App-Secret",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "Md2wechat-API-Key",
            "in": "header",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["imageUrls"],
                "properties": {
                  "imageUrls": {
                    "type": "array",
                    "items": { "type": "string", "format": "uri" }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch upload result"
          }
        }
      }
    }
  }
}
