開始使用

快速開始

60 秒發出你的第一個 API 請求

身分驗證

所有 API 請求都需要在 header 中帶 API Key:

Authorization: Bearer YOUR_API_KEY

請從 Thunderbit 主控台 取得你的 API Key。Key 可撤銷、依環境區分 —— 切勿將正式 Key 嵌入用戶端程式碼。

1. 將單一網頁蒸餾成 Markdown

cURL:

curl -X POST https://openapi.thunderbit.com/openapi/v1/distill \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://thunderbit.com/playground"}'

Python:

import httpx

resp = httpx.post(
    "https://openapi.thunderbit.com/openapi/v1/distill",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"url": "https://thunderbit.com/playground"},
    timeout=60.0,
)
resp.raise_for_status()
print(resp.json()["data"]["markdown"])

Node.js:

const r = await fetch("https://openapi.thunderbit.com/openapi/v1/distill", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://thunderbit.com/playground" }),
});
const { data } = await r.json();
console.log(data.markdown);

2. 用 JSON Schema 擷取結構化資料

curl -X POST https://openapi.thunderbit.com/openapi/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/product/iphone-15-pro",
    "schema": {
      "type": "object",
      "properties": {
        "name":     { "type": "string" },
        "price":    { "type": "number" },
        "currency": { "type": "string" },
        "inStock":  { "type": "boolean" }
      },
      "required": ["name", "price"]
    }
  }'

3. 提交帶 Webhook 回呼的批次任務

curl -X POST https://openapi.thunderbit.com/openapi/v1/batch/distill \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://example.com/page1",
      "https://example.com/page2",
      "https://example.com/page3"
    ],
    "webhook": {
      "url": "https://your-server.com/api/webhook/distill",
      "secret": "whsec_your_secret_key"
    }
  }'