Redirect API

Commerce lets you create one-off monetized URLs programmatically.

It’s sometimes useful to create Commerce Anywhere URLs programmatically. The URL format and behavior are documented below.

Request

URL: [<https://redirect.viglink.com>](https://redirect.viglink.com)
Method: GET

Parameters

Parameter

Type

Required

Description

key

string

True

Your Commerce API key, found on your account page.

u

string

True

The URL to monetize. URL must be properly encoded.

cuid

string

False

An ID of your choosing that identifies the clicker, the page the link is on, a campaign or the click itself. **2048 alphanumeric character limit.

utm_source

string

False

Used to identify the site, location, etc. of where your link is posted. Example: mysite, newsletter, twitter

utm_medium

string

False

Marketing method or medium used. Example: banner, social, homepage, email

utm_campaign

string

False

Individual campaign name, slogan, promo code, etc. for a product. Example: black_friday_2022, fathers_day_2023

utm_term

string

False

Identify paid search keywords.

utm_content

string

False

Differentiate similar links on same page. Example: top, footer

cp

string

False

For product URLs, specifies the fallback behavior when a click does not monetize:

"DM" (Divert Manually) - Show a Price Comparison Page to users with alternative approved retailers for the same product.

"DA" (Divert Automatically) - Skip the comparison page and automatically redirect users to the next best eligible retailer for the same product.

fbu

string

False

Fallback Url to go if "u" url cannot beat the bid floor provided.

bf

double

False

Bid floor for the fallback url

Note: Most browsers will only accept URLs with up to 2056 characters.

Response

The server will respond with one of these HTTP status codes:

302 The request was successful. The client should be redirected.

If the input URL (specified by the u parameter) could be monetized, the client is redirected to the monetized version of that URL. If there is no monetized version, the client is redirected to the original URL, unmodified.

400 Required parameters are missing, or their values are not valid.

403 The specified URL is unsafe.

To protect users from malicious web sites, URLs are checked against a list of “bad” sites before redirecting. If the URL is found to be unsafe, a warning page is displayed. For more information visit stopbadware.org.

Example

You’d like to get an affiliate link for the following URL: https://www.macys.com/shop/product/?ID=9792476

  1. Your URL must be encoded first, the resulting encoded URL should look like: https%3A%2F%2Fwww.macys.com%2Fshop%2Fproduct%2F%3FID%3D9792476

  2. Make a GET request to the API including your API key and the newly encoded URL.

  3. The API response will include a URL similar to:
    [<https://redirect.viglink.com?u=https%3A%2F%2Fwww.macys.com%2Fshop%2Fproduct%2F%3FID%3D9792476&key=88ac2a40e081e283ac504d1789d398ac>](https://redirect.viglink.com?u=https%3A%2F%2Fwww.macys.com%2Fshop%2Fproduct%2F%3FID%3D9792476&key=88ac2a40e081e283ac504d1789d398ac)

When someone clicks on the Commerce URL, they’ll be redirected to the monetized version of your original URL:

$ curl -D - 'https://redirect.viglink.com?u=https%3A%2F%2Fwww.macys.com%2Fshop%2Fproduct%2F%3FID%3D9792476&key=88ac2a40e081e283ac504d1789d398ac'
        
HTTP/1.1 302 Moved Temporarily
Content-Length: 0
Location: https://www.macys.com/shop/product/?ID=9792476