U
用户
▼
API文档
认证方式
所有API请求需要在请求头中携带API Key:
X-API-Key: sk_your_api_key_here
或者在URL参数中传递:
?api_key=sk_your_api_key_here
链接管理
创建链接
POST /api/links
Content-Type: application/json
{
"target_url": "https://example.com",
"title": "My Link",
"type": "redirect",
"code": "custom-code",
"utm_source": "newsletter",
"utm_medium": "email"
}
查询链接
GET /api/links/{code}
链接列表
GET /api/links?page=1&per_page=20
更新链接
PUT /api/links/{code}
Content-Type: application/json
{
"title": "Updated Title",
"target_url": "https://new-url.com",
"is_active": true
}
删除链接
DELETE /api/links/{code}
统计查询
链接统计
GET /api/stats/{code}?period=7d
period参数可选值:24h, 7d, 30d, 90d
响应格式
成功响应
{
"success": true,
"data": { ... }
}
错误响应
{
"error": "错误描述",
"code": 401
}