Authentication

Before using the API, you will need to know your API key, which will be provided by NGP VAN. The API key takes the form of a GUID formatted in the style 7c9e6679-7425-40de-944b-e07fc1f90ae7 (case-insensitive).

Your API key is tied to your specific tenant, and all API calls will only return data from within that tenant and will only modify data in that tenant.

You must attach your API key using BasicAuth when making all API calls. The username should be set to apiuser and the password should be the value of your API key. Here is a very simple example of how to implement that in NodeJS:

var request = require('request');
var username = 'apiuser';
var password = '7c9e6679-7425-40de-944b-e07fc1f90ae7';
var options = {
  url: 'https://api.myngp.com/v2/resourcePath',
  auth: {
    user: username,
    password: password
  },
  ...
};
request(options, function (err, res, body) {
  if (err) {
    console.dir(err);
    return;
  }
  console.dir('headers', res.headers);
  console.dir('status code', res.statusCode);
  console.dir(body);
});

Alternatively, it can passed in your HTTP request headers, but with the identifier of apiKey instead of apiuser from our basic auth example above. For example:

POST /v2/contacts/findOrCreate HTTP/1.1

apiKey: 7c9e6679-7425-40de-944b-e07fc1f90ae7
Content-Type: application/json;