Skip to main content

Shorten a Long URL

Create a short URL from a long URL with optional tracking and expiration settings.

HTTP Request​

POST /v2/accounts/<account_sid>/links

Request Parameters​

ParameterRequiredDescription
long_urlYesThe URL to shorten (must be a valid URL)
expire_inNoDuration in seconds before expiration (min: 60s, default: 31 days, max: 365 days)
trackingNoEnable click tracking: "true" or "false"
shorten_url_headerNoDLT header for Indian SMS businesses (must match DLT registration)
callback_urlNoWebhook URL for click notifications
custom_fieldNoCustom metadata up to 1024 characters (e.g., Order ID, Payment ID)
custom_domainNoUse a custom domain instead of default exo.tl

Response​

{
"sid": "unique_alpha_numeric_id",
"short_url": "https://exo.tl/abc123",
"short_code": "abc123",
"long_url": "https://example.com/very/long/url",
"tracking": true,
"expires_at": "2024-02-15 10:30:00",
"created_time": "2024-01-15 10:30:00",
"last_viewed": null,
"total_clicks": 0
}

Response Fields​

FieldTypeDescription
sidStringUnique identifier
short_urlStringGenerated short URL
short_codeStringURL shortening key
long_urlStringOriginal URL
trackingBooleanWhether tracking is enabled
expires_atDateTimeExpiration timestamp
created_timeDateTimeCreation timestamp
last_viewedDateTimeLast access timestamp
total_clicksIntegerTotal view count

Get Short URL Details​

GET /v2/accounts/<account_sid>/links/<uuid>

Returns the same response structure as the POST endpoint.

HTTP Status Codes​

StatusCodeDescription
200—Success
207—Partial success
4001001Missing mandatory parameters
4001002Invalid parameter values
4001007Invalid request body
4011015Authentication failed
4031010Insufficient permissions
4041012Short code not found or expired
5xx—Server errors