👨‍💻 开发者 API 文档

📌 概述

将我们的工具集成到你的平台中。所有 API 都是 RESTful 风格,使用 JSON 格式。

Base URL: https://tools.trazuth.com/api/v1

🔐 认证

为了安全,我们使用 API 签名验证。在请求时需要发送以下头部:

  • X-Timestamp: 当前时间戳(毫秒)
  • X-Signature: 使用你的 API 密钥生成的签名

签名生成方式:sha256(timestamp + your_api_secret)

🧰 可用工具

POST /tools/encode-base64

将字符串编码为 Base64

Request: {"text": "Hello World"}
Response: {"encoded": "SGVsbG8gV29ybGQ="}
POST /tools/decode-base64

解码 Base64 字符串

Request: {"encoded": "SGVsbG8gV29ybGQ="}
Response: {"text": "Hello World"}
POST /tools/format-json

格式化 JSON

Request: {"json": "{\"a\":1}"}
Response: {"formatted": "{\n \"a\": 1\n}"}
POST /tools/generate-uuid

生成 UUID

Request: {"count": 3}
Response: {"uuids": ["uuid1", "uuid2", "uuid3"]}
POST /tools/generate-password

生成密码

Request: {"length": 16, "lower": true, "upper": true, "numbers": true, "special": true}
Response: {"password": "xY8$zQ2!aB3"}

💡 使用示例

// JavaScript / Node.js async function callAPI(endpoint, data) { const timestamp = Date.now(); const secret = 'your_api_secret'; const signature = btoa(timestamp + secret); const res = await fetch(`https://tools.trazuth.com/api/v1/${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Timestamp': timestamp, 'X-Signature': signature }, body: JSON.stringify(data) }); return res.json(); } callAPI('generate-password', { length: 12 }).then(r => console.log(r));

📞 联系我们

如需获取 API 密钥或有任何问题,请联系我们。