---
title: "Create a trackable short link for any URL or SMS offer"
method: POST
path: "/v2/links/shorten"
tags: ["links-v2"]
---

# Create a trackable short link for any URL or SMS offer

`POST /v2/links/shorten`

## Request

- Base URL: `https://api.tracklysms.com/api`
- URL: `https://api.tracklysms.com/api/v2/links/shorten`
- Auth: API key in header `X-Api-Key`

## Request body

- ShortenRequest
  - `contactPhone` string: Contact phone number for offer macro substitution
  - `listId` integer: Sending list ID (alternative to phoneNumber)
  - `metadata` object: Arbitrary key-value pairs for attribution
  - `offerId` string: SMS Offer ID (from offers collection)
  - `phoneNumber` string: Sending list phone number in E.164 format
  - `url` string: Raw destination URL to shorten

## Response `201`

Link created

- ShortenResponse
  - `destinationUrl` string: Final destination URL
  - `domain` string: Short link domain
  - `filterBots` boolean: Whether bot filtering is enabled
  - `linkId` string: Short link ID
  - `offerId` string: Offer ID (if offer mode)
  - `shortUrl` string: Full short URL

## Other responses

- `400`: Validation error
- `401`: Authentication error
- `404`: Not found
- `409`: No domain configured

---

[API](https://skmtc.dev/tracklysms/apis/trackly-sms-api.md) · [All operations](https://skmtc.dev/tracklysms/apis/trackly-sms-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tracklysms/apis/trackly-sms-api/revisions/ac1ad22cb2a9?raw)
