API reference

Links

A link is a short URL on smartlink.sh/l/…, or on a connected custom domain, that sends phone visitors to the right app and desktop visitors to the website. Sign-in stays on smartlink.sh.

Create a link

POST/api/v1/links

Create link body
NameTypeDescription
originalUrlrequiredstringThe destination, http or https, up to 2048 characters.
customCodestringYour own short code: 3-32 letters, numbers, "-" or "_". Some words (like api, docs) are reserved. Returns 409 if taken. Omit it to get a random 6-character code.
titlestringDisplay title, 1-200 characters. Defaults to the page title, which is fetched shortly after creation.
iosUrlstringFor app links: the App Store URL for iPhone visitors.
androidUrlstringFor app links: the Google Play URL for Android visitors.
passwordstringVisitors must enter this password (4-64 characters) before the link opens.
expiresAtstring (ISO 8601)After this time the link shows an expired page. Must be in the future.
curl https://smartlink.sh/api/v1/links \
  -H "Authorization: Bearer $SMARTLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "originalUrl": "https://www.tiktok.com/@brand/video/7300000000000000000",
    "customCode": "launch",
    "title": "Launch video"
  }'

Returns 201 with the link object. To route an app to the correct store on each phone, send both store URLs:

App store link
curl https://smartlink.sh/api/v1/links \
  -H "Authorization: Bearer $SMARTLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "originalUrl": "https://apps.apple.com/app/id1234567890",
    "iosUrl": "https://apps.apple.com/app/id1234567890",
    "androidUrl": "https://play.google.com/store/apps/details?id=com.example.app"
  }'

List links

GET/api/v1/links

List links query parameters
NameTypeDescription
pageintegerPage number, starting at 1.
limitintegerPage size, 1-100. Default 20.
searchstringCase-insensitive match on destination, title, or short code.
shortCodestringExact short code.
platformstringOne of the platform values above.
isActivebooleantrue for active links, false for deactivated ones.
curl "https://smartlink.sh/api/v1/links?search=launch&platform=TIKTOK&limit=50" \
  -H "Authorization: Bearer $SMARTLINK_API_KEY"

Returns { "data": [link, …], "pagination": { … } }, newest first.

Get a link

GET/api/v1/links/{id}

curl
curl https://smartlink.sh/api/v1/links/cm1x2y3z4000008l1abcd1234 \
  -H "Authorization: Bearer $SMARTLINK_API_KEY"

# Or look a link up by short code
curl "https://smartlink.sh/api/v1/links?shortCode=launch" \
  -H "Authorization: Bearer $SMARTLINK_API_KEY"

Update a link

PATCH/api/v1/links/{id}

Send any subset of these fields. The destination URL and short code can’t be changed.

Update link body
NameTypeDescription
titlestring1-200 characters.
isActivebooleanfalse pauses the link: it stops redirecting but keeps its analytics.
expiresAtstring | nullA new expiry, or null to remove it.
passwordstring | nullA new password, or null to remove protection.
curl -X PATCH https://smartlink.sh/api/v1/links/cm1x2y3z4000008l1abcd1234 \
  -H "Authorization: Bearer $SMARTLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "isActive": false, "expiresAt": null }'

Delete a link

DELETE/api/v1/links/{id}

Permanently deletes the link and its click history, and the short URL stops working. To pause a link instead, set isActive to false.

curl
curl -X DELETE https://smartlink.sh/api/v1/links/cm1x2y3z4000008l1abcd1234 \
  -H "Authorization: Bearer $SMARTLINK_API_KEY"