UL9UL9

API 文档

Base URL: https://api.ul9.me · Auth: Authorization: Bearer ul9_... · OpenAPI 规范

POST   /api/v1/links           create   scope links:write
GET    /api/v1/links           list     scope links:read
PATCH  /api/v1/links/{id}      update   scope links:write
DELETE /api/v1/links/{id}      disable  scope links:write
GET    /api/v1/stats           totals   scope stats:read
GET    /api/v1/analytics?days=7 breakdown scope stats:read

POST /api/v1/links
{"url":"https://example.com","alias":"optional","domain":"ul9.me",
  "expiry_days":30,"max_clicks":1000,"password":"optional"}

Rate limit: 120 requests/minute per key. Keys and scopes: Admin → API Keys.

认证与权限

所有请求使用 Authorization: Bearer ul9_...。密钥在管理员后台创建,可限定 links:read、links:write、stats:read 范围;撤销或轮换后旧密钥立即失效。请勿在浏览器前端暴露密钥。

错误处理

成功返回 2xx;参数错误返回 400/422,鉴权失败 401/403,不存在 404,超限 429。错误体为 JSON:{"detail": "..."}。429 时请按响应等待后重试,不要并发轰炸。

示例:创建短链

curl -X POST https://api.ul9.me/api/v1/links   -H "Authorization: Bearer ul9_xxx" -H "Content-Type: application/json"   -d '{"url":"https://example.com","alias":"spring","domain":"ul9.me"}'

分页与限制

列表接口支持 page/per 参数;默认每页 20 条。单密钥限流 120 次/分钟。批量导入请分批并处理 429。