Links
Convert URL
Converts any merchant URL into a trackable affiliate link. Always returns a tracking_url - use the affiliated field to know whether the link will earn commission. A value of false means the campaign is inactive or your account needs approval. Optionally pass sub IDs for attribution, or shorten=true for a clnk.in short link.
POST
/pub_api/v3/links/convert
write:links
Request Body
|
urlrequired
string
|
The merchant URL to convert into an affiliate tracking link. Must be a full URL including scheme (e.g. https://www.flipkart.com/product). |
|
channel_idoptional
integer
|
Channel to attribute the click to. Defaults to your default channel, then first channel if not provided or not found. |
|
shortenoptional
boolean
|
Pass true to get a shortened affiliate link via clnk.in in the short_url field. Default: false. |
|
subidoptional
string
|
Affiliate Sub ID 1 - passed through to transaction tracking (e.g. a user ID or campaign tag). |
|
subid2optional
string
|
Affiliate Sub ID 2 (e.g. device type: desktop, mobile). |
|
subid3optional
string
|
Affiliate Sub ID 3 (e.g. traffic source: facebook, newsletter). |
|
subid4optional
string
|
Affiliate Sub ID 4. |
|
subid5optional
string
|
Affiliate Sub ID 5. |
Response Fields
FieldTypeDescription
tracking_url
string
The affiliate tracking URL. Always returned for valid URLs.
affiliated
boolean
true if the campaign is active and your account has access - the link will earn commission. false if the campaign is inactive, not found, or requires approval you haven't been granted.
original_url
string
The original URL you submitted.
campaign
object | null
Matched campaign
id and name. null if no campaign was found for this domain.
short_url
string
Shortened affiliate link via clnk.in. Only present when
shorten=true is passed.
Error Cases
401 |
Missing or invalid API key. |
403 |
API key does not have the write:links scope. |
422 |
url parameter is missing or blank, or the publisher has no valid channel. |
Request
curl -X POST https://developers.cuelinks.com/pub_api/v3/links/convert \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://www.flipkart.com/mobiles/apple/pr?sid=tyy%2C4io"}'
Request (with sub IDs + shorten)
curl -X POST https://developers.cuelinks.com/pub_api/v3/links/convert \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://www.flipkart.com/product", "channel_id": 123, "shorten": true, "subid": "user_7", "subid2": "desktop", "subid3": "facebook" }'
200 OK
200
{ "data": { "tracking_url": "https://linksredirect.com/?cid=456&subid=user_7&subid2=desktop&subid3=facebook&source=api&url=https%3A%2F%2Fwww.flipkart.com%2Fproduct", "short_url": "https://fkrt.clnk.in/xY7z", "affiliated": true, "original_url": "https://www.flipkart.com/product", "campaign": { "id": 101, "name": "Flipkart" } } }
422 Unprocessable Entity
422
{ "error": "url is required" }