Create a trackable short link for any URL or an offer from your catalog. Unlike POST /v2/links (which requires Offer Management and only supports PartnershipOffers), this endpoint works with any URL and with SMS Offers.
Requires SMS product. This endpoint is available to any account with the SMS product enabled. Returns 403 product_not_enabled otherwise.
How It Works
There are two modes:
URL mode — provide a raw url and get a short link pointing directly at it. No affiliate tracking.
Offer mode — provide an offerId (from your SMS Offers, not PartnershipOffers) and the endpoint resolves the offer’s tracking URL with proper TUNE/Everflow parameters, preserving affiliate attribution.
When a recipient clicks the short link:
Short link (list domain) -> Link tracking service -> Destination URL
Body Parameters
Raw destination URL to shorten. Must use http or https scheme. Required unless offerId is provided.
SMS Offer ID (from the offers collection). If provided, the endpoint resolves the offer’s tracking URL with proper TUNE/Everflow params. Takes priority over url if both are provided.
Sending list ID — determines which shortener domain to use. Required unless phoneNumber is provided.
Sending list phone number in E.164 format (e.g. +18005551234). Alternative to listId. Required unless listId is provided.
Contact phone number in E.164 format. Passed as a macro to offer URL templates ({{contact.phone}}). Optional.
Arbitrary key-value pairs stored on the short link for attribution. For example, {"source": "ai_agent", "conversation_id": "abc123"}. Optional.
Response Fields
Full short URL to include in your SMS message body. Uses the list’s configured link shortener domain.
Unique short link ID. Appended to the domain to form the shortUrl.
The final destination URL that the recipient lands on after redirect.
The link shortener domain used for this short link.
The SMS offer ID the link is associated with, if an offer was used.
Whether bot filtering is enabled for this link. Inherited from the offer’s filter_bots setting when offerId is provided.
Examples
Shorten a raw URL
curl -X POST https://app.tracklysms.com/api/v2/links/shorten \
-H "X-Api-Key: trk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/landing-page",
"listId": 42
}'
curl -X POST https://app.tracklysms.com/api/v2/links/shorten \
-H "X-Api-Key: trk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"offerId": "6651a3ef1234567890abcdef",
"phoneNumber": "+18005551234",
"contactPhone": "+15551234567",
"metadata": {
"source": "ai_agent",
"conversation_id": "conv_abc123"
}
}'
Success (201)
Error - Missing URL or Offer (400)
Error - Invalid URL (400)
Error - Offer Not Found (404)
Error - No Domain Configured (409)
{
"shortUrl" : "https://yourdomain.com/Ab3kX9q" ,
"linkId" : "Ab3kX9q" ,
"destinationUrl" : "https://example.com/offer?aff_sub=12345" ,
"domain" : "yourdomain.com" ,
"offerId" : "6651a3ef1234567890abcdef" ,
"filterBots" : false
}
Error Codes
HTTP Status Error Code Description 400 missing_url_or_offerNeither url nor offerId was provided. 400 missing_list_identifierNeither listId nor phoneNumber was provided. 400 invalid_urlThe url does not use http or https scheme. 400 invalid_phoneThe phoneNumber is not a valid E.164 phone number. 403 product_not_enabledYour account does not have the SMS product enabled. 404 offer_not_foundNo active offer found matching the provided offerId. 404 list_not_foundThe sending list was not found or does not belong to your account. 409 no_domain_configuredThe sending list does not have a link shortener domain configured. 500 id_collisionFailed to generate a unique link ID after multiple attempts. Retry the request.
Notes
The metadata field is stored on the MessageShortLink document and can be used for attribution tracking in analytics.
When offerId is provided, the offer’s filter_bots setting is inherited by the short link. The link tracking service handles bot filtering on click.
Each call creates a new unique short link. There is no deduplication.
This endpoint is separate from POST /v2/links, which continues to serve PartnershipOffers only.
Next Steps
Create Link (Offers) Create links for partnership offers
Link Tracking Track clicks and attribute conversions