趣味工具

生成 SVG 二维码

GET/qr
公开访问curl*

文本最多 256 个 UTF-16 代码单元,公开缓存 1 天。 访问类别:匿名 API,可携带 Token 使用独立额度

请求参数

textquery必填
string · 最短:1 字符 · 最长:256 字符
eccquery
string · 默认值:"M" · 可选:L、M、Q、H
_formatquery
响应格式为 svg、json 或 text。/color/{hex} 默认 JSON,带 curl* 标记的接口默认 SVG。plain 是 text 的别名。未识别的值继续按 Accept 协商。
string · 可选:svg、json、text
_colorquery
控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
string · 可选:0、false、off、no

响应

200 二维码,含两模块安静区。

image/svg+xml

{
  "type": "string"
}

application/json

{
  "type": "object",
  "properties": {
    "svg": {
      "type": "string"
    }
  },
  "required": [
    "svg"
  ],
  "additionalProperties": {}
}
400 请求校验或执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
401 凭据无效、停用、过期或缺少所需 Token

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
403 需要管理员 Token

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
413 请求体过大

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
415 请求内容类型无效

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
429 请求过于频繁,Retry-After 为建议等待秒数;匿名额度及认证保护在各 Cloudflare 地点近似计数,Token 业务额度使用 D1 原子计数

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
500 内部执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}

响应示例

运行命令前,将环境变量 BASE_URL 设置为站点地址。

默认响应是 SVG。下面另有 _format=json 的 JSON 响应。

成功响应

curl --silent --show-error -H 'User-Agent: simpleWebUtils-example/2.0.1' "$BASE_URL"'/qr?text=https%3A%2F%2Fevax.top&ecc=M'
HTTP 200
content-type: image/svg+xml; charset=utf-8
content-encoding: gzip
cache-control: public, max-age=86400

<svg xmlns="http://www.w3.org/2000/svg" width="232" height="232" viewBox="0 0 29 29" role="img" aria-label="QR code"><title>QR code</title><rect width="29" height="29" fill="#fff"/><g fill="#000" shape-rendering="crispEdges"><rect x="2" y="2" width="1" height="1"/><rect x="3" y="2" width="1" height="1"/><rect x="4" y="2" width="1" height="1"/><rect x="5" y="2" width="1" height="1"/><rect x="6" y="2" width="1" height="1"/><rect x="7" y="2" width="1" height="1"/><rect x="8" y="2" width="1" height="1"/><rect x="10" y="2" width="1" height="1"/><rect x="12" y="2" width="1" height="1"/><rect x="14" y="2" width="1" height="1"/><rect x="15" y="2" width="1" height="1"/><rect x="16" y="2" width="1" height="1"/><rect x="17" y="2" width="1" height="1"/><rect x="20" y="2" width="1" height="1"/><rect x="21" y="2" width="1" height="1"/><rect x="22" y="2" width="1" height="1"/><rect x="23" y="2" width="1" height="1"/><rect x="24" y="2" width="1" height="1"/><rect x="25" y="2" width="1" height="1"/><rect x="26" y="2" width="1" height="1"/><rect x="2" y="3" width="1" height="1"/><rect x="8" y="3" width="1" height="1"/><rect x="10" y="3" width="1" height="1"/><rect x="14" y="3" width="1" height="1"/><rect x="15" y="3" width="1" height="1"/><rect x="16" y="3" width="1" height="1"/><rect x="17" y="3" width="1" height="1"/><rect x="20" y="3" width="1" height="1"/><rect x="26" y="3" width="1" height="1"/><rect x="2" y="4" width="1" height="1"/><rect x="4" y="4" width="1" height="1"/><rect x="5" y="4" width="1" height="1"/><rect x="6" y="4" width="1" height="1"/><rect x="8" y="4" width="1" height="1"/><rect x="10" y="4" width="1" height="1"/><rect x="11" y="4" width="1" height="1"/><rect x="12" y="4" width="1" height="1"/><rect x="13" y="4" width="1" height="1"/><rect x="14" y="4" width="1" height="1"/><rect x="15" y="4" width="1" height="1"/><rect x="16" y="4" width="1" height="1"/><rect x="20" y="4" width="1" height="1"/><rect x="22" y="4" width="1" height="1"/><rect x="23" y="4" width="1" height="1"/><rect x="24" y="4" width="1" height="1"/><rect x="26" y="4" width="1" height="1"/><rect x="2" y="5" width="1" height="1"/><rect x="4" y="5" width="1" height="1"/><rect x="5" y="5" width="1" height="1"/><rect x="6" y="5" width="1" height="1"/><rect x="8" y="5" width="1" height="1"/><rect x="11" y="5" width="1" height="1"/><rect x="14" y="5" width="1" height="1"/><rect x="16" y="5" width="1" height="1"/><rect x="17" y="5" width="1" height="1"/><rect x="18" y="5" width="1" height="1"/><rect x="20" y="5" width="1" height="1"/><rect x="22" y="5" width="1" height="1"/><rect x="23" y="5" width="1" height="1"/><rect x="24" y="5" width="1" height="1"/><rect x="26" y="5" width="1" height="1"/><rect x="2" y="6" width="1" height="1"/><rect x="4" y="6" width="1" height="1"/><rect x="5" y="6" width="1" height="1"/><rect x="6" y="6" width="1" height="1"/><rect x="8" y="6" width="1" height="1"/><rect x="10" y="6" width="1" height="1"/><rect x="15" y="6" width="1" height="1"/><rect x="17" y="6" width="1" height="1"/><rect x="20" y="6" width="1" height="1"/><rect x="22" y="6" width="1" height="1"/><rect x="23" y="6" width="1" height="1"/><rect x="24" y="6" width="1" height="1"/><rect x="26" y="6" width="1" height="1"/><rect x="2" y="7" width="1" height="1"/><rect x="8" y="7" width="1" height="1"/><rect x="11" y="7" width="1" height="1"/><rect x="12" y="7" width="1" height="1"/><rect x="15" y="7" width="1" height="1"/><rect x="16" y="7" width="1" height="1"/><rect x="18" y="7" wi
… 已截断,完整响应 14552 字符

JSON 响应

curl --silent --show-error -H 'User-Agent: simpleWebUtils-example/2.0.1' -H 'Accept: application/json' "$BASE_URL"'/qr?text=https%3A%2F%2Fevax.top&ecc=M&_format=json'
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: public, max-age=86400

{
  "text": "https://evax.top",
  "ecc": "M",
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"232\" height=\"232\" viewBox=\"0 0 29 29\" role=\"img\" aria-label=\"QR code\"><title>QR code</title><rect width=\"29\" height=\"29\" fill=\"#fff\"/><g fill=\"#000\" shape-rendering=\"crispEdges\"><rect x=\"2\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"5\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"6\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"7\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"8\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"10\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"12\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"14\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"15\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"16\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"17\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"20\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"21\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"22\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"23\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"24\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"25\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"26\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"8\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"10\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"14\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"15\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"16\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"17\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"20\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"26\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"5\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"6\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"8\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"10\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"11\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"12\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"13\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"14\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"15\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"16\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"20\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"22\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"23\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"24\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"26\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"5\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"6\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"8\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"11\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"14\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"16\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"17\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"18\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"20\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"22\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"23\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"24\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"26\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"6\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"6\" width=\"1\" height=\"1\"/><rect x=\"5\" y=\"6\" width=\"1\" height=\"1\"/><rect x=\"6\" y=\"6\" width=\"1\" height=\"1\"/><rect x=\"8\" y=\"6\" width=\"1\" h
… 已截断,完整响应 17401 字符

错误示例

curl --silent --show-error -X PUT -H 'User-Agent: simpleWebUtils-example/2.0.1' -H 'Accept: application/json' "$BASE_URL"'/qr'
HTTP 405
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "error": {
    "code": "METHOD_NOT_ALLOWED",
    "message": "接口不支持该请求方法"
  }
}

curl 访问示例

命令行默认返回 SVG,_format=text 得到纯文本。示例展示纯文本输出。

命令与输出

curl --silent --show-error -H 'User-Agent: curl/8.7.1' "$BASE_URL"'/qr?text=https%3A%2F%2Fevax.top&ecc=M&_color=0&_format=text'
HTTP 200
content-type: text/plain; charset=utf-8
content-encoding: gzip
cache-control: public, max-age=86400

text: https://evax.top
ecc: M
svg: <svg xmlns="http://www.w3.org/2000/svg" width="232" height="232" viewBox="0 0 29 29" role="img" aria-label="QR code"><title>QR code</title><rect width="29" height="29" fill="#fff"/><g fill="#000" shape-rendering="crispEdges"><rect x="2" y="2" width="1" height="1"/><rect x="3" y="2" width="1" height="1"/><rect x="4" y="2" width="1" height="1"/><rect x="5" y="2" width="1" height="1"/><rect x="6" y="2" width="1" height="1"/><rect x="7" y="2" width="1" height="1"/><rect x="8" y="2" width="1" height="1"/><rect x="10" y="2" width="1" height="1"/><rect x="12" y="2" width="1" height="1"/><rect x="14" y="2" width="1" height="1"/><rect x="15" y="2" width="1" height="1"/><rect x="16" y="2" width="1" height="1"/><rect x="17" y="2" width="1" height="1"/><rect x="20" y="2" width="1" height="1"/><rect x="21" y="2" width="1" height="1"/><rect x="22" y="2" width="1" height="1"/><rect x="23" y="2" width="1" height="1"/><rect x="24" y="2" width="1" height="1"/><rect x="25" y="2" width="1" height="1"/><rect x="26" y="2" width="1" height="1"/><rect x="2" y="3" width="1" height="1"/><rect x="8" y="3" width="1" height="1"/><rect x="10" y="3" width="1" height="1"/><rect x="14" y="3" width="1" height="1"/><rect x="15" y="3" width="1" height="1"/><rect x="16" y="3" width="1" height="1"/><rect x="17" y="3" width="1" height="1"/><rect x="20" y="3" width="1" height="1"/><rect x="26" y="3" width="1" height="1"/><rect x="2" y="4" width="1" height="1"/><rect x="4" y="4" width="1" height="1"/><rect x="5" y="4" width="1" height="1"/><rect x="6" y="4" width="1" height="1"/><rect x="8" y="4" width="1" height="1"/><rect x="10" y="4" width="1" height="1"/><rect x="11" y="4" width="1" height="1"/><rect x="12" y="4" width="1" height="1"/><rect x="13" y="4" width="1" height="1"/><rect x="14" y="4" width="1" height="1"/><rect x="15" y="4" width="1" height="1"/><rect x="16" y="4" width="1" height="1"/><rect x="20" y="4" width="1" height="1"/><rect x="22" y="4" width="1" height="1"/><rect x="23" y="4" width="1" height="1"/><rect x="24" y="4" width="1" height="1"/><rect x="26" y="4" width="1" height="1"/><rect x="2" y="5" width="1" height="1"/><rect x="4" y="5" width="1" height="1"/><rect x="5" y="5" width="1" height="1"/><rect x="6" y="5" width="1" height="1"/><rect x="8" y="5" width="1" height="1"/><rect x="11" y="5" width="1" height="1"/><rect x="14" y="5" width="1" height="1"/><rect x="16" y="5" width="1" height="1"/><rect x="17" y="5" width="1" height="1"/><rect x="18" y="5" width="1" height="1"/><rect x="20" y="5" width="1" height="1"/><rect x="22" y="5" width="1" height="1"/><rect x="23" y="5" width="1" height="1"/><rect x="24" y="5" width="1" height="1"/><rect x="26" y="5" width="1" height="1"/><rect x="2" y="6" width="1" height="1"/><rect x="4" y="6" width="1" height="1"/><rect x="5" y="6" width="1" height="1"/><rect x="6" y="6" width="1" height="1"/><rect x="8" y="6" width="1" height="1"/><rect x="10" y="6" width="1" height="1"/><rect x="15" y="6" width="1" height="1"/><rect x="17" y="6" width="1" height="1"/><rect x="20" y="6" width="1" height="1"/><rect x="22" y="6" width="1" height="1"/><rect x="23" y="6" width="1" height="1"/><rect x="24" y="6" width="1" height="1"/><rect x="26" y="6" width="1" height="1"/><rect x="2" y="7" width="1" height="1"/><rect x="8" y="7" width="1" height="1"/><rect x="11" y="7" width="1" height="1"/><rect x="12" y="7" width="1" height="1"/><rect x="15" y="7" width="1" height="1"/><rect x="16" y="7" width="1
… 已截断,完整响应 14588 字符

在线调试

必填
Ctrl / ⌘ + Enter
调用示例
curl -X GET 'https://oit.sh/qr?text=https%3A%2F%2Foit.sh'

响应

等待请求

等待发送请求

配置上方请求参数后点击「发送请求」查看实时响应

快捷键:Ctrl / ⌘ + Enter