Skip to main content
Skip table of contents

API Implementation with Commerce

Note: Please find complete documentation for all Sovrn Commerce APIs here.

All sites/apps/toolbars/etc that you hope to use will need to be approved  by Sovrn's Network Quality team in order for you to affiliate with our merchant partners. 

How to find your site's API key and secret key

Both your API key and your secret key can be found on the Settings page of your Sovrn Commerce account. Clicking on the "key" icon in the row for each site will show the associated API key. Here, you will also have the option to generate a secret key which will allow you to use some of our API tools. 

Note: Your secret key can be used to pull all of your account data, and you will not need a secret key for each of your sites. When using the Secret Key with the Sovrn Commerce APIs, use the word "secret" along with your secret key. That is, "secret 1234" rather than just "1234". You can read more about authorization here.

How to find your site ID

If you are connecting your Sovrn account to a reporting tool, you may need to access your site ID, also referred to as your campaign ID.

Your site ID/campaign ID can be found on the Site settings page. Tap the settings gear icon adjacent to the desired site or channel. Once you've tapped the icon, view the URL. It should look something like this: platform.sovrn.com/commerce/settings/site?flyoutOpen=apiKeys&tab=approved&selectedSite=XXXXXX.

The numbers that are replaced by the Xs are your site ID/campaign ID.

Are there rate limits for any of the APIs? 

Here are the rate limits currently in place:

  • Product Affiliate API: 100 per second

  • Product Data API: 20 per second

  • Merchant Details: 1 per 3 seconds

  • Merchant Status: 1 per 3 seconds

  • Transaction API: 1 per 60 seconds

Please also check the complete API documentation for more information. 

Aliasing Sovrn Commerce API Calls

You can mask the fact that you use Sovrn Commerce's affiliation services by creating "alias" domains for Sovrn's service-related hostnames, and making a slight modification to your Sovrn JavaScript library initialization parameters.

Any publisher can alias the API calls by creating a single CNAME and redirecting Sovrn API calls to that name.

To create the appearance that a page on your website calls publisher-provided services instead of Sovrn Commerce's service, use the following guidelines:

  • Create a DNS CNAME that points to api.viglink.com. We suggest using click.<publisherdomain>.com

  • Change the api_url parameter in the Sovrn Javascript library initialization code on your pages to specify the alias domain name.

 An example altered initialization block is shown below:

CODE
<script type="text/javascript">   
  var vglnk = { 
    api_url: '//click.mydomain.com/api',                 
    key: 'mypublisherkey' 
  }; 
  (function(d, t) {     
    var s = d.createElement(t); 
    s.type = 'text/javascript'; 
    s.async = true;     
    s.src = ('https:' == document.location.protocol ? vglnk.api_url : '//cdn.viglink.com/api') + '/vglnk.js';     
    var r = d.getElementsByTagName(t)[0]; 
    r.parentNode.insertBefore(s, r);   
  }(document, 'script')); 
</script>

A Note About SSL

These instructions apply primarily to non-SSL traffic. Aliasing SSL traffic is more complex because of the security protocols involved. Sovrn does not currently support aliasing its hostnames for SSL (https) traffic.

If your site supports SSL, the code snippet below will function - but viewers accessing the publisher site via SSL will see warnings in their browser.

CODE
<script type="text/javascript">   
  var vglnk = { api_url: '//click.mydomain.com/api',                 
    key: 'mypublisherkey' 
  };
  (function(d, t) {     
    var s = d.createElement(t); 
    s.type = 'text/javascript'; s.async = true;     
    s.src = ('https:' == document.location.protocol ? vglnk.api_url : '//cdn.viglink.com/api') + '/vglnk.js';     
    var r = d.getElementsByTagName(t)[0]; 
    r.parentNode.insertBefore(s, r);   
  }(document, 'script')); 
</script> 

How can I easily test out the Commerce API?

Let's say you want to see the type of information the API gives you, if the data is what you're looking for, how it would look, or even, how to use it before deciding if it's the API you will use.

With most of our API Documentations, there will be a "Try it Out" section, that requires zero coding at all, located at the very bottom of the page. In these sections, you can test to see exactly what information will be provided, the different filters or parameters that you can use, and of course, the result itself.

Here's a link to our API Documentation.

You’ll need your secret key to authenticate. See how to find your key above**Do not share your Secret Key**

Next, let's take a look at the Sovrn Transaction API documentation.

To the right you’ll see the Authorization header. This is where you’ll need to place your secret key in the format: secret {SECRET KEY}

image-20240919-205425.png

Scroll to the bottom of the page and you'll see Query Params. You can fill these in and click “Try It!” to get an example response.

image-20240919-205213.png

I still need help.

If you still need help, please check the complete API documentation here, or reach out to Sovrn Support.  

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.