# URL shortening over API
---

URL shortening and tracking is currently available over API for [SMS](https://www.infobip.com/docs/sms) and [Viber](https://www.infobip.com/docs/viber).

On SMS, URL shortening and tracking is supported on the HTTP API and SMPP. For more information on SMPP, see [SMPP specification](https://www.infobip.com/docs/essentials/api-essentials/smpp-specification).

You can enable shortening and tracking in the API request to Infobip using the following:

```json showLineNumbers copy filename="json"
{
    ...
    "urlOptions": {
        "shortenUrl": true,
        "trackClicks": true,
        "trackingUrl": "https://mybrand.com/track-url-clicks-webhook",
        "removeProtocol": true,
        "customDomain": "mybrand.com"
    }
}
```

Where:

| Option | Description |
| --- | --- |
| shortenUrl | Default: true.  Can only be "true" if using urlOptions |
| trackClicks | Set to either "true" or "false" to track when an end user clicks a URL. Default: true. **Note**: Can only be used for Shortened URLs. |
| trackingUrl | The webhook to which you want the URL click events to be returned. |
| removeProtocol | Set to "true" or "false" for remove the "https://" from the URL. Default: false |
| customDomain | The custom or brand domain that you want to keep. |

In addition, take note of the following guidance:

- If you submit an invalid custom domain in the SMS request, the message fails and a delivery report indicates the rejection.
- If customDomain is not set, the URL will be shortened using an Infobip default domain.