shaf_live_...) with workspace permissionscurl, or your preferred developer runtime (Node.js 18+, Python 3.9+, or Go 1.20+).1Deployment Pipeline Automation
1export SHAF_API_TOKEN="shaf_live_9a7d8f2b3c4e5a6f7b8c9d0e1f2a3b4c"
12345678curl -X POST "https://shaf.app/api/v1/links" \ -H "Authorization: Bearer $SHAF_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://github.com/meladhani01/shaf", "slug": "github-repo", "domain": "shaf.is" }'
123456789101112{ "code": 0, "data": { "id": 142, "slug": "github-repo", "url": "https://github.com/meladhani01/shaf", "domain": "shaf.is", "shortUrl": "https://shaf.is/github-repo", "createdAt": "2026-09-20T21:00:00.000Z", "clicks": 0 } }
| Field | Type | Description |
code | number | 0 indicates success; non-zero values represent error codes |
data.id | number | Unique persistent database identifier |
data.slug | string | The active path identifier at the edge |
data.domain | string | The authority domain resolving this link |
data.shortUrl | string | Fully-qualified public URL ready for sharing |
data.clicks | number | Real-time click count (initialized to 0) |
12curl -X GET "https://shaf.app/api/v1/links/github-repo/analytics?domain=shaf.is" \ -H "Authorization: Bearer $SHAF_API_TOKEN"
12345678910111213141516{ "code": 0, "data": { "totalClicks": 128, "uniqueVisitors": 94, "topCountries": [ { "country": "US", "count": 72 }, { "country": "DE", "count": 28 }, { "country": "JP", "count": 18 } ], "topBrowsers": [ { "browser": "Chrome", "count": 82 }, { "browser": "Safari", "count": 34 } ] } }
url field is not a valid HTTP/HTTPS URL, or if the slug contains invalid characters (only lowercase letters, numbers, and hyphens are permitted).1{ "code": 40001, "message": "Invalid URL destination format" }
Authorization header is missing, malformed, or contains an expired/revoked API key. Verify that your header uses the format Bearer shaf_live_....slug parameter to let Shaf auto-generate a random 6-character identifier.Retry-After: <seconds> response header.