Go2.gg技能使用说明
2026-04-01
新闻来源:网淘吧
围观:13
电脑广告
手机广告
Go2.gg —— 原生边缘网络URL缩短器
提供链接缩短、数据分析、二维码生成、网络钩子、图库(个人主页链接整合)功能。基于Cloudflare边缘网络构建,全球重定向延迟低于10毫秒。
设置
获取API密钥:https://go2.gg/dashboard/api-keys(免费,无需信用卡)

export GO2GG_API_KEY="go2_your_key_here"
API基础地址: https://api.go2.gg/api/v1
认证方式: Authorization: Bearer $GO2GG_API_KEY
文档: https://go2.gg/docs/api/links
短链接
支持创建、管理和追踪短链接,可自定义短链代码、添加标签、设置过期时间、密码保护,并实现地理定位/设备定向功能。
创建链接
curl -X POST "https://api.go2.gg/api/v1/links" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destinationUrl": "https://example.com/landing-page",
"slug": "my-link",
"title": "My Campaign Link",
"tags": ["marketing", "q1-2025"]
}'
重要提示:字段名应为destinationUrl(而非url)。短链代码为可选参数(若留空将自动生成)。
响应
{
"success": true,
"data": {
"id": "lnk_abc123",
"shortUrl": "https://go2.gg/my-link",
"destinationUrl": "https://example.com/landing-page",
"slug": "my-link",
"domain": "go2.gg",
"title": "My Campaign Link",
"tags": ["marketing", "q1-2025"],
"clickCount": 0,
"createdAt": "2025-01-01T10:30:00Z"
}
}
列出链接
# List all links (paginated)
curl "https://api.go2.gg/api/v1/links?perPage=20&sort=clicks" \
-H "Authorization: Bearer $GO2GG_API_KEY"
# Search links
curl "https://api.go2.gg/api/v1/links?search=marketing&tag=q1-2025" \
-H "Authorization: Bearer $GO2GG_API_KEY"
查询参数: 页码,每页数量(最多100条),搜索,域名,标签,已归档,排序方式(创建时间/点击次数/更新时间)
更新链接
curl -X PATCH "https://api.go2.gg/api/v1/links/lnk_abc123" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"destinationUrl": "https://example.com/updated-page", "tags": ["updated"]}'
删除链接
curl -X DELETE "https://api.go2.gg/api/v1/links/lnk_abc123" \
-H "Authorization: Bearer $GO2GG_API_KEY"
# Returns 204 No Content
链接分析
curl "https://api.go2.gg/api/v1/links/lnk_abc123/stats" \
-H "Authorization: Bearer $GO2GG_API_KEY"
返回:总点击次数,按国家统计,按设备统计,按浏览器统计,byReferrer,overTime
高级链接选项
# Password-protected link
curl -X POST "https://api.go2.gg/api/v1/links" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"destinationUrl": "https://example.com/secret", "slug": "exclusive", "password": "secure123"}'
# Link with expiration + click limit
curl -X POST "https://api.go2.gg/api/v1/links" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"destinationUrl": "https://example.com/flash", "expiresAt": "2025-12-31T23:59:59Z", "clickLimit": 1000}'
# Geo-targeted link (different URLs per country)
curl -X POST "https://api.go2.gg/api/v1/links" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destinationUrl": "https://example.com/default",
"geoTargets": {"US": "https://example.com/us", "GB": "https://example.com/uk", "IN": "https://example.com/in"}
}'
# Device-targeted link + app deep links
curl -X POST "https://api.go2.gg/api/v1/links" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destinationUrl": "https://example.com/default",
"deviceTargets": {"mobile": "https://m.example.com"},
"iosUrl": "https://apps.apple.com/app/myapp",
"androidUrl": "https://play.google.com/store/apps/details?id=com.myapp"
}'
# Link with UTM parameters
curl -X POST "https://api.go2.gg/api/v1/links" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destinationUrl": "https://example.com/product",
"slug": "summer-sale",
"utmSource": "email",
"utmMedium": "newsletter",
"utmCampaign": "summer-sale"
}'
创建链接参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| destinationUrl | 字符串 | 是 | 重定向的目标URL |
| slug | 字符串 | 否 | 自定义短链标识(如省略则自动生成) |
| domain | 字符串 | 否 | 自定义域名(默认:go2.gg) |
| title | 字符串 | 否 | 链接标题 |
| description | 字符串 | 不 | 链接描述 |
| 标签 | 字符串数组 | 不 | 用于筛选的标签 |
| 密码 | 字符串 | 不 | 密码保护 |
| 过期时间 | 字符串 | 不 | ISO 8601 过期日期 |
| 点击限制 | 数字 | 不 | 允许的最大点击次数 |
| 地理目标 | 对象 | 不 | 国家 → URL 映射 |
| 设备目标 | 对象 | 不 | 设备 → URL 映射 |
| iOS 链接 | 字符串 | 否 | iOS应用深度链接 |
| 安卓链接 | 字符串 | 否 | Android应用深度链接 |
| utm来源/媒介/活动/关键词/内容 | 字符串 | 否 | UTM参数 |
二维码
生成可自定义的二维码。二维码生成免费且无需认证。
生成二维码(无需认证)
# Generate SVG QR code (free, no API key needed)
curl -X POST "https://api.go2.gg/api/v1/qr/generate" \
-H "Content-Type: application/json" \
-d '{
"url": "https://go2.gg/my-link",
"size": 512,
"foregroundColor": "#1a365d",
"backgroundColor": "#FFFFFF",
"cornerRadius": 10,
"errorCorrection": "H",
"format": "svg"
}' -o qr-code.svg
# PNG format
curl -X POST "https://api.go2.gg/api/v1/qr/generate" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "format": "png", "size": 1024}' -o qr-code.png
二维码参数
| 字段 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| 网址 | 字符串 | 必需 | 要编码的URL |
| 尺寸 | 数值 | 256 | 尺寸(像素)(64-2048) |
| 前景色 | 字符串 | #000000 | 模块的十六进制颜色 |
| 背景色 | 字符串 | #FFFFFF | 背景的十六进制颜色 |
| 圆角半径 | 数字 | 0 | 模块圆角半径(0-50) |
| 纠错等级 | 字符串 | M | L (7%), M (15%), Q (25%), H (30%) |
| 格式 | 字符串 | svg | svg 或 png |
保存与追踪二维码(需要认证)
# Save QR config for tracking
curl -X POST "https://api.go2.gg/api/v1/qr" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Business Card QR", "url": "https://go2.gg/contact", "linkId": "lnk_abc123"}'
# List saved QR codes
curl "https://api.go2.gg/api/v1/qr" -H "Authorization: Bearer $GO2GG_API_KEY"
# Download saved QR
curl "https://api.go2.gg/api/v1/qr/qr_abc123/download?format=svg" \
-H "Authorization: Bearer $GO2GG_API_KEY" -o qr.svg
# Delete QR
curl -X DELETE "https://api.go2.gg/api/v1/qr/qr_abc123" -H "Authorization: Bearer $GO2GG_API_KEY"
Webhooks
接收链接点击、创建和更新的实时通知。
# Create webhook
curl -X POST "https://api.go2.gg/api/v1/webhooks" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Click Tracker", "url": "https://your-server.com/webhook", "events": ["click", "link.created"]}'
# List webhooks
curl "https://api.go2.gg/api/v1/webhooks" -H "Authorization: Bearer $GO2GG_API_KEY"
# Test webhook
curl -X POST "https://api.go2.gg/api/v1/webhooks/wh_abc123/test" \
-H "Authorization: Bearer $GO2GG_API_KEY"
# Delete webhook
curl -X DELETE "https://api.go2.gg/api/v1/webhooks/wh_abc123" \
-H "Authorization: Bearer $GO2GG_API_KEY"
事件: 点击,链接创建,链接更新,链接删除,域名验证,二维码扫描,*(全部)
Webhook 载荷包含X-Webhook-Signature(HMAC SHA256)用于验证。重试间隔:5秒 → 30秒 → 2分钟 → 10分钟。
图库(链接在简介中)
通过编程方式创建链接在简介中的页面。
# Create gallery
curl -X POST "https://api.go2.gg/api/v1/galleries" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"slug": "myprofile", "title": "My Name", "bio": "Creator & developer", "theme": "gradient"}'
# Add link item
curl -X POST "https://api.go2.gg/api/v1/galleries/gal_abc123/items" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type": "link", "title": "My Website", "url": "https://example.com"}'
# Add YouTube embed
curl -X POST "https://api.go2.gg/api/v1/galleries/gal_abc123/items" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type": "embed", "title": "Latest Video", "embedType": "youtube", "embedData": {"videoId": "dQw4w9WgXcQ"}}'
# Publish gallery (makes it live at go2.gg/bio/myprofile)
curl -X POST "https://api.go2.gg/api/v1/galleries/gal_abc123/publish" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"isPublished": true}'
# Reorder items
curl -X PATCH "https://api.go2.gg/api/v1/galleries/gal_abc123/items/reorder" \
-H "Authorization: Bearer $GO2GG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"itemIds": ["item_3", "item_1", "item_2"]}'
# List galleries
curl "https://api.go2.gg/api/v1/galleries" -H "Authorization: Bearer $GO2GG_API_KEY"
主题:默认、简约、渐变、深色、霓虹、自定义(使用 customCss)项目类型:链接、标题、分隔线、嵌入(YouTube)、图片
Python 示例
import requests
API_KEY = "go2_your_key_here" # or os.environ["GO2GG_API_KEY"]
BASE = "https://api.go2.gg/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
# Create short link
resp = requests.post(f"{BASE}/links", headers=headers, json={
"destinationUrl": "https://example.com/product",
"slug": "my-product",
"title": "Product Link",
"tags": ["product"]
})
link = resp.json()["data"]
print(f"Short URL: {link['shortUrl']}")
# Get analytics
stats = requests.get(f"{BASE}/links/{link['id']}/stats", headers=headers).json()["data"]
print(f"Clicks: {stats['totalClicks']}")
# Generate QR (no auth needed)
qr = requests.post(f"{BASE}/qr/generate", json={"url": link["shortUrl"], "size": 512, "format": "png"})
with open("qr.png", "wb") as f:
f.write(qr.content)
API端点摘要
| 服务 | 端点 | 方法 | 认证 |
|---|---|---|---|
| 链接创建链接 | /api/v1/links | POST | 是 |
| 链接列表 | /api/v1/links | GET | 是 |
| 获取链接 | /api/v1/links/:id | GET | 是 |
| 更新链接 | /api/v1/links/:id | PATCH | 是 |
| 删除链接 | /api/v1/links/:id | DELETE | 是 |
| 链接统计 | /api/v1/links/:id/stats | GET | 是 |
| 二维码生成 | /api/v1/qr/generate | POST | 否 |
| 二维码保存 | /api/v1/qr | POST | 是 |
| 二维码列表 | /api/v1/qr | GET | 是 |
| 二维码下载 | /api/v1/qr/:id/download | GET | 是 |
| Webhooks | /api/v1/webhooks | CRUD | 是 |
| Webhook 测试 | /api/v1/webhooks/:id/test | POST | 是的 |
| 画廊 | /api/v1/galleries | 增删改查 | 是的 |
| 画廊项目 | /api/v1/galleries/:id/items | 增删改查 | 是的 |
| 画廊发布 | /api/v1/galleries/:id/publish | POST | 是的 |
速率限制
| 方案 | 请求数/分钟 |
|---|---|
| 免费 | 60 |
| 专业版 | 300 |
| 商业版 | 1000 |
错误代码
| 代码 | 描述 |
|---|---|
| SLUG_RESERVED | Slug 已被保留 |
| SLUG_EXISTS | 此域名下已存在该短链接 |
| INVALID_URL | 目标链接无效 |
| LIMIT_REACHED | 已达到计划链接数量上限 |
| DOMAIN_NOT_VERIFIED | 自定义域名未通过验证 |
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~