API 文件

CiphLens 提供 REST API,讓你程式化取得 AEO 稽核結果、生成修復文件,以及整合分數 badge。 所有 Free tier endpoint 無需認證即可呼叫。

Base URL
Base https://ciphlens.ifangdar.workers.dev

所有 endpoint 皆支援 CORS。Free tier 不需要 Authorization header。 VIP tier 需要 Authorization: Bearer <API_KEY>

Free
GET /api/audit

對指定網域執行完整 AEO 稽核,回傳 9 項檢查的詳細結果與 AEO 分數(0–100)。 Free tier 回傳 mock 示範資料;VIP tier 執行真實即時稽核。

參數
參數 型別 必填 說明
domain string 必填 要稽核的網域(不含 https://),例如 example.com
tier string 選填 free(預設)或 vip
cURL 範例
# Free tier — 無需 API Key
curl -X GET \
  "https://ciphlens.ifangdar.workers.dev/api/audit?domain=example.com"
回應範例(JSON)
{
  "domain": "example.com",
  "aeo_score": 72,
  "started_at": "2025-04-27T10:00:00Z",
  "finished_at": "2025-04-27T10:00:04Z",
  "findings": [
    {
      "key": "robots_txt",
      "label": "robots.txt AI Policy",
      "severity": "warn",
      "score_impact": 6,
      "max_score": 10,
      "details": "robots.txt 存在但缺少 GPTBot 明確規則"
    }
    // ... 共 9 項
  ]
}
Free
GET /api/audit/:id

根據稽核 ID 取得先前執行的稽核結果。稽核結果快取 24 小時。

路徑參數
參數 型別 必填 說明
id string 必填 /api/audit 回傳的稽核 ID(UUID)
cURL 範例
curl -X GET \
  "https://ciphlens.ifangdar.workers.dev/api/audit/aef3b2c1-0001-4abc-9def-123456789abc"
回應範例(JSON)
{
  "id": "aef3b2c1-0001-4abc-9def-123456789abc",
  "domain": "example.com",
  "aeo_score": 72,
  "status": "done",
  "// same structure as /api/audit"
}
Free
GET /api/llms-txt

生成符合 llms.txt 規範的文字檔,告訴 ChatGPT、Claude、Perplexity 等 AI 模型你的網站結構與品牌定位。 Free tier 回傳通用模板;VIP tier 根據實際稽核結果客製生成並提供永久託管 URL。

Query 參數
參數 型別 必填 說明
domain string 必填 目標網域
tier string 選填 free(預設)或 vip
cURL 範例
curl -X GET \
  "https://ciphlens.ifangdar.workers.dev/api/llms-txt?domain=example.com&tier=free" \
  -o llms.txt
回應範例(text/plain)
# llms.txt for example.com
# Generated by CiphLens — https://ciphlens.com
# This file helps AI models understand your website structure.

> Site: example.com
> Description: [Your brand description]
> Language: zh-TW

## Pages
- /: 首頁
- /about: 關於我們
- /products: 產品
Free
GET /api/agent-prompt

生成給 Claude Code、Cursor、GitHub Copilot 等 AI coding agent 的修復指引 Markdown 檔。 將回傳內容貼入 agent,即可自動修復稽核發現的 AEO 問題。 VIP tier 版本內嵌你的 API Key,讓 agent 呼叫 CiphLens 驗證修復成效。

Query 參數
參數 型別 必填 說明
domain string 必填 目標網域
tier string 選填 free(預設)或 vip
cURL 範例
curl -X GET \
  "https://ciphlens.ifangdar.workers.dev/api/agent-prompt?domain=example.com&tier=free" \
  -o aeo-fix-guide.md
回應範例(text/markdown)
# AEO Fix Guide for example.com
# Generated by CiphLens

## 任務
根據以下 CiphLens AEO 稽核結果,修復 example.com 的 AI 能見度問題。

## 問題清單
1. [FAIL] robots.txt 缺少 GPTBot 規則 — 新增 Allow: / for GPTBot
2. [FAIL] 缺少 llms.txt — 在根目錄建立 /llms.txt
3. [WARN] Schema.org 標記不完整 — 補充 Organization schema
Free
GET /api/badge

回傳可嵌入網站的 AEO 分數 badge(SVG 格式)。 使用 <img> 標籤嵌入即可, 每次頁面載入皆顯示最新快取分數。 VIP tier 支援主題客製與即時分數更新。

Query 參數
參數 型別 必填 說明
domain string 必填 目標網域
theme string 選填 dark(預設)或 light(Pro 支援品牌色)
size string 選填 normal(預設)或 compact
HTML 嵌碼
<img
  src="https://ciphlens.ifangdar.workers.dev/api/badge?domain=example.com"
  alt="AEO Score"
  width="160"
/>
Badge 預覽
AEO Score · 72 / 100
dark 主題預覽
cURL 範例(下載 SVG)
curl -X GET \
  "https://ciphlens.ifangdar.workers.dev/api/badge?domain=example.com&theme=dark&size=normal" \
  -o badge.svg
Free
GET /llms/[domain].txt

永久託管 llms.txt — 把這個 URL 放在你網站任何位置(robots.txt 的 Sitemap: 欄位、footer、README 等), AI 爬蟲(GPTBot、ClaudeBot、PerplexityBot 等)每次訪問時,CiphLens 會自動將訪問記錄至 crawler_visits, 讓你掌握「AI 何時開始認識這個品牌」的第一手數據。 Free tier 回傳含浮水印的通用模板;加上 ?tier=vip 回傳無浮水印客製版。

路徑參數
參數 型別 必填 說明
domain string 必填 目標網域,例如 farglory-land.com.tw(URL 形式:/llms/farglory-land.com.tw.txt
Query 參數
參數 型別 必填 說明
tier string 選填 free(預設,含浮水印)或 vip(無浮水印 + 客製品牌段落,需 VIP 授權)
cURL 範例(Free — 含浮水印)
curl -A "GPTBot/1.0" \
  "https://ciphlens.ifangdar.workers.dev/llms/farglory-land.com.tw.txt"
cURL 範例(VIP — 無浮水印)
curl -A "GPTBot/1.0" \
  "https://ciphlens.ifangdar.workers.dev/llms/farglory-land.com.tw.txt?tier=vip"
回應範例(Free,text/plain)
# Generated by CiphLens — https://ciphlens.ifangdar.workers.dev
# Free 版基本範本 — VIP 版含品牌語境、多語、完整 metadata

# farglory-land.com.tw

> 此 llms.txt 由 CiphLens AEO 稽核工具自動產生…

## 主要頁面
- [首頁](https://farglory-land.com.tw/) — 品牌首頁
- [關於我們](https://farglory-land.com.tw/about) — 公司簡介
回應範例(VIP,text/plain)
# farglory-land.com.tw

> 此 llms.txt 由 CiphLens AEO 稽核工具(VIP 版)自動產生,提供完整品牌語境…

## 品牌定位
farglory-land.com.tw 致力於提供高品質的解決方案…

## 多語版本連結
- 繁體中文:https://farglory-land.com.tw/zh-TW/

# Hosted at https://ciphlens.ifangdar.workers.dev/llms/farglory-land.com.tw.txt
robots.txt 使用範例(推薦)
# 你的網站 robots.txt
User-agent: GPTBot
Allow: /

Sitemap: https://ciphlens.ifangdar.workers.dev/llms/your-domain.com.txt
Free
GET /api/audit/:id/snapshot

取得稽核當時抓取的原始 HTML 快照。每筆稽核完成後,CiphLens 會把 fetched HTML 存入 R2, 供法務存證、歷史對比與 AI detector 訓練使用。若快照不存在(例如舊稽核或 R2 寫入失敗),回傳 404。

路徑參數
參數 型別 必填 說明
id string 必填 POST /api/audit 回傳的稽核 ID(UUID)
回應 Headers
Header 說明
Content-Type text/html; charset=utf-8
X-CiphLens-Audit-Id 稽核 ID,便於 client 端對照
cURL 範例
# 1) 先執行稽核取得 ID
ID=$(curl -s -X POST \
  "https://ciphlens.ifangdar.workers.dev/api/audit" \
  -H 'Content-Type: application/json' \
  -d '{"domain":"example.com"}' \
  | python3 -c "import json,sys; print(json.load(sys.stdin)['id'])")

# 2) 下載 HTML 快照
curl -s \
  "https://ciphlens.ifangdar.workers.dev/api/audit/$ID/snapshot" \
  -o snapshot.html \
  -w 'HTTP %{http_code}, %{size_download}B\n'
錯誤回應
{ "error": "Snapshot not found" }  // 404 — 快照不存在
{ "error": "Audit not found" }    // 404 — 找不到此稽核 ID
{ "error": "Snapshot storage not available" }  // 503 — SNAPSHOTS binding 未設定
GET /api/ai-bot-index 公開

回傳過去 7 天 AI 爬蟲流量聚合資料(JSON)。從 D1 crawler_visits 資料表統計: classification 總計、vendor 分布、每日趨勢、熱門路徑。無需 API Key,加 Cache-Control: public, max-age=3600

回應範例
{
  "generated_at": "2026-04-29T12:00:00.000Z",
  "window_days": 7,
  "totals": {
    "ai_bot": 142,
    "ai_referral": 38,
    "traditional_bot": 91,
    "human": 217
  },
  "by_vendor": [
    { "vendor": "openai", "visits": 87, "share": 0.18 }
  ],
  "daily": [
    { "day": "2026-04-29", "ai_bot": 30, "ai_referral": 5, "human": 20 }
  ],
  "top_paths": [
    { "path": "/audit", "visits": 123 }
  ],
  "data_source": "ciphlens.com — D1 crawler_visits"
}
cURL
curl -s \
  "https://ciphlens.com/api/ai-bot-index" \
  | python3 -m json.tool
延伸閱讀

CiphLens 公開 8 篇繁中 AEO/GEO 深度研究文件,涵蓋 llms.txt 規格、Schema.org 對應表、AI 引擎引用比較等主題。 完整開放下載,AI 爬蟲可直接抓取 raw markdown。

前往深度研究資源庫 →
取得 API Key(VIP)

解鎖無限次呼叫、VIP 客製化功能,以及 CI/CD 整合支援。

⚡ 查看 VIP 方案 →