evrythng.js v6.0.0

The release of evrythng.js version 6.0.0 brings several breaking changes. There is an introduction of new API key types, which also bring a set of new API entities.

Breaking Changes

New default setup() options

When using setup(), apiVersion:2 is used by default, which means that the enterprise API v2 is used. If you still want to use the previous version you need to set apiVersion:1

// Before
// apiUrl is `apiUrl:https://api.evrythng.com`

// Now
// apiUrl is `https://api.evrythng.io/v2`

Configurable apiUrl in setup()

The apiUrl option is selected automatically depending on the values you specify for region and apiVersion.

// Before
// output is `apiUrl:https://api.evrythng.com`

// Now
  apiVersion: 2,
  region: 'eu'
// apiUrl is `https://api.eu.evrythng.io/v2`

## New Scopes for apiVersion:2

New Scopes for apiVersion:2

In the API v2 version, only 2 scope types are supported: Operator and Access Token

// to create Operator scope
import { Operator } from 'evrythng';
const operator = new Operator(OPERATOR_API_KEY);

// to create Access Token scope
import { AccessToken } from 'evrythng';
const accessToken = new AccessToken(ACCESS_TOKEN_API_KEY);

## New APIs for apiVersion:2

Operator Access

Create, read, update, or delete an operator access

const accountId = '...';

// to create operatorAccess()
const operarorAccess = await operator

Access Policy

Create, read, update, or delete an access policy

// to create accessPolicy()
const accessPolicy = await operator.accessPolicy().create(data)

Access Token

Create and read an access token

// to create accessToken()
const accessToken = await operator.accessToken().create(data)


If you need to read your Operator access scope, you should use the me() endpoint

import { Operator } from 'evrythng';
const operator = new Operator(OPERATOR_API_KEY);

// to read my Operator access
const operatorAccess = await operator.me().read();

Jump to our enterprise API v2 documentation to know more about these new scopes, and read our operatorAccess, accessTokens and me API documents to learn more about our new APIs.