动态二维码 API 文档

    使用 QR Cake API 创建、更新和管理动态二维码。生成 API 密钥、测试请求,把二维码工作流接入你自己的工具。

    JSON REST API动态二维码创建API 密钥认证MCP 服务器

    快速开始

    QR Cake API 让 QR Cake 用户可以管理自己账户下的二维码。

    基础 URL
    https://api.qrcake.com/v1/product/api

    身份验证

    在后台创建一个 API 密钥,并在 x-api-key 请求头中发送。

    每个密钥都带有创建时选定的权限(读取二维码、创建和更新二维码、读取扫码数据统计),完整密钥仅显示一次。

    x-api-key: <API Key>
    Content-Type: application/json

    在以下位置管理 API 密钥: 管理后台 API 密钥.

    二维码 API 指南:用程序化方式生成和管理二维码(2026 年)

    面向 AI 助手的 MCP 服务器

    QR Cake 还提供远程 MCP(Model Context Protocol)服务器,让 Claude、Claude Code、Cursor 和 VS Code 在对话中列出、创建、更新和删除你的二维码。登录你的 QR Cake 账户即可连接。

    服务器 URL
    https://api.qrcake.com/mcp
    资源元数据(RFC 9728)
    https://api.qrcake.com/.well-known/oauth-protected-resource/mcp

    身份验证

    客户端首次连接时会打开 QR Cake 登录页面。请登录,然后批准客户端可以执行的操作。无需在客户端中输入 API 密钥或密码;API 密钥仅适用于 REST API。

    客户端可以调用哪些工具,取决于你批准的权限。三个不需要权限的工具始终可用。

    codes.read

    读取二维码和套餐限额

    codes.write

    创建、更新和删除二维码

    analytics.read

    读取扫码数据统计(Pro 和 Business 套餐)

    工具

    工具权限功能
    list_qr_codes
    codes.read
    列出你拥有的所有二维码,包括短链接、目标网址和状态。
    get_qr_code
    codes.read
    按 ID 获取你的某个二维码。
    get_plan_limits
    codes.read
    你的套餐等级、二维码数和启用中二维码数的用量与上限、是否包含数据统计,以及自定义域名上限。
    create_qr_code
    codes.write
    创建一个动态二维码,其短链接跳转到指定网址;受套餐限额约束。
    update_qr_code
    codes.write
    无需重新印刷即可更改二维码的目标网址、状态、元数据或选项;未提供的字段保持原值。
    create_file_upload
    codes.write
    准备上传要附加到二维码的文件(图片、PDF、音频或视频)。文件由客户端自行上传。
    delete_qr_code
    codes.write
    永久删除二维码;已印刷的二维码将无法再跳转。
    design_qr_code
    codes.read
    codes.write
    为你的某个二维码打开交互式设计器,可修改其形状、颜色、Logo 和外框,并保存修改。
    get_qr_code_analytics
    analytics.read
    获取单个二维码的扫码数据统计(互动、位置、设备或地理分布,时间范围为一周、一个月或一年)。需要包含数据统计的套餐。
    render_qr_code无将任意文本或网址生成白底黑码的二维码图片(PNG)或 SVG 代码。不会存储任何内容。
    build_qr_content无将 WiFi 凭据、联系人名片、电子邮件、短信、电话、日历事件、位置、加密货币付款、WhatsApp、地图或 FaceTime 链接编码为二维码应承载的文本。
    analyze_qr_design无估算带样式的设计(颜色、码点样式、Logo)占用各纠错块的比例,并给出健康、脆弱、危险或超限的结论。

    连接客户端

    Claude、Claude Code、Cursor 和 VS Code 可以连接。目前暂不接受其他客户端。

    Claude

    在 Claude 中将服务器网址添加为自定义连接器,并在系统提示时登录。

    Claude Code
    claude mcp add --transport http qrcake https://api.qrcake.com/mcp

    然后在 Claude Code 中运行 /mcp 并登录。

    Cursor(mcp.json)
    {
      "mcpServers": {
        "qrcake": {
          "url": "https://api.qrcake.com/mcp"
        }
      }
    }
    VS Code(mcp.json)
    {
      "servers": {
        "qrcake": {
          "type": "http",
          "url": "https://api.qrcake.com/mcp"
        }
      }
    }
    • 扫码数据统计属于 Pro 和 Business 套餐;在免费套餐中,get_qr_code_analytics 会返回错误。
    • 通过 MCP 创建的二维码与在后台创建的二维码一样,计入你的套餐限额。
    • 文件、PDF、图片、视频和音频二维码需要上传文件。能够发送网络请求的客户端(例如 Claude Code 或 Cursor)可以使用 create_file_upload 上传文件;否则请在后台创建这类二维码。
    • 在支持 MCP Apps 的客户端(例如 Claude)中,design_qr_code 会直接在对话中打开设计器。其他客户端则会收到 JSON 格式的二维码数据。
    • 连接最长可保持 30 天,之后客户端会要求你重新登录。

    API 请求测试工具

    直接在本页面测试各接口。输入你的 API 密钥,选择一个接口,即可查看实时响应。

    交互式 API 测试工具

    直接在浏览器中向所选的 QR Cake API 接口发起请求。

    GET
    x-api-key: YOUR_API_KEY
    解析后的 URL
    https://api.qrcake.com/v1/product/api/product
    发送请求后,可在此查看实时状态码和响应内容。

    术语说明

    产品

    二维码

    用户

    QR Cake 账户

    请求体(POST/PUT)

    对于 POST 和 PUT 请求,请求体必须字符串化。如果发送的是 JSON,请传入 JSON 字符串(例如 JSON.stringify(payload)).

    const payload = { redirect: "https://example.com", metadata: {} };
    
    await fetch(url, {
      method: "POST",
      body: JSON.stringify(payload),
    });
    GET

    获取二维码列表

    列出当前 API 密钥可访问的二维码。

    在 GitBook 中打开
    路径: /product
    URL: https://api.qrcake.com/v1/product/api/product
    请求详情
    请求头
    • x-api-key: <API Key>
    • Accept: application/json
    响应
    200 OK
    [
      {
        "accountId": "string",
        "productId": "string",
        "userId": "string",
        "redirect": "string",
        "state": "ACTIVE",
        "metadata": {},
        "createdAt": 0,
        "updatedAt": 0
      }
    ]
    401 未授权
    {
      "message": {}
    }

    Products 即二维码。

    GET

    获取单个二维码

    获取一个二维码的详情。

    在 GitBook 中打开
    路径: /product/{productId}
    URL: https://api.qrcake.com/v1/product/api/product/{productId}
    请求详情
    路径参数
    • productId (string)
    请求头
    • x-api-key: <API Key>
    • Accept: application/json
    响应
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "createdAt": 0,
      "updatedAt": 0
    }
    401 未授权
    {
      "message": {}
    }
    POST

    创建二维码

    创建一个新的二维码产品。

    在 GitBook 中打开
    路径: /product
    URL: https://api.qrcake.com/v1/product/api/product
    请求详情
    请求头
    • x-api-key: <API Key>
    • Content-Type: application/json
    • Accept: application/json
    请求体模板
    {
      "redirect": "https://example.com",
      "metadata": {},
      "state": "ACTIVE"
    }
    响应
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "createdAt": 0,
      "updatedAt": 0
    }
    401 未授权
    {
      "message": {}
    }

    POST 请求体必须字符串化(例如 JSON.stringify(payload))。

    PUT

    更新二维码

    更新一个已有的二维码(product)。

    在 GitBook 中打开
    路径: /product/{productId}
    URL: https://api.qrcake.com/v1/product/api/product/{productId}
    请求详情
    路径参数
    • productId (string)
    请求头
    • x-api-key: <API Key>
    • Content-Type: application/json
    • Accept: application/json
    请求体模板
    {
      "redirect": "https://example.com",
      "metadata": {},
      "state": "ACTIVE"
    }
    响应
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "expiresAt": 0,
      "createdAt": 0,
      "updatedAt": 0
    }
    401 未授权
    {
      "message": {}
    }

    PUT 请求体必须字符串化。

    DELETE

    删除二维码

    删除一个二维码。

    在 GitBook 中打开
    路径: /product/{productId}
    URL: https://api.qrcake.com/v1/product/api/product/{productId}
    请求详情
    路径参数
    • productId (string)
    请求头
    • x-api-key: <API Key>
    • Accept: application/json
    响应
    200 OK
    {
      "productId": "string"
    }
    401 未授权
    {
      "message": {}
    }
    GET

    权限

    返回该 API 密钥所获得的权限。

    在 GitBook 中打开
    路径: /permission
    URL: https://api.qrcake.com/v1/product/api/permission
    请求详情
    请求头
    • x-api-key: <API Key>
    • Accept: application/json
    响应
    200 OK
    {
      "success": true,
      "result": {
        "tier": "subscriber",
        "active": true,
        "analytics": true,
        "productLimit": 100,
        "productTotal": 3,
        "productActiveLimit": 100,
        "productActiveTotal": 3
      }
    }
    401 未授权
    {
      "message": {}
    }

    支持的二维码类型

    创建或更新二维码产品时,请使用这些元数据类型。

    redirect, link, image, video, file, pdf, audio, app, event, vCard, review, email

    可以先从我们首页的动态二维码和可编辑二维码入手了解。