API 文件
使用 ZIPN API 以程式設計方式縮短 URL。
概述
- Base URL:
https://zipn.app/api/v1/shorten - 格式: JSON
- 認證: 目前無需驗證即可使用
縮短網址
POST /api/v1/shorten
請求參數:
| 參數 | 必填 | 描述 |
|---|---|---|
original_url | ✅ | 要縮短的原始網址 |
custom_code | ❌ | 自訂短代碼(如果省略則會自動產生) |
expire_duration | ❌ | 有效期限:24h, 48h, 1week, 1month |
請求範例:
curl -X POST https://zipn.app/api/v1/shorten \
-H "Content-Type: application/json" \
-d '{
"original_url": "https://example.com/very-long-url",
"custom_code": "example",
"expire_duration": "1week"
}'成功響應(201):
{
"status": "success",
"message": "URL shortened successfully.",
"data": {
"short_url": "https://zipn.app/example/",
"original_url": "https://example.com/very-long-url",
"code": "example",
"expiration_date": "2026-04-21T10:00:00.000Z"
}
}錯誤回應:
{
"status": "error",
"message": "This short code is already in use."
}取得API資訊
GET /api/v1/shorten
返回端點資訊和可用參數。