NATS For Networks REST API Overview

From TMMwiki
Jump to: navigation, search
NATS For Networks
API Overview
GET /affiliate/search
POST /affiliate/affiliate_login_ips
GET /creative/get_creative_fields
GET /creative/get_creative_rules
PATCH /creative/undelete_creative
PATCH /creative/edit_creative_rules
PATCH /creative/edit_creative
PATCH /creative/delete_creative
POST /creative/delete_creative_rules
POST /creative/add_creative_rule
POST /creative/add_creative
GET /offer/check_orderid_exists
GET /report/profitloss
GET /report/transaction
GET /transaction/transaction_payout_preview
GET /service/ping
PATCH /offer/pause_offer
PATCH /offer/activate_offer
POST /offer/add_tracking_domain
GET /affiliate/get_single_link
GET /affiliate/get_links
PATCH /offer/set_enabled_affiliates
POST /offer/add_offer
POST /offer/add_landing_page
PATCH /offer/edit_offer
PATCH /offer/edit_landing_page
PATCH /offer/store_offer_ips
PATCH /offer/set_offer_countries
PATCH /offer/set_offer_categories
PATCH /offer/set_offer_marketing_types
PATCH /offer/set_offer_goals
PATCH /offer/set_offer_groups
GET /offer/get_commission_changes
POST /offer/add_commission_change
PATCH /offer/set_commission_change_payouts
POST /offer/add_affiliate
PATCH /affiliate/edit_affiliate
POST /advertiser/add_advertiser
PATCH /advertiser/edit_advertiser


The NATS For Networks REST API is accessible at http://<domain>/api/<endpoint>/<action>

  • The API is accessible to admins. /api/<endpoint>/<action> is available only to admins.
  • Replace <domain> with your NATS install domain name.
  • Replace <endpoint> with the endpoint that you are trying to access
  • Some of the endpoints do not require <action> in the url and all of the urls will be specified in the documentation

Allowed Endpoints




Gaining Access to the REST API

In order to access NATS For Networks API your IP address must be in the ADMIN_API_ALLOWED_IPS list. You can add or remove IP addresses to this list via the Configurations Admin under the "Security" tab.

Allowed HTTP Request Methods

  • GET
  • POST
  • PUT

Response Format

Response Status Codes


  • On Success, the API will return a '200' status and output the results of the API call. Please refer to the available API endpoints for possible responses.
  • NOTE: As long as the endpoint and HTTP request method are valid and there are no invalid parameters, a '200' response is returned.


  • The API will return a '400' status if an invalid or unsupported HTTP request is sent.


  • The API will return either a '404' status if an invalid parameter is sent, or if an HTTP request is sent to an invalid endpoint.


  • The API will return a '405' status if an invalid HTTP request method is used.


  • The NATS For Networks REST API uses HTTP Header Authentication.
  • Each REST API request requires the Affiliate username and the Affiliate API key to be sent with the HTTP headers of the request.
  • To retrieve your API key simply select it from the login table of your NATS database or put in a support ticket and we can retrieve it for you.
  • If you do not have an API key, you can set one by going to the Affiliates Admin and clicking the icon labeled, "Change API Key".
  • Please note that only full admin accounts are authorized to use the API and set an API key.

Required HTTP Headers

  • api-key: Affiliate api key
  • api-username: Affiliate user name
    • NOTE** The headers keys are NOT case sensitive.

Example Authentication

Authentication can be handled in various ways using different programming languages. Below are some complete example calls to the Ping endpoint with HTTP Header authentication.


$url = 'http://domain/api/ping'
$curl = curl_init(); 
$headers = array( 
    'api-key: 44b5498dbcb481a0d00b404c0169af62', 
    'api-username: tmm1phrvezsbu' 
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_URL, $url); 
$resp = curl_exec($curl); 
//dumps an associative array representation of the json 
var_dump(json_decode($resp, true)); 
// Close request to clear up some resources 


  • This example requires pip and the request library which can be installed via pip by: 'pip install requests'
import requests

url = 'http://domain/api/ping'
headers = {
	'api-key': '44b5498dbcb481a0d00b404c0169af62',
	'api-username': 'tmm1phrvezsbu'
 params =  { 
        'payvia_type_id': 1, 
        'rule_type': 'enabled' 
res = requests.get(url, params=params, headers=headers)
print res.json()


  • This example requires npm and the request module which can be installed via npm by: 'npm install request'
var request = require('request');
var options = {           
    url: 'http://domain/api/ping',
    method: 'GET',        
    json: true,           
    headers: {            
        'api-key': '44b5498dbcb481a0d00b404c0169af62',
        'api-username': 'tmm1phrvezsbu'
function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
request(options, callback);


curl -X GET 'http://domain/api/ping' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: tmm1phrvezsbu"

And this is the output: