Skip to main content Skip to search
Alex Vayl
Posted by
Alex Vayl on
February 4, 2016

Announcing the New NS1 Javascript Client

Node.js is a great tool for interacting with REST API’s that deal with JSON in responses, but you may need something more programmatic. And if you’ve been interacting with NS1’s API via Node.js and require a high level client library, this update is for you.

Today we’re happy to announce that NS1 has a JavaScript client library – compatible with Node.js versions 5 and above.

We use this library ourselves for our frontend web portal and will be updating and making improvements to the API over time.

If you wish to use it on the client side, please contact us as we have CORS restrictions active.

Install via NPM like so:

npm install ns1

Example usage:

var NS1 = require('ns1')
NS1.set_api_key([your api key])
NS1.Zone.find().then(function(zones) {
  console.log(zones) //=> Array of NS1.Zone objects
NS1.Zone.find('').then(function(zone) {
  console.log(zone) //=> NS1.Zone object of just the zone
  zone.update({ zone: '' }).then(function(zone) {
    console.log(zone) //=> NS1.Zone object w/ updated info
NS1.Zone.create({ zone: '' }).then(function(zone) {
  console.log(zone) //=> Your newly created zone
new NS1.Zone({ zone: '' }).save().then(function(zone) {
  console.log(zone) //=> same as above

Useful links: