首页 / 开放 API

一维工具 免费开放 API

常用的编码、哈希、时间戳、UUID、IP 查询和 JSON 格式化接口,免费使用、无需注册、无需 API Key,支持跨域(CORS),可以直接在网页、脚本或小程序后端里调用。

接口地址:https://open.yiwei.cc.cd

接口列表

所有接口同时支持 GET(查询参数)和 POST(JSON 或表单请求体)。返回 JSON,成功时 ok 为 true。

接口说明
GET /hash计算哈希。参数 algo=md5 | sha1 | sha256 | sha384 | sha512(默认 md5),text=原文
GET /base64/encodeUTF-8 文本转 Base64,text=原文,可选 urlsafe=1
GET /base64/decodeBase64(含 URL 安全格式)解码为 UTF-8 文本
GET /url/encodeURL 编码(encodeURIComponent),可选 mode=uri 使用 encodeURI
GET /url/decodeURL 解码,默认把 + 视为空格(plus=0 关闭)
GET /uuid生成 UUID v4,n=数量 1–100
GET /timestamp时间戳转换:ts 可以是秒/毫秒时间戳或日期字符串,留空返回当前时间;返回 ISO、UTC 和北京时间
GET /ip返回调用方 IP,以及 Cloudflare 提供的国家、城市、时区、ASN
POST /json/formatJSON 格式化:请求体是 JSON 原文(或 {"text": "…", "indent": 2}),indent=0 为压缩

在线试用

点击“发送请求”查看返回结果

curl 示例

curl "https://open.yiwei.cc.cd/hash?algo=sha256&text=hello"
curl "https://open.yiwei.cc.cd/base64/encode?text=%E4%BD%A0%E5%A5%BD"
curl "https://open.yiwei.cc.cd/base64/decode?text=5L2g5aW9"
curl "https://open.yiwei.cc.cd/url/encode?text=a%20b%26c"
curl "https://open.yiwei.cc.cd/url/decode?text=%E4%B8%AD%E6%96%87"
curl "https://open.yiwei.cc.cd/uuid?n=3"
curl "https://open.yiwei.cc.cd/timestamp?ts=1700000000"
curl "https://open.yiwei.cc.cd/ip"

curl -X POST "https://open.yiwei.cc.cd/json/format" \
  -H "Content-Type: application/json" \
  -d '{"name":"一维工具","tags":["free","api"]}'

JavaScript(fetch)示例

// 浏览器或 Node.js 18+,已开启 CORS,可在任何网页直接调用
const r = await fetch("https://open.yiwei.cc.cd/hash?algo=sha256&text=" + encodeURIComponent("hello"));
const data = await r.json();
console.log(data.hash);

// POST /json/format
const f = await fetch("https://open.yiwei.cc.cd/json/format", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: '{"a":1,"b":[1,2]}', indent: 2 })
});
console.log((await f.json()).result);

返回格式

成功:

{
  "ok": true,
  "algo": "sha256",
  "hash": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824",
  "length": 5
}

出错时返回对应的 HTTP 状态码(400 参数错误、404 接口不存在、413 输入过大、429 请求过快):

{
  "ok": false,
  "error": "missing parameter: text",
  "docs": "https://tool.yiwei.cc.cd/api/"
}

使用限制

免费声明

本 API 永久免费提供,没有付费套餐,也不会推出付费版。服务按现状提供,不保证可用性;请合理使用,不要用于违法用途。

问题反馈:1@yiwei.cc.cd