Toolorah
开发者

Toolorah API

新订阅暂不提供 API 访问。

快速开始

每款工具都使用下方所示端点。将 API 密钥作为 Bearer 令牌发送,并提供包含 input 和 options 的 JSON 请求体。以下是三种语言中的相同调用: POST /api/v1/<tool> { input, options }

curl -X POST https://www.toolorah.com/api/v1/base64 \
  -H "Authorization: Bearer nt_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"input":"hello world","options":{"mode":"encode"}}'

身份验证

在 API 密钥页面创建密钥,然后在每次请求中将其作为 Bearer 令牌发送: 获取 API 密钥

Authorization: Bearer nt_live_xxxxxxxxxxxxxxxx

密钥拥有创建时所属套餐的权限。请像保护密码一样保护密钥:仅保存在服务器端,并在密钥页面撤销任何泄露的密钥。

请求与响应

所有端点均使用 POST,并接受包含两个字段的 JSON 请求体:

  • input — 要处理的文本(对于 PDF 工具则为 Base64 文件)。
  • options — 每款工具专用的设置对象。此字段可选,并会使用合理的默认值。

调用成功时返回 200 和以下结构:

{
  "tool": "base64",
  "result": "aGVsbG8gd29ybGQ=",
  "meta": { }
}

发生错误时返回非 2xx 状态和单个 error 字段:

{ "error": "Invalid or revoked API key." }

速率限制

  • Pro — 每天 1,000 次调用
  • Elite — 每天 10,000 次调用

限制在 00:00 UTC 重置。每个响应都会包含当前配额:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 942

超过限制后,调用会返回 429 和 Retry-After 标头。格式错误的请求不会计入配额。

批量请求

在单次请求中处理多条输入,无需为每个条目循环发起 HTTP 调用。将 inputs 作为字符串数组发送;options 应用于每个条目。Pro(每次 25 条输入)和 Elite(250 条)可用。

curl -X POST https://www.toolorah.com/api/v1/base64/batch   -H "Authorization: Bearer nt_live_..."   -H "Content-Type: application/json"   -d '{"inputs":["hello","world"],"options":{"mode":"encode"}}'
{
  "tool": "base64",
  "count": 2,
  "succeeded": 2,
  "failed": 0,
  "results": [
    { "index": 0, "result": "aGVsbG8=" },
    { "index": 1, "result": "d29ybGQ=" }
  ]
}

每条输入会消耗一次每日配额——批量节省的是往返次数,而不是配额。若某个批次会超出每日限额,则整体拒绝且不处理任何内容,因此你绝不会拿到只完成一半的结果集。

结果按输入顺序返回,每项都带有 index。单条输入出错不会影响其余结果:该索引会返回 error 字段,其他结果照常成功。请检查响应中的 succeeded 和 failed。

套餐每次请求输入数
Free—
Pro25
Elite250

实用端点

两个 GET 端点,用于查看可调用的内容以及剩余配额。两者都需要同一个 bearer 密钥。

端点请求体
GET /api/v1/tools 列出所有可调用工具及其端点、接受文本还是文件,以及你所在套餐的批量上限。请使用它,而不要硬编码一份在我们新增工具后就会过时的列表。
GET /api/v1/usage 返回你的套餐、今日用量与剩余调用次数、批量上限,以及配额重置时间。该接口不计入配额,可放心轮询。
{
  "plan": "pro",
  "daily": { "limit": 1000, "used": 42, "remaining": 958 },
  "batch": { "maxInputsPerRequest": 25 },
  "resetsAt": "2026-08-24T00:00:00.000Z"
}

端点

文本与实用工具。使用列出的 options 控制行为。

工具端点选项
base64 POST /api/v1/base64 { "mode": "encode" } mode: encode | decode
url-encoder POST /api/v1/url-encoder { "mode": "encode" } mode: encode | decode
json-formatter POST /api/v1/json-formatter { "mode": "format", "indent": 2 } mode: format | minify | validate
jwt-decoder POST /api/v1/jwt-decoder 解码标头和载荷(不验证签名)。
hash-generator POST /api/v1/hash-generator { "algo": "SHA-256" } algo: SHA-1 | SHA-256 | SHA-512
regex-tester POST /api/v1/regex-tester { "pattern": "\\d+", "flags": "g", "mode": "match" } mode: match | replace (+ replaceWith)
word-counter POST /api/v1/word-counter 返回单词、字符和句子数量。
case-converter POST /api/v1/case-converter { "type": "title" } type: upper, lower, title, sentence, camel, pascal, snake, kebab, constant
text-cleaner POST /api/v1/text-cleaner { "trim": true, "collapseSpaces": true } 清理空白和特殊字符。
remove-duplicate-lines POST /api/v1/remove-duplicate-lines { "caseSensitive": false } 删除重复行。
text-sorter POST /api/v1/text-sorter { "order": "asc", "numeric": false } 对行进行排序。
text-reverser POST /api/v1/text-reverser { "mode": "characters" } mode: characters | words | lines
markdown-formatter POST /api/v1/markdown-formatter 将 Markdown 转换为 HTML。
lorem-ipsum POST /api/v1/lorem-ipsum { "count": 3, "unit": "paragraphs" } unit: paragraphs | sentences | words(无需 input)
password-generator POST /api/v1/password-generator { "length": 16, "symbols": true } 无需 input。
random-number POST /api/v1/random-number { "min": 1, "max": 100, "count": 5 } 无需 input。
percentage-calculator POST /api/v1/percentage-calculator { "operation": "percentOf", "a": 20, "b": 150 } operation: percentOf | isWhatPercentOf | percentChange
bmi-calculator POST /api/v1/bmi-calculator { "weight": 70, "height": 175 }
emi-calculator POST /api/v1/emi-calculator { "principal": 300000, "rate": 6.5, "months": 360 }
sip-calculator POST /api/v1/sip-calculator { "amount": 10000, "rate": 12, "years": 10, "mode": "sip", "stepUp": 0 }
gst-calculator POST /api/v1/gst-calculator { "amount": 1000, "rate": 18, "mode": "add", "supply": "intra" }
income-tax-calculator POST /api/v1/income-tax-calculator { "income": 1500000, "regime": "new", "age": "below60", "deductions": 0 }
uuid-generator POST /api/v1/uuid-generator { "count": 5, "upper": false, "noHyphens": false, "braces": false } 生成 v4 UUID(无需 input)。
timestamp-converter POST /api/v1/timestamp-converter 接受秒或毫秒格式的 Unix 时间戳,并返回 ISO、UTC、本地和 epoch 值。
css-minifier POST /api/v1/css-minifier 通过删除注释和空白来压缩 CSS。
html-formatter POST /api/v1/html-formatter { "mode": "beautify", "indent": 2 } mode: beautify | minify (indent: number | "tab")
markdown-preview POST /api/v1/markdown-preview 将 Markdown 转换为 HTML。

PDF 端点

PDF 工具处理文件,因此请求会在 JSON 中携带 Base64 编码文件,响应的 result 是 Base64 输出 PDF。每次请求的解码后负载应低于约 4 MB。WebP 仅适用于浏览器;请向 API 发送 PNG 或 JPG。

工具端点请求体
pdf-merger POST /api/v1/pdf-merger { "files": ["<base64>", "<base64>", …] } 2–20 个 PDF,按照数组顺序合并。
pdf-splitter POST /api/v1/pdf-splitter { "file": "<base64>", "options": { "mode": "extract", "pages": "1-3, 5" } } mode: extract | remove。页面范围的用法与网页工具相同。
png-to-pdf POST /api/v1/png-to-pdf { "images": ["<base64>", …], "options": { "pageSize": "a4", "orientation": "auto", "margin": "small" } } 1–50 张 PNG/JPG 图片,每张一页。pageSize: a4 | letter | fit;margin: none | small | large。
# Merge two PDFs (bash)
curl -X POST https://www.toolorah.com/api/v1/pdf-merger \
  -H "Authorization: Bearer nt_live_xxx" \
  -H "Content-Type: application/json" \
  -d "{\"files\":[\"$(base64 -w0 a.pdf)\",\"$(base64 -w0 b.pdf)\"]}" \
  | jq -r '.result' | base64 -d > merged.pdf

错误

  • 401 — API 密钥缺失或无效
  • 403 — 你的套餐不包含 API 访问权限
  • 404 — 未知工具
  • 422 — 输入错误(例如无效的 JSON 或正则表达式)
  • 429 — 已达到每日限制