curl -X POST https://api.hypersnap.io/v1/links/create \
-H "Authorization: Bearer hs_live_8f9a2b1c4d5e" \
-H "Content-Type: application/json" \
-d '{
"destination_url": "https://launch.hypersnap.io/q4-roadmap",
"custom_alias": "q4map",
"expires_at": "2024-12-31T23:59:59Z"
}'
API Reference
Enterprise-grade link infrastructure
Endpoints List
Manage your short links, track performance metrics, and configure redirect rules through our secure REST interface. All requests require Bearer token authentication via the `Authorization` header.
/v1/links/create
Generates a new short URL with custom alias support. Accepts `destination_url`, `expires_at`, and `geo_targeting` parameters. Returns a JSON object containing `short_url`, `link_id`, and `qr_code_svg`.
/v1/links/{link_id}/analytics
Retrieves click-through data for a specific campaign. Supports `date_range`, `device_type`, and `referrer_source` query parameters. Response schema includes `total_clicks`, `unique_visitors`, and `conversion_rate`.
/v1/links/{link_id}/update
Modifies destination or redirect status for an active link. Requires `new_destination` and `preserve_history` flags. Returns updated `link_status` and `last_modified` timestamp.
Code Examples
Integrate HyperSnap into your deployment pipeline using our standardized request format. Examples below demonstrate link creation and payload validation.
Create Short Link
Fetch Analytics
import requests
api_key = "hs_live_8f9a2b1c4d5e"
link_id = "lnk_7x9m2p4q"
response = requests.get(
f"https://api.hypersnap.io/v1/links/{link_id}/analytics",
headers={"Authorization": f"Bearer {api_key}"},
params={"date_range": "last_30d", "device_type": "mobile"}
)
data = response.json()
print(f"Unique clicks: {data['unique_visitors']}")
Error Codes
HyperSnap returns standard HTTP status codes alongside structured JSON error payloads. Review common failure states below to streamline your error handling logic.
Invalid Payload Format
Triggered when `destination_url` lacks a valid scheme or exceeds 2048 characters. Response includes `error_code: MISSING_DESTINATION` and `retry_after: 0`.
Expired API Key
Occurs when the Bearer token has been rotated or revoked in the HyperSnap dashboard. Response schema returns `error_code: AUTH_TOKEN_EXPIRED` and a `token_refresh_url`.
Rate Limit Exceeded
Applied after 1,200 requests per minute on the Enterprise tier. Headers include `X-RateLimit-Remaining` and `Retry-After`. Response body contains `error_code: RATE_LIMIT_HIT`.