API/Links API

Links API

Create, update, duplicate, list, and archive parent links and sublinks.

Parent links own the canonical destination and social metadata. Sublinks model individual placements and add their own slug, context, and UTM values. notes is an optional internal description of what the link is for. It is not the social-card description and never appears on the redirect.

curl -X POST https://kliq.sh/api/v1/links \
  -H "Authorization: Bearer $KLIQ_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "domainId": "DOMAIN_ID",
    "slug": "summer-launch",
    "name": "Summer launch",
    "destinationUrl": "https://example.com/launch",
    "title": "Summer launch",
    "description": "See what is new",
    "notes": "Homepage launch CTA for August",
    "idempotencyKey": "summer-launch-parent-v1"
  }'

New links redirect as soon as their domain is verified. There is no separate activation step.

List parents

curl "https://kliq.sh/api/v1/links?limit=50" \
  -H "Authorization: Bearer $KLIQ_API_KEY"
curl -X POST https://kliq.sh/api/v1/links/PARENT_ID/sublinks \
  -H "Authorization: Bearer $KLIQ_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "slug": "youtube-summer-launch",
    "name": "YouTube description",
    "context": "Launch video description",
    "notes": "Pinned comment CTA for the launch video",
    "utmSource": "youtube",
    "utmMedium": "video",
    "utmCampaign": "summer-launch",
    "idempotencyKey": "summer-launch-youtube-v1"
  }'

PATCH /links/{linkId} accepts only the values to change. A parent can change its destination and metadata. A sublink cannot set destinationUrl because it inherits that value.

On a parent, utmSource, utmMedium, utmCampaign, utmTerm, and utmContent are written into destinationUrl: a value sets the parameter and an empty string removes it. On a sublink they are stored on the sublink and added to the parent's URL on redirect.

curl -X PATCH https://kliq.sh/api/v1/links/LINK_ID \
  -H "Authorization: Bearer $KLIQ_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"name":"YouTube pinned comment","utmContent":"pinned-comment"}'

POST /links/{linkId}/duplicate creates an active copy with a free <slug>-copy address (-copy-2, -copy-3, … when taken) and the name suffixed with "(copy)". The destination, social preview, notes, tags, UTM parameters, and conversion tracking are copied. Clicks, sublinks, and attributed customers are not. A sublink's copy stays under the same parent.

curl -X POST https://kliq.sh/api/v1/links/LINK_ID/duplicate \
  -H "Authorization: Bearer $KLIQ_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"idempotencyKey":"launch-copy-v1"}'

Retrying with the same idempotencyKey returns the first copy with "duplicate": true.

curl -X DELETE https://kliq.sh/api/v1/links/LINK_ID \
  -H "Authorization: Bearer $KLIQ_API_KEY"

Archival is the only link lifecycle action. It stops the URL from redirecting without physically deleting the link or its historical analytics.

Admin APIAnalytics API