{"openapi":"3.1.0","info":{"title":"ah3c.cc Short URL API","version":"1.0.0","description":"給 Codex 與自動化流程使用的短網址 API。"},"servers":[{"url":"https://ah3c.cc"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"security":[{"bearerAuth":[]}],"paths":{"/api/links":{"get":{"summary":"搜尋與分頁列出短網址","parameters":[{"name":"q","in":"query"},{"name":"view","in":"query","schema":{"enum":["links","trash"]}},{"name":"status","in":"query"},{"name":"page","in":"query"},{"name":"pageSize","in":"query"},{"name":"sort","in":"query"}],"responses":{"200":{"description":"成功"}}},"post":{"summary":"建立短網址","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["destination"],"properties":{"destination":{"type":"string","format":"uri"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"hideDestination":{"type":"boolean"},"password":{"type":"string","minLength":4,"maxLength":128,"description":"只用於設定，API 不會回傳密碼。"}}}}}},"responses":{"200":{"description":"沿用既有連結"},"201":{"description":"已建立"}}}},"/api/links/{id}":{"patch":{"summary":"更新或停用短網址","parameters":[{"name":"id","in":"path","required":true}],"responses":{"200":{"description":"成功"}}},"delete":{"summary":"刪除短網址","parameters":[{"name":"id","in":"path","required":true}],"responses":{"204":{"description":"已刪除"}}}},"/api/links/{id}/stats":{"get":{"summary":"取得單一連結進階統計或匯出 CSV","parameters":[{"name":"id","in":"path","required":true},{"name":"range","in":"query","schema":{"enum":["7","30","90","custom"]}},{"name":"from","in":"query","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","format":"date"}},{"name":"audience","in":"query","schema":{"enum":["human","bot","all"]}},{"name":"channel","in":"query","schema":{"enum":["all","web","qr"]}},{"name":"format","in":"query","schema":{"enum":["csv"]}}],"responses":{"200":{"description":"成功"}}}},"/api/stats/overview":{"get":{"summary":"取得所有連結整體統計、排行榜或匯出 CSV","parameters":[{"name":"range","in":"query","schema":{"enum":["7","30","90","custom"]}},{"name":"from","in":"query","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","format":"date"}},{"name":"audience","in":"query","schema":{"enum":["human","bot","all"]}},{"name":"channel","in":"query","schema":{"enum":["all","web","qr"]}},{"name":"format","in":"query","schema":{"enum":["csv"]}}],"responses":{"200":{"description":"成功"}}}},"/api/links/{id}/restore":{"post":{"summary":"從資源回收筒還原短網址","parameters":[{"name":"id","in":"path","required":true}],"responses":{"200":{"description":"成功"}}}},"/api/links/{id}/health":{"post":{"summary":"檢查目標健康狀態並可重新擷取 SNS 預覽","parameters":[{"name":"id","in":"path","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"refreshMetadata":{"type":"boolean"}}}}}},"responses":{"200":{"description":"成功"}}}},"/api/links/batch":{"post":{"summary":"批次啟用、停用、移到回收筒、還原或永久刪除","responses":{"200":{"description":"成功"}}}},"/api/audit":{"get":{"summary":"列出操作紀錄","responses":{"200":{"description":"成功"}}}},"/api/backup":{"get":{"summary":"匯出 JSON 或 CSV 連結備份","responses":{"200":{"description":"成功"}}}}}}