Particle API JS (Javascript SDK)

ParticleJS is JavaScript library for the Particle Device Cloud API for Node.js and the browser. It's open source so you can edit, change or even send in pull requests if you want to share!

This page contains examples to get started using the library.

For more details, see the detailed reference below and check the examples folder on GitHub.

Installation

Node.js

First, make sure you have node.js installed!

Next, open a command prompt or terminal, and install by typing:

$ npm install particle-api-js

Browser

Particle API JS can be included using bower:

$ bower install particle-api-js

Alternately, you can pull in Particle API JS from the JSDelivr and simply include the script in your HTML.

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/particle-api-js@10/dist/particle.min.js">
</script>

Now you will have a Particle object available that you can use in your application.

Responses

All functions in this library return promises.

particle.login({username: 'email@example.com', password: 'pass'}).then(
  function(data){
    console.log('API call completed on promise resolve: ', data.body.access_token);
  },
  function(err) {
    console.log('API call completed on promise fail: ', err);
  }
);

Examples

Here are some common use cases of using the functions in the Javascript library.

Logging in

login

You can create an account here. Use the token from login as the auth parameter in other calls.

var Particle = require('particle-api-js');
var particle = new Particle();
var token;

particle.login({username: 'user@email.com', password: 'pass'}).then(
  function(data) {
    token = data.body.access_token;
  },
  function (err) {
    console.log('Could not log in.', err);
  }
);

Device management

listDevices

List devices for a user with listDevices.

var token; // from result of particle.login
var devicesPr = particle.listDevices({ auth: token });

devicesPr.then(
  function(devices){
    console.log('Devices: ', devices);
  },
  function(err) {
    console.log('List devices call failed: ', err);
  }
);

callFunction

Call a function in device with callFunction.

var fnPr = particle.callFunction({ deviceId: 'DEVICE_ID', name: 'brew', argument: 'D0:HIGH', auth: token });

fnPr.then(
  function(data) {
    console.log('Function called succesfully:', data);
  }, function(err) {
    console.log('An error occurred:', err);
  });

The function needs to be defined in the firmware uploaded to the device and registered to the Particle cloud.

You pass along the name of the function and the params.

If the function call succeeds, data.return_value is the value returned by the function call on the Particle device.

claimDevice

Claims device and adds it to the user account with claimDevice

particle.claimDevice({ deviceId: 'DEVICE_ID', auth: token }).then(function(data) {
  console.log('device claim data:', data);
}, function(err) {
  console.log('device claim err:', err);
});

flashDevice

Flash firmware to device with flashDevice

particle.flashDevice({ deviceId: 'DEVICE_ID', files: { file1: './path/file1' }, auth: token }).then(function(data) {
  console.log('Device flashing started successfully:', data);
}, function(err) {
  console.log('An error occurred while flashing the device:', err);
});

getDevice

Gets all attributes for the device with getDevice

var devicesPr = particle.getDevice({ deviceId: 'DEVICE_ID', auth: token });

devicesPr.then(
  function(data){
    console.log('Device attrs retrieved successfully:', data);
  },
  function(err) {
    console.log('API call failed: ', err);
  }
);

getVariable

Gets a variable value for the device with getVariable

particle.getVariable({ deviceId: 'DEVICE_ID', name: 'temp', auth: token }).then(function(data) {
  console.log('Device variable retrieved successfully:', data);
}, function(err) {
  console.log('An error occurred while getting attrs:', err);
});

The variable needs to be defined in your device's code.

If getting the variable succeeds, data.body.result is the value of the variable on the Particle device.

removeDevice

Removes device from the user account with removeDevice

particle.removeDevice({ deviceId: 'DEVICE_ID', auth: token }).then(function(data) {
  console.log('remove call response:', data);
}, function(err) {
  console.log('An error occurred while removing:', err);
});

renameDevice

Renames device for the user account with renameDevice

particle.renameDevice({ deviceId: 'DEVICE_ID', name: 'new-name', auth: token }).then(function(data) {
  console.log('Device renamed successfully:', data);
}, function(err) {
  console.log('An error occurred while renaming device:', err);
});

signalDevice

Send a signal to the device to shout rainbows with signalDevice

particle.signalDevice({ deviceId: 'DEVICE_ID', signal: true, auth: token }).then(function(data) {
  console.log('Device is shouting rainbows:', data);
}, function(err) {
  console.log('Error sending a signal to the device:', err);
});

Send a signal to the device to stop shouting rainbows

particle.signalDevice({ deviceId: 'DEVICE_ID', signal: false, auth: token }).then(function(data) {
  console.log('The LED is back to normal:', data);
}, function(err) {
  console.log('Error sending a signal to the device:', err);
});

sendPublicKey

Send public key for a device to the cloud with sendPublicKey

particle.sendPublicKey({ deviceId: 'DEVICE_ID', key: 'key', auth: token }).then(function(data) {
  console.log('Public key sent successfully:', data);
}, function(err) {
  console.log('Error sending public key to the device:', err);
});

getEventStream

Get event listener to an stream in the Particle cloud with getEventStream

//Get events filtered by name
particle.getEventStream({ name: 'x', auth: token}).then(function(stream) {
  stream.on('event', function(data) {
    console.log("Event: ", data);
  });
});

//Get your devices events
particle.getEventStream({ deviceId: 'mine', auth: token }).then(function(stream) {
  stream.on('event', function(data) {
    console.log("Event: ", data);
  });
});

//Get test event for specific device
particle.getEventStream({ deviceId: 'DEVICE_ID', name: 'test', auth: token }).then(function(stream) {
  stream.on('event', function(data) {
    console.log("Event: ", data);
  });
});

data is an object with the following properties

{
  "name":"Uptime",
  "data":"5:28:54",
  "ttl":"60",
  "published_at":"2014-MM-DDTHH:mm:ss.000Z",
  "coreid":"012345678901234567890123"
}

When a network error occurs or the event stream has not received a heartbeat from the Particle API in 13 seconds, the event stream will disconnect and attempt to reconnect after 2 seconds. To customize the reconnection behavior, close the stream in the disconnect handler.

// This is not a functional reconnection implementation, only an illustration of the various events
let attempts = 10;
particle.getEventStream(options).then(function(stream) {
  stream.on('disconnect', function() {
    console.log('Disconnected from Particle event stream');
    attempts--;
    if (attempts <= 0) {
      console.log('Giving up reconnecting');
      stream.abort();
    }
  });
  stream.on('reconnect', function() {
    console.log('Attempting to reconnect to Particle event stream');
  });
  stream.on('reconnect-success', function() {
    console.log('Reconnected to Particle event stream');
    attempts = 10;
  });
  stream.on('reconnect-error', function(error) {
    console.log('Failed to reconnect to Particle event stream', error);
  });
});

In case your event handler throws an exception, the error event will be emitted.

particle.getEventStream(options).then(function(stream) {
  stream.on('event', function(data) {
    throw new Error('oops');
  });
  stream.on('error', function(error) {
    console.log('Error in handler', error);
  });
});

publishEvent

Register an event stream in the Particle cloud with publishEvent

var publishEventPr = particle.publishEvent({ name: 'test', data: JSON.stringify({ ok: true }), auth: token });

publishEventPr.then(
  function(data) {
    if (data.body.ok) { console.log("Event published succesfully") }
  },
  function(err) {
    console.log("Failed to publish event: " + err)
  }
);

Working with code

compileCode

Compiles files in the Particle cloud with compileCode

var ccPr = particle.compileCode({ files: { 'main.cpp': './project/main.cpp', 'my_lib/lib.cpp': './project/my_lib/lib.cpp' }, auth: token });

ccPr.then(
  function(data) {
    console.log('Code compilation started successfully:', data);
  }, function(err) {
    console.log('An error occurred while compiling the code:', err);
  });

Flashing

Flash firmware to a device with flashDevice

User management

createUser

Creates a user in the Particle cloud with createUser

particle.createUser({ username: 'example@email.com', password: 'pass' }).then(function(data) {

We try to login and get back an accessToken to verify user creation

  var loginPromise = particle.login('example@email.com', 'pass');

We'll use promises to check the result of the login process

    loginPromise.then(
      function(data) {
        console.log('Login successful! access_token:', data.access_token);
      },
      function(err) {
        console.log('Login failed:', err);
      }
    );
  }
});

listAccessTokens

Lists access tokens from the Particle cloud for the specified user with listAccessTokens

particle.listAccessTokens({ username: 'u@m.com', password: 'pass' }).then(function(data) {
  console.log('data on listing access tokens: ', data);
}, function(err) {
  console.log('error on listing access tokens: ', err);
});

deleteAccessToken

Removes an access token from the Particle cloud for the specified user with deleteAccessToken

particle.deleteAccessToken({ username: 'u@m.com', password: 'pass', token: 'token' }).then(function(data) {
  console.log('data on deleting accessToken: ', data);
}, function(err) {
  console.log('error on deleting accessToken: ', err);
});

Product support

If you are a product creator you can use the Javascript library to manage devices, firmware, integrations, and more.

Many of the functions in the Javascript library accept a product parameter. Pass your product ID number (such as 4567) or the slug (such as myproduct-v100) to make that function act on that product.

Detailed reference

Here a full reference of every function available in the Javascript client library.

constructor

src/Particle.js:39-48

Contructor for the Cloud API wrapper.

Create a new Particle object and call methods below on it.

Parameters

  • options Object Options for this API call Options to be used for all requests (see Defaults) (optional, default {})
    • options.baseUrl string?
    • options.clientSecret string?
    • options.clientId string?
    • options.tokenDuration number?
    • options.auth Auth? The access token or basic auth object. If not specified here, will have to be added to every request

login

src/Particle.js:85-102

Login to Particle Cloud using an existing Particle acccount.

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.password String Password for the Particle account
    • options.tokenDuration Number How long the access token should last in seconds (optional, default this.tokenDuration)
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

sendOtp

src/Particle.js:113-129

If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login

Parameters

  • options Object Options for this API call
    • options.mfaToken String Given as 'mfa_token' in the error body of .login().
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

enableMfa

src/Particle.js:139-141

Enable MFA on the currently logged in user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

confirmMfa

src/Particle.js:154-168

Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.

Parameters

  • options Object Options for this API call
    • options.mfaToken Object Token given from previous step to
    • options.otp Object Current one-time-password generated from the authentication app
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

disableMfa

src/Particle.js:179-187

Disable MFA for the user.

Parameters

  • options Object Options for this API call
    • options.currentPassword Object User's current password
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createCustomer

src/Particle.js:199-215

Create Customer for Product.

Parameters

  • options Object Options for this API call
    • options.email String Username for the Particle account
    • options.password String Password for the Particle account
    • options.product String Create the customer in this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

loginAsClientOwner

src/Particle.js:224-238

Login to Particle Cloud using an OAuth client.

Parameters

  • options Object Options for this API call
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createUser

src/Particle.js:250-261

Create a user account for the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.username String Email of the new user
    • options.password String Password
    • options.accountInfo String Object that contains account information fields such as user real name, company name, business account flag etc
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

verifyUser

src/Particle.js:271-278

Verify new user account via verification email

Parameters

  • options Object Options for this API call
    • options.token String The string token sent in the verification email
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

resetPassword

src/Particle.js:288-295

Send reset password email for a Particle Cloud user account

Parameters

  • options Object Options for this API call
    • options.username String Email of the user
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteAccessToken

src/Particle.js:307-315

Revoke an access token

Parameters

  • options Object Options for this API call
    • options.username String Username of the Particle cloud account that the token belongs to.
    • options.password String Password for the account
    • options.token String Access token you wish to revoke
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteCurrentAccessToken

src/Particle.js:325-332

Revoke the current session access token

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteActiveAccessTokens

src/Particle.js:342-349

Revoke all active access tokens

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteUser

src/Particle.js:360-368

Delete the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.password String Password
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listAccessTokens

src/Particle.js:380-388

List all valid access tokens for a Particle Cloud account

Parameters

  • options Object Options for this API call
    • options.username String Username
    • options.password String Password
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

trackingIdentity

src/Particle.js:400-408

Retrieves the information that is used to identify the current login for tracking.

Parameters

  • options Object? Options for this API call (optional, default {})
    • options.full Boolean? When true, retrieve all information for registering a user with the tracking API. When false,
                                      retrieve only the unique tracking ID for the current login. (optional, default `false`)
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> Resolve the tracking identify of the current login

listDevices

src/Particle.js:426-445

List devices claimed to the account or product

Parameters

  • options Object Options for this API call
    • options.deviceId String? (Product only) Filter results to devices with this ID (partial matching)
    • options.deviceName String? (Product only) Filter results to devices with this name (partial matching)
    • options.groups Array<string>? (Product only) A list of full group names to filter results to devices belonging to these groups only.
    • options.sortAttr String? (Product only) The attribute by which to sort results. See API docs for options.
    • options.sortDir String? (Product only) The direction of sorting. See API docs for options.
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? List devices in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getDevice

src/Particle.js:457-460

Get detailed informationa about a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

claimDevice

src/Particle.js:472-483

Claim a device to the account. The device must be online and unclaimed.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.requestTransfer boolean True to request the device be transfered from another user
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

addDeviceToProduct

src/Particle.js:497-515

Add a device to a product or move device out of quarantine.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.product String Add to this product ID or slug
    • options.file Object A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
                                     Node: Either a path or Buffer. Browser: a File or Blob.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDevice

src/Particle.js:528-532

Unclaim / Remove a device from your account or product, or deny quarantine

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.deny Boolean? (Product only) Deny this quarantined device, instead of removing an already approved device
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDeviceOwner

src/Particle.js:544-547

Unclaim a product device its the owner, but keep it in the product

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

renameDevice

src/Particle.js:560-562

Rename a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Desired Name
    • options.product String? Rename device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

signalDevice

src/Particle.js:575-577

Instruct the device to turn on/off the LED in a rainbow pattern

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.signal Boolean Signal on or off
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setDeviceNotes

src/Particle.js:590-592

Store some notes about device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.notes String Your notes about this device
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

markAsDevelopmentDevice

src/Particle.js:605-607

Mark device as being used in development of a product so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.development Boolean Set to true to mark as development, false to return to product fleet (optional, default true)
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lockDeviceProductFirmware

src/Particle.js:621-623

Mark device as being used in development of a product, so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.desiredFirmwareVersion Number Lock the product device to run this firmware version.
    • options.flash Boolean? Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

unlockDeviceProductFirmware

src/Particle.js:635-637

Mark device as receiving automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateDevice

src/Particle.js:656-668

Update multiple device attributes at the same time

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String? Desired Name
    • options.signal Boolean? Signal device on or off
    • options.notes String? Your notes about this device
    • options.development Boolean? (Product only) Set to true to mark as development, false to return to product fleet
    • options.desiredFirmwareVersion (Number | null)? (Product only) Lock the product device to run this firmware version.
                                                           Pass `null` to unlock firmware and go back to released firmware.
      
    • options.flash Boolean? (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

provisionDevice

src/Particle.js:679-687

Provision a new device for products that allow self-provisioning

Parameters

  • options Object Options for this API call
    • options.productId String Product ID where to create this device
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getClaimCode

src/Particle.js:701-704

Generate a claim code to use in the device claiming process. To generate a claim code for a product, the access token MUST belong to a customer of the product.

Parameters

  • options Object Options for this API call
    • options.iccid String? ICCID of the SIM card used in the Electron
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getVariable

src/Particle.js:736-742

Get the value of a device variable

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Variable name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashDevice

src/Particle.js:756-767

Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Flash device in this product ID or slug
    • options.files Object Object containing files to be compiled and flashed. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashTinker

src/Particle.js:778-793

DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

compileCode

src/Particle.js:806-824

Compile firmware using the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.files Object Object containing files to be compiled. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.platformId Number? Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFirmwareBinary

src/Particle.js:835-844

Download a firmware binary

Parameters

  • options Object Options for this API call
    • options.binaryId String Binary ID received from a successful compile call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise

sendPublicKey

src/Particle.js:857-871

Send a new device public key to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.key (String | Buffer) Public key contents
    • options.algorithm String Algorithm used to generate the public key. Valid values are rsa or ecc. (optional, default rsa)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

callFunction

src/Particle.js:885-890

Call a device function

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Function name
    • options.argument String Function argument
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getEventStream

src/Particle.js:903-928

Get a stream of events

Parameters

  • options Object Options for this API call
    • options.deviceId String? Device ID or Name, or mine to indicate only your devices.
    • options.name String? Event Name
    • options.org String? Organization Slug
    • options.product String? Events for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor

Returns Promise If the promise resolves, the resolution value will be an EventStream object that will emit 'event' events.

publishEvent

src/Particle.js:942-946

Publish a event to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.name String Event name
    • options.data String Event data
    • options.isPrivate Boolean Should the event be publicly available?
    • options.product String? Event for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

Hook

src/Particle.js:977-999

Type: Object

Parameters

  • $0 Object
    • $0.event
    • $0.url
    • $0.device
    • $0.rejectUnauthorized
    • $0.noDefaults
    • $0.hook
    • $0.product
    • $0.auth
    • $0.headers
    • $0.context

Properties

  • method String? Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
  • auth Object? Auth data like { username: 'me', password: '1234' } to send via basic auth header with the Webhook request
  • headers Object? Additional headers to add to the Webhook like { 'X-ONE': '1', X-TWO: '2' }
  • query Object? Query params to add to the Webhook request like { foo: 'foo', bar: 'bar' }
  • json Object? JSON data to send with the Webhook request - sets Content-Type to application/json
  • form Object? Form data to send with the Webhook request - sets Content-Type to application/x-www-form-urlencoded
  • body String? Custom body to send with the Webhook request
  • responseTemplate Object? Template to use to customize the Webhook response body
  • responseEvent Object? The Webhook response event name that your devices can subscribe to
  • errorResponseEvent Object? The Webhook error response event name that your devices can subscribe to

createWebhook

src/Particle.js:977-999

Create a webhook

Parameters

  • options Object Options for this API call
    • options.event String The name of the Particle event that should trigger the Webhook
    • options.url String The web address that will be targeted when the Webhook is triggered
    • options.device String? Trigger Webhook only for this device ID or Name
    • options.rejectUnauthorized Boolean? Set to false to skip SSL certificate validation of the target URL
    • options.noDefaults Boolean? Don't include default event data in the webhook request
    • options.hook Hook? Webhook configuration settings
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteWebhook

src/Particle.js:1011-1014

Delete a webhook

Parameters

  • options Object Options for this API call
    • options.hookId String Webhook ID
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listWebhooks

src/Particle.js:1025-1028

List all webhooks owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Webhooks for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createIntegration

src/Particle.js:1045-1049

Create an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.event String Event that triggers the integration
    • options.settings Object Settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

editIntegration

src/Particle.js:1067-1071

Edit an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to edit
    • options.event String? Change the event that triggers the integration
    • options.settings Object? Change the settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteIntegration

src/Particle.js:1084-1087

Delete an integration to send events to an external service

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to remove
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listIntegrations

src/Particle.js:1098-1101

List all integrations owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Integrations for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getUserInfo

src/Particle.js:1111-1113

Get details about the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setUserInfo

src/Particle.js:1124-1127

Set details on the current user

Parameters

  • options Object Options for this API call
    • options.accountInfo String Set user's extended info fields (name, business account, company name, etc)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUsername

src/Particle.js:1140-1148

Change username (i.e, email)

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.username String New email
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUserPassword

src/Particle.js:1161-1169

Change user's password

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.password String New password
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listSIMs

src/Particle.js:1185-1189

List SIM cards owned by a user or product

Parameters

  • options Object Options for this API call
    • options.iccid String? (Product only) Filter to SIM cards matching this ICCID
    • options.deviceId String? (Product only) Filter to SIM cards matching this device ID
    • options.deviceName String? (Product only) Filter to SIM cards matching this device name
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getSIMDataUsage

src/Particle.js:1201-1207

Get data usage for one SIM card for the current billing period

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM card for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getFleetDataUsage

src/Particle.js:1218-1225

Get data usage for all SIM cards in a product the current billing period

Parameters

  • options Object Options for this API call
    • options.product String SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

checkSIM

src/Particle.js:1236-1238

Check SIM status

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

activateSIM

src/Particle.js:1253-1263

Activate and add SIM cards to an account or product

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.iccids Array<String> (Product only) ICCID of multiple SIM cards to import
    • options.country String The ISO country code for the SIM cards
    • options.promoCode any?
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deactivateSIM

src/Particle.js:1275-1279

Deactivate a SIM card so it doesn't incur data usage in future months.

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

reactivateSIM

src/Particle.js:1292-1296

Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Number? New monthly data limit. Necessary if unpausing a SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateSIM

src/Particle.js:1309-1313

Update SIM card data limit

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Array Data limit in megabyte for the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeSIM

src/Particle.js:1325-1328

Remove a SIM card from an account so it can be activated by a different account

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listBuildTargets

src/Particle.js:1339-1342

List valid build targets to be used for compiling

Parameters

  • options Object Options for this API call
    • options.onlyFeatured Boolean Only list featured build targets (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listLibraries

src/Particle.js:1368-1385

List firmware libraries

Parameters

  • options Object Options for this API call
    • options.page Number Page index (default, first page)
    • options.limit Number Number of items per page
    • options.filter String Search term for the libraries
    • options.sort String Ordering key for the library list
    • options.architectures Array<String> List of architectures to filter
    • options.category String Category to filter
    • options.scope String The library scope to list. Default is 'all'. Other values are
                                                 \- 'all' - list public libraries and my private libraries
                                                 \- 'public' - list only public libraries
                                                 \- 'private' - list only my private libraries
                                                 \- 'mine' - list my libraries (public and private)
                                                 \- 'official' - list only official libraries
                                                 \- 'verified' - list only verified libraries
                                                 \- 'featured' - list only featured libraries
      
    • options.excludeScopes String list of scopes to exclude
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getLibrary

src/Particle.js:1401-1409

Get firmware library details

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to fetch
    • options.version String Version of the library to fetch (default: latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getLibraryVersions

src/Particle.js:1422-1430

Firmware library details for each version

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to fetch
    • options.page Number Page index (default, first page)
    • options.limit Number Number of items per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

contributeLibrary

src/Particle.js:1442-1455

Contribute a new library version from a compressed archive

Parameters

  • options Object Options for this API call
    • options.archive (String | Buffer) Compressed archive file containing the library sources
                                              Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

publishLibrary

src/Particle.js:1466-1475

Publish the latest version of a library to the public

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to publish
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteLibrary

src/Particle.js:1487-1495

Delete one version of a library or an entire private library

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to remove
    • options.force String Key to force deleting a public library
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFile

src/Particle.js:1505-1507

Download an external file that may not be on the API

Parameters

  • options Object Options for this API call
    • options.uri String URL of the file.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise Resolves to a buffer with the file data

listOAuthClients

src/Particle.js:1518-1521

List OAuth client created by the account

Parameters

  • options Object Options for this API call
    • options.product String? List clients for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createOAuthClient

src/Particle.js:1536-1540

Create an OAuth client

Parameters

  • options Object Options for this API call
    • options.name String Name of the OAuth client
    • options.type String web, installed or web
    • options.redirect_uri String? URL to redirect after OAuth flow. Only for type web.
    • options.scope Object? Limits what the access tokens created by this client can do.
    • options.product String? Create client for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateOAuthClient

src/Particle.js:1554-1558

Update an OAuth client

Parameters

  • options Object Options for this API call
    • options.clientId String The OAuth client to update
    • options.name String? New Name of the OAuth client
    • options.scope Object? New scope of the OAuth client
    • options.product String? Update client linked to this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteOAuthClient

src/Particle.js:1570-1573

Delete an OAuth client

Parameters

  • options Object Options for this API call
    • options.clientId String The OAuth client to update
    • options.product String? OAuth client linked to this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listProducts

src/Particle.js:1583-1585

List products the account has access to

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProduct

src/Particle.js:1596-1598

Get detailed information about a product

Parameters

  • options Object Options for this API call
    • options.product String Product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listProductFirmware

src/Particle.js:1609-1611

List product firmware versions

Parameters

  • options Object Options for this API call
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

uploadProductFirmware

src/Particle.js:1627-1643

List product firmware versions

Parameters

  • options Object Options for this API call
    • options.file Object Path or Buffer of the new firmware file
                                         Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
      
    • options.version Number Version number of new firmware
    • options.title String Short identifier for the new firmware
    • options.description String? Longer description for the new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductFirmware

src/Particle.js:1655-1662

Get information about a product firmware version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateProductFirmware

src/Particle.js:1676-1679

Update information for a product firmware version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.title String? New title
    • options.description String? New description
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadProductFirmware

src/Particle.js:1691-1700

Download a product firmware binary

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

releaseProductFirmware

src/Particle.js:1712-1715

Release a product firmware version as the default version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listTeamMembers

src/Particle.js:1726-1733

List product team members

Parameters

  • options Object Options for this API call
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

inviteTeamMember

src/Particle.js:1745-1753

Invite Particle user to a product team

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeTeamMember

src/Particle.js:1765-1772

Remove Particle user to a product team

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lookupSerialNumber

src/Particle.js:1783-1790

Fetch details about a serial number

Parameters

  • options Object Options for this API call
    • options.serialNumber String The serial number printed on the barcode of the device packaging
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createMeshNetwork

src/Particle.js:1803-1811

Create a mesh network

Parameters

  • options Object Options for this API call
    • options.name String Network name
    • options.deviceId String Gateway device ID
    • options.iccid String? ICCID of the active SIM card (only for cellular gateway devices)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

removeMeshNetwork

src/Particle.js:1822-1824

Remove a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

listMeshNetworks

src/Particle.js:1836-1839

List all mesh networks

Parameters

  • options Object Options for this API call
    • options.page Number? Current page of results
    • options.perPage Number? Records per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

getMeshNetwork

src/Particle.js:1850-1852

Get information about a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

updateMeshNetwork

src/Particle.js:1865-1873

Modify a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.action String 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

addMeshNetworkDevice

src/Particle.js:1885-1894

Add a device to a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

removeMeshNetworkDevice

src/Particle.js:1906-1922

Remove a device from a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String? Network ID or name
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

listMeshNetworkDevices

src/Particle.js:1936-1945

List all devices of a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.role Number? Device role: 'gateway' or 'node'
    • options.page Number? Current page of results
    • options.perPage Number? Records per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

getProductConfiguration

src/Particle.js:1956-1963

Get product configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductConfigurationSchema

src/Particle.js:1974-1982

Get product configuration schema

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers. (optional, default {})
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceConfiguration

src/Particle.js:1994-2001

Get product device's configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceConfigurationSchema

src/Particle.js:2013-2021

Get product device's configuration schema

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setProductConfiguration

src/Particle.js:2033-2041

Set product configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.config Object Product configuration to update
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setProductDeviceConfiguration

src/Particle.js:2054-2062

Set product configuration for a specific device within the product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.config Object Product configuration to update
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductLocations

src/Particle.js:2081-2098

Query location for devices within a product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Locations for this product ID or slug
    • options.dateRange String Start and end date in ISO8601 format, separated by comma, to query
    • options.rectBl String Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.rectTr String Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.deviceId String Device ID prefix to include in the query
    • options.deviceName String Device name prefix to include in the query
    • options.groups String Array of group names to include in the query
    • options.page String Page of results to display. Defaults to 1
    • options.perPage String Number of results per page. Defaults to 20. Maximum of 100
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceLocations

src/Particle.js:2115-2127

Query location for one device within a product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Locations for this product ID or slug
    • options.dateRange String Start and end date in ISO8601 format, separated by comma, to query
    • options.rectBl String Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.rectTr String Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.deviceId String Device ID to query
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

executeLogic

src/Particle.js:2143-2151

Executes the provided logic function once and returns the result. No logs, runs, etc are saved

NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.

Parameters

  • options Object The options for creating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logic Object The logic "function" which will be executed once
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created logic function data.

createLogicFunction

src/Particle.js:2171-2179

Creates a new logic function in the specified organization or sandbox using the provided function data.

When you create a logic function with Event logic triggers, events will immediately start being handled by the function code.

When you create a Scheduled logic trigger, it will immediately be scheduled at the next time according to the cron and start_at properties.

Parameters

  • options Object The options for creating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunction Object The logic function object containing the function details.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created logic function data.

getLogicFunction

src/Particle.js:2193-2200

Get a logic function in the specified organization or sandbox by logic function ID.

Parameters

  • options Object The options for the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified logic function data.

updateLogicFunction

src/Particle.js:2217-2225

Updates an existing logic function in the specified organization or sandbox using the provided function data.

If you include an id on a logic trigger, it will update the logic trigger in place.

Parameters

  • options Object The options for updating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to update.
    • options.logicFunction Object The logic function object containing the logic function details.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated logic function data.

deleteLogicFunction

src/Particle.js:2239-2246

Deletes a logic function in the specified organization or sandbox by logic function ID.

Parameters

  • options Object The options for deleting the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to delete.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object containing the deleted logic function ID.

listLogicFunctions

src/Particle.js:2260-2270

Lists all logic functions in the specified organization or sandbox.

Parameters

  • options Object The options for listing logic functions.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.todayStats boolean? Whether to include today's stats in the response
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of logic functions data.

listLogicRuns

src/Particle.js:2284-2291

Lists all logic runs for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic runs.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of logic run data.

getLogicRun

src/Particle.js:2306-2313

Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic run.
    • options.logicRunId string The ID of the logic run to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of logic run data for the specified logic run ID.

getLogicRunLogs

src/Particle.js:2328-2335

Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The unique identifier of the organization.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic run logs.
    • options.logicRunId string The ID of the logic run for which to retrieve the logs.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the logs for the specified logic run ID.

createLedger

src/Particle.js:2349-2357

Creates a new ledger definition in the specified organization or sandbox.

Parameters

  • options Object The options for creating the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledger object The ledger definition object.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created ledger definition data.

getLedger

src/Particle.js:2371-2378

Get a ledger definition in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string The ID of the ledger definition to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger definition data.

updateLedger

src/Particle.js:2393-2401

Updates an existing ledger definition in the specified organization or sandbox.

Parameters

  • options Object The options for updating the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger definition to update.
    • options.ledger object The ledger definition object.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated ledger definition data.

archiveLedger

src/Particle.js:2415-2422

Archives a ledger definition in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for archiving the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger definition to archive.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object confirming the ledger definition was archived.

Scope

src/Particle.js:2443-2456

Type: ("Owner" | "Product" | "Device")

Parameters

  • $0 Object
    • $0.auth
    • $0.org
    • $0.scope
    • $0.page
    • $0.perPage
    • $0.archived
    • $0.headers
    • $0.context

listLedgers

src/Particle.js:2443-2456

Lists all ledger definitions in the specified organization or sandbox.

Parameters

  • options Object The options for listing ledger definitions.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.scope Scope? Filter to show only ledgers of the specified scope
    • options.page number? Page of results to display
    • options.perPage number? Number of results per page. Default is 100
    • options.archived boolean? Filter to show only archived ledger or non-archived ledgers. If not provided, all ledgers are returned.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of ledger definition data.

getLedgerInstance

src/Particle.js:2471-2478

Get ledger instance data.

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger instance data.

SetMode

src/Particle.js:2499-2510

Type: ("Replace" | "Merge")

Parameters

  • $0 Object
    • $0.auth
    • $0.org
    • $0.ledgerName
    • $0.scopeValue
    • $0.instance
    • $0.setMode
    • $0.headers
    • $0.context

setLedgerInstance

src/Particle.js:2499-2510

Set ledger instance data.

Parameters

  • options Object The options for updating the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.instance object The instance with the data
    • options.setMode SetMode? How the data should be set with existing data. Default is "Replace"
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated ledger instance data.

deleteLedgerInstance

src/Particle.js:2525-2532

Delete a ledger instance in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for archiving the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger instance to archive.
    • options.scopeValue string Scope value.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object confirming the ledger instance was deleted.

listLedgerInstances

src/Particle.js:2548-2559

Lists ledger instances in the specified organization or sandbox.

Parameters

  • options Object The options for listing ledger instances.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The unique identifier of the organization.
    • options.ledgerName string Name of the ledger instance to archive.
    • options.page number? Page of results to display
    • options.perPage number? Number of results per page. Default is 100
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of ledger instance data.

listLedgerInstanceVersions

src/Particle.js:2576-2587

List ledger instance versions

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.replacedBefore string? ISO date string to filter to instances replaced before this time
    • options.replacedAfter string? ISO date string to filter to instances replaced after this time
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of ledger instance data.

getLedgerInstanceVersion

src/Particle.js:2603-2610

Get specific ledger instance version

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.version string Version of the ledger instance
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger instance data.

setDefaultAuth

src/Particle.js:2617-2625

Set default auth token that will be used in each method if auth is not provided

Parameters

  • auth Auth The access token or basic auth object
  • Throws Error When not auth string is provided

get

src/Particle.js:2668-2672

Make a GET request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

src/Particle.js:2684-2688

Make a HEAD request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

post

src/Particle.js:2700-2704

Make a POST request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

put

src/Particle.js:2717-2721

Make a PUT request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

delete

src/Particle.js:2733-2737

Make a DELETE request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

request

src/Particle.js:2754-2758

Parameters

  • args Object An obj with all the possible request configurations
    • args.uri String The URI to request
    • args.method String The method used to request the URI, should be in uppercase.
    • args.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • args.data object? Arbitrary data to send as the body.
    • args.auth Auth? Authorization
    • args.query Object? Query parameters
    • args.form Object? Form fields
    • args.files Object? Array of file names and file content
    • args.context Object? The invocation context, describing the tool and project.
    • args.isBuffer boolean? Indicate if the response should be treated as Buffer instead of JSON

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

Particle

src/Particle.js:26-2770

Parameters

  • options (optional, default {})

constructor

src/Particle.js:39-48

Contructor for the Cloud API wrapper.

Create a new Particle object and call methods below on it.

Parameters

  • options Object Options for this API call Options to be used for all requests (see Defaults) (optional, default {})
    • options.baseUrl string?
    • options.clientSecret string?
    • options.clientId string?
    • options.tokenDuration number?
    • options.auth Auth? The access token or basic auth object. If not specified here, will have to be added to every request

login

src/Particle.js:85-102

Login to Particle Cloud using an existing Particle acccount.

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.password String Password for the Particle account
    • options.tokenDuration Number How long the access token should last in seconds (optional, default this.tokenDuration)
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

sendOtp

src/Particle.js:113-129

If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login

Parameters

  • options Object Options for this API call
    • options.mfaToken String Given as 'mfa_token' in the error body of .login().
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

enableMfa

src/Particle.js:139-141

Enable MFA on the currently logged in user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

confirmMfa

src/Particle.js:154-168

Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.

Parameters

  • options Object Options for this API call
    • options.mfaToken Object Token given from previous step to
    • options.otp Object Current one-time-password generated from the authentication app
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

disableMfa

src/Particle.js:179-187

Disable MFA for the user.

Parameters

  • options Object Options for this API call
    • options.currentPassword Object User's current password
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createCustomer

src/Particle.js:199-215

Create Customer for Product.

Parameters

  • options Object Options for this API call
    • options.email String Username for the Particle account
    • options.password String Password for the Particle account
    • options.product String Create the customer in this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

loginAsClientOwner

src/Particle.js:224-238

Login to Particle Cloud using an OAuth client.

Parameters

  • options Object Options for this API call
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createUser

src/Particle.js:250-261

Create a user account for the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.username String Email of the new user
    • options.password String Password
    • options.accountInfo String Object that contains account information fields such as user real name, company name, business account flag etc
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

verifyUser

src/Particle.js:271-278

Verify new user account via verification email

Parameters

  • options Object Options for this API call
    • options.token String The string token sent in the verification email
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

resetPassword

src/Particle.js:288-295

Send reset password email for a Particle Cloud user account

Parameters

  • options Object Options for this API call
    • options.username String Email of the user
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteAccessToken

src/Particle.js:307-315

Revoke an access token

Parameters

  • options Object Options for this API call
    • options.username String Username of the Particle cloud account that the token belongs to.
    • options.password String Password for the account
    • options.token String Access token you wish to revoke
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteCurrentAccessToken

src/Particle.js:325-332

Revoke the current session access token

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteActiveAccessTokens

src/Particle.js:342-349

Revoke all active access tokens

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteUser

src/Particle.js:360-368

Delete the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.password String Password
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listAccessTokens

src/Particle.js:380-388

List all valid access tokens for a Particle Cloud account

Parameters

  • options Object Options for this API call
    • options.username String Username
    • options.password String Password
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

trackingIdentity

src/Particle.js:400-408

Retrieves the information that is used to identify the current login for tracking.

Parameters

  • options Object? Options for this API call (optional, default {})
    • options.full Boolean? When true, retrieve all information for registering a user with the tracking API. When false,
                                      retrieve only the unique tracking ID for the current login. (optional, default `false`)
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> Resolve the tracking identify of the current login

listDevices

src/Particle.js:426-445

List devices claimed to the account or product

Parameters

  • options Object Options for this API call
    • options.deviceId String? (Product only) Filter results to devices with this ID (partial matching)
    • options.deviceName String? (Product only) Filter results to devices with this name (partial matching)
    • options.groups Array<string>? (Product only) A list of full group names to filter results to devices belonging to these groups only.
    • options.sortAttr String? (Product only) The attribute by which to sort results. See API docs for options.
    • options.sortDir String? (Product only) The direction of sorting. See API docs for options.
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? List devices in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getDevice

src/Particle.js:457-460

Get detailed informationa about a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

claimDevice

src/Particle.js:472-483

Claim a device to the account. The device must be online and unclaimed.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.requestTransfer boolean True to request the device be transfered from another user
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

addDeviceToProduct

src/Particle.js:497-515

Add a device to a product or move device out of quarantine.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.product String Add to this product ID or slug
    • options.file Object A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
                                     Node: Either a path or Buffer. Browser: a File or Blob.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDevice

src/Particle.js:528-532

Unclaim / Remove a device from your account or product, or deny quarantine

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.deny Boolean? (Product only) Deny this quarantined device, instead of removing an already approved device
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDeviceOwner

src/Particle.js:544-547

Unclaim a product device its the owner, but keep it in the product

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

renameDevice

src/Particle.js:560-562

Rename a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Desired Name
    • options.product String? Rename device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

signalDevice

src/Particle.js:575-577

Instruct the device to turn on/off the LED in a rainbow pattern

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.signal Boolean Signal on or off
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setDeviceNotes

src/Particle.js:590-592

Store some notes about device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.notes String Your notes about this device
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

markAsDevelopmentDevice

src/Particle.js:605-607

Mark device as being used in development of a product so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.development Boolean Set to true to mark as development, false to return to product fleet (optional, default true)
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lockDeviceProductFirmware

src/Particle.js:621-623

Mark device as being used in development of a product, so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.desiredFirmwareVersion Number Lock the product device to run this firmware version.
    • options.flash Boolean? Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

unlockDeviceProductFirmware

src/Particle.js:635-637

Mark device as receiving automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateDevice

src/Particle.js:656-668

Update multiple device attributes at the same time

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String? Desired Name
    • options.signal Boolean? Signal device on or off
    • options.notes String? Your notes about this device
    • options.development Boolean? (Product only) Set to true to mark as development, false to return to product fleet
    • options.desiredFirmwareVersion (Number | null)? (Product only) Lock the product device to run this firmware version.
                                                           Pass `null` to unlock firmware and go back to released firmware.
      
    • options.flash Boolean? (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

provisionDevice

src/Particle.js:679-687

Provision a new device for products that allow self-provisioning

Parameters

  • options Object Options for this API call
    • options.productId String Product ID where to create this device
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getClaimCode

src/Particle.js:701-704

Generate a claim code to use in the device claiming process. To generate a claim code for a product, the access token MUST belong to a customer of the product.

Parameters

  • options Object Options for this API call
    • options.iccid String? ICCID of the SIM card used in the Electron
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getVariable

src/Particle.js:736-742

Get the value of a device variable

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Variable name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashDevice

src/Particle.js:756-767

Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Flash device in this product ID or slug
    • options.files Object Object containing files to be compiled and flashed. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashTinker

src/Particle.js:778-793

DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

compileCode

src/Particle.js:806-824

Compile firmware using the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.files Object Object containing files to be compiled. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.platformId Number? Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFirmwareBinary

src/Particle.js:835-844

Download a firmware binary

Parameters

  • options Object Options for this API call
    • options.binaryId String Binary ID received from a successful compile call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise

sendPublicKey

src/Particle.js:857-871

Send a new device public key to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.key (String | Buffer) Public key contents
    • options.algorithm String Algorithm used to generate the public key. Valid values are rsa or ecc. (optional, default rsa)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

callFunction

src/Particle.js:885-890

Call a device function

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Function name
    • options.argument String Function argument
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getEventStream

src/Particle.js:903-928

Get a stream of events

Parameters

  • options Object Options for this API call
    • options.deviceId String? Device ID or Name, or mine to indicate only your devices.
    • options.name String? Event Name
    • options.org String? Organization Slug
    • options.product String? Events for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor

Returns Promise If the promise resolves, the resolution value will be an EventStream object that will emit 'event' events.

publishEvent

src/Particle.js:942-946

Publish a event to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.name String Event name
    • options.data String Event data
    • options.isPrivate Boolean Should the event be publicly available?
    • options.product String? Event for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

Hook

src/Particle.js:977-999

Type: Object

Parameters

  • $0 Object
    • $0.event
    • $0.url
    • $0.device
    • $0.rejectUnauthorized
    • $0.noDefaults
    • $0.hook
    • $0.product
    • $0.auth
    • $0.headers
    • $0.context

Properties

  • method String? Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
  • auth Object? Auth data like { username: 'me', password: '1234' } to send via basic auth header with the Webhook request
  • headers Object? Additional headers to add to the Webhook like { 'X-ONE': '1', X-TWO: '2' }
  • query Object? Query params to add to the Webhook request like { foo: 'foo', bar: 'bar' }
  • json Object? JSON data to send with the Webhook request - sets Content-Type to application/json
  • form Object? Form data to send with the Webhook request - sets Content-Type to application/x-www-form-urlencoded
  • body String? Custom body to send with the Webhook request
  • responseTemplate Object? Template to use to customize the Webhook response body
  • responseEvent Object? The Webhook response event name that your devices can subscribe to
  • errorResponseEvent Object? The Webhook error response event name that your devices can subscribe to

createWebhook

src/Particle.js:977-999

Create a webhook

Parameters

  • options Object Options for this API call
    • options.event String The name of the Particle event that should trigger the Webhook
    • options.url String The web address that will be targeted when the Webhook is triggered
    • options.device String? Trigger Webhook only for this device ID or Name
    • options.rejectUnauthorized Boolean? Set to false to skip SSL certificate validation of the target URL
    • options.noDefaults Boolean? Don't include default event data in the webhook request
    • options.hook Hook? Webhook configuration settings
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteWebhook

src/Particle.js:1011-1014

Delete a webhook

Parameters

  • options Object Options for this API call
    • options.hookId String Webhook ID
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listWebhooks

src/Particle.js:1025-1028

List all webhooks owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Webhooks for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createIntegration

src/Particle.js:1045-1049

Create an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.event String Event that triggers the integration
    • options.settings Object Settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

editIntegration

src/Particle.js:1067-1071

Edit an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to edit
    • options.event String? Change the event that triggers the integration
    • options.settings Object? Change the settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteIntegration

src/Particle.js:1084-1087

Delete an integration to send events to an external service

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to remove
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listIntegrations

src/Particle.js:1098-1101

List all integrations owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Integrations for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getUserInfo

src/Particle.js:1111-1113

Get details about the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setUserInfo

src/Particle.js:1124-1127

Set details on the current user

Parameters

  • options Object Options for this API call
    • options.accountInfo String Set user's extended info fields (name, business account, company name, etc)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUsername

src/Particle.js:1140-1148

Change username (i.e, email)

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.username String New email
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUserPassword

src/Particle.js:1161-1169

Change user's password

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.password String New password
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listSIMs

src/Particle.js:1185-1189

List SIM cards owned by a user or product

Parameters

  • options Object Options for this API call
    • options.iccid String? (Product only) Filter to SIM cards matching this ICCID
    • options.deviceId String? (Product only) Filter to SIM cards matching this device ID
    • options.deviceName String? (Product only) Filter to SIM cards matching this device name
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getSIMDataUsage

src/Particle.js:1201-1207

Get data usage for one SIM card for the current billing period

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM card for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getFleetDataUsage

src/Particle.js:1218-1225

Get data usage for all SIM cards in a product the current billing period

Parameters

  • options Object Options for this API call
    • options.product String SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

checkSIM

src/Particle.js:1236-1238

Check SIM status

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

activateSIM

src/Particle.js:1253-1263

Activate and add SIM cards to an account or product

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.iccids Array<String> (Product only) ICCID of multiple SIM cards to import
    • options.country String The ISO country code for the SIM cards
    • options.promoCode any?
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deactivateSIM

src/Particle.js:1275-1279

Deactivate a SIM card so it doesn't incur data usage in future months.

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

reactivateSIM

src/Particle.js:1292-1296

Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Number? New monthly data limit. Necessary if unpausing a SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateSIM

src/Particle.js:1309-1313

Update SIM card data limit

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Array Data limit in megabyte for the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeSIM

src/Particle.js:1325-1328

Remove a SIM card from an account so it can be activated by a different account

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listBuildTargets

src/Particle.js:1339-1342

List valid build targets to be used for compiling

Parameters

  • options Object Options for this API call
    • options.onlyFeatured Boolean Only list featured build targets (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listLibraries

src/Particle.js:1368-1385

List firmware libraries

Parameters

  • options Object Options for this API call
    • options.page Number Page index (default, first page)
    • options.limit Number Number of items per page
    • options.filter String Search term for the libraries
    • options.sort String Ordering key for the library list
    • options.architectures Array<String> List of architectures to filter
    • options.category String Category to filter
    • options.scope String The library scope to list. Default is 'all'. Other values are
                                                 \- 'all' - list public libraries and my private libraries
                                                 \- 'public' - list only public libraries
                                                 \- 'private' - list only my private libraries
                                                 \- 'mine' - list my libraries (public and private)
                                                 \- 'official' - list only official libraries
                                                 \- 'verified' - list only verified libraries
                                                 \- 'featured' - list only featured libraries
      
    • options.excludeScopes String list of scopes to exclude
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getLibrary

src/Particle.js:1401-1409

Get firmware library details

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to fetch
    • options.version String Version of the library to fetch (default: latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getLibraryVersions

src/Particle.js:1422-1430

Firmware library details for each version

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to fetch
    • options.page Number Page index (default, first page)
    • options.limit Number Number of items per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

contributeLibrary

src/Particle.js:1442-1455

Contribute a new library version from a compressed archive

Parameters

  • options Object Options for this API call
    • options.archive (String | Buffer) Compressed archive file containing the library sources
                                              Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

publishLibrary

src/Particle.js:1466-1475

Publish the latest version of a library to the public

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to publish
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteLibrary

src/Particle.js:1487-1495

Delete one version of a library or an entire private library

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to remove
    • options.force String Key to force deleting a public library
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFile

src/Particle.js:1505-1507

Download an external file that may not be on the API

Parameters

  • options Object Options for this API call
    • options.uri String URL of the file.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise Resolves to a buffer with the file data

listOAuthClients

src/Particle.js:1518-1521

List OAuth client created by the account

Parameters

  • options Object Options for this API call
    • options.product String? List clients for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createOAuthClient

src/Particle.js:1536-1540

Create an OAuth client

Parameters

  • options Object Options for this API call
    • options.name String Name of the OAuth client
    • options.type String web, installed or web
    • options.redirect_uri String? URL to redirect after OAuth flow. Only for type web.
    • options.scope Object? Limits what the access tokens created by this client can do.
    • options.product String? Create client for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateOAuthClient

src/Particle.js:1554-1558

Update an OAuth client

Parameters

  • options Object Options for this API call
    • options.clientId String The OAuth client to update
    • options.name String? New Name of the OAuth client
    • options.scope Object? New scope of the OAuth client
    • options.product String? Update client linked to this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteOAuthClient

src/Particle.js:1570-1573

Delete an OAuth client

Parameters

  • options Object Options for this API call
    • options.clientId String The OAuth client to update
    • options.product String? OAuth client linked to this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listProducts

src/Particle.js:1583-1585

List products the account has access to

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProduct

src/Particle.js:1596-1598

Get detailed information about a product

Parameters

  • options Object Options for this API call
    • options.product String Product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listProductFirmware

src/Particle.js:1609-1611

List product firmware versions

Parameters

  • options Object Options for this API call
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

uploadProductFirmware

src/Particle.js:1627-1643

List product firmware versions

Parameters

  • options Object Options for this API call
    • options.file Object Path or Buffer of the new firmware file
                                         Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
      
    • options.version Number Version number of new firmware
    • options.title String Short identifier for the new firmware
    • options.description String? Longer description for the new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductFirmware

src/Particle.js:1655-1662

Get information about a product firmware version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateProductFirmware

src/Particle.js:1676-1679

Update information for a product firmware version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.title String? New title
    • options.description String? New description
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadProductFirmware

src/Particle.js:1691-1700

Download a product firmware binary

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

releaseProductFirmware

src/Particle.js:1712-1715

Release a product firmware version as the default version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listTeamMembers

src/Particle.js:1726-1733

List product team members

Parameters

  • options Object Options for this API call
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

inviteTeamMember

src/Particle.js:1745-1753

Invite Particle user to a product team

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeTeamMember

src/Particle.js:1765-1772

Remove Particle user to a product team

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lookupSerialNumber

src/Particle.js:1783-1790

Fetch details about a serial number

Parameters

  • options Object Options for this API call
    • options.serialNumber String The serial number printed on the barcode of the device packaging
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createMeshNetwork

src/Particle.js:1803-1811

Create a mesh network

Parameters

  • options Object Options for this API call
    • options.name String Network name
    • options.deviceId String Gateway device ID
    • options.iccid String? ICCID of the active SIM card (only for cellular gateway devices)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

removeMeshNetwork

src/Particle.js:1822-1824

Remove a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

listMeshNetworks

src/Particle.js:1836-1839

List all mesh networks

Parameters

  • options Object Options for this API call
    • options.page Number? Current page of results
    • options.perPage Number? Records per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

getMeshNetwork

src/Particle.js:1850-1852

Get information about a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

updateMeshNetwork

src/Particle.js:1865-1873

Modify a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.action String 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

addMeshNetworkDevice

src/Particle.js:1885-1894

Add a device to a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

removeMeshNetworkDevice

src/Particle.js:1906-1922

Remove a device from a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String? Network ID or name
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

listMeshNetworkDevices

src/Particle.js:1936-1945

List all devices of a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.role Number? Device role: 'gateway' or 'node'
    • options.page Number? Current page of results
    • options.perPage Number? Records per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

getProductConfiguration

src/Particle.js:1956-1963

Get product configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductConfigurationSchema

src/Particle.js:1974-1982

Get product configuration schema

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers. (optional, default {})
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceConfiguration

src/Particle.js:1994-2001

Get product device's configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceConfigurationSchema

src/Particle.js:2013-2021

Get product device's configuration schema

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setProductConfiguration

src/Particle.js:2033-2041

Set product configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.config Object Product configuration to update
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setProductDeviceConfiguration

src/Particle.js:2054-2062

Set product configuration for a specific device within the product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.config Object Product configuration to update
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductLocations

src/Particle.js:2081-2098

Query location for devices within a product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Locations for this product ID or slug
    • options.dateRange String Start and end date in ISO8601 format, separated by comma, to query
    • options.rectBl String Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.rectTr String Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.deviceId String Device ID prefix to include in the query
    • options.deviceName String Device name prefix to include in the query
    • options.groups String Array of group names to include in the query
    • options.page String Page of results to display. Defaults to 1
    • options.perPage String Number of results per page. Defaults to 20. Maximum of 100
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceLocations

src/Particle.js:2115-2127

Query location for one device within a product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Locations for this product ID or slug
    • options.dateRange String Start and end date in ISO8601 format, separated by comma, to query
    • options.rectBl String Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.rectTr String Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.deviceId String Device ID to query
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

executeLogic

src/Particle.js:2143-2151

Executes the provided logic function once and returns the result. No logs, runs, etc are saved

NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.

Parameters

  • options Object The options for creating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logic Object The logic "function" which will be executed once
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created logic function data.

createLogicFunction

src/Particle.js:2171-2179

Creates a new logic function in the specified organization or sandbox using the provided function data.

When you create a logic function with Event logic triggers, events will immediately start being handled by the function code.

When you create a Scheduled logic trigger, it will immediately be scheduled at the next time according to the cron and start_at properties.

Parameters

  • options Object The options for creating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunction Object The logic function object containing the function details.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created logic function data.

getLogicFunction

src/Particle.js:2193-2200

Get a logic function in the specified organization or sandbox by logic function ID.

Parameters

  • options Object The options for the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified logic function data.

updateLogicFunction

src/Particle.js:2217-2225

Updates an existing logic function in the specified organization or sandbox using the provided function data.

If you include an id on a logic trigger, it will update the logic trigger in place.

Parameters

  • options Object The options for updating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to update.
    • options.logicFunction Object The logic function object containing the logic function details.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated logic function data.

deleteLogicFunction

src/Particle.js:2239-2246

Deletes a logic function in the specified organization or sandbox by logic function ID.

Parameters

  • options Object The options for deleting the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to delete.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object containing the deleted logic function ID.

listLogicFunctions

src/Particle.js:2260-2270

Lists all logic functions in the specified organization or sandbox.

Parameters

  • options Object The options for listing logic functions.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.todayStats boolean? Whether to include today's stats in the response
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of logic functions data.

listLogicRuns

src/Particle.js:2284-2291

Lists all logic runs for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic runs.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of logic run data.

getLogicRun

src/Particle.js:2306-2313

Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic run.
    • options.logicRunId string The ID of the logic run to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of logic run data for the specified logic run ID.

getLogicRunLogs

src/Particle.js:2328-2335

Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The unique identifier of the organization.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic run logs.
    • options.logicRunId string The ID of the logic run for which to retrieve the logs.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the logs for the specified logic run ID.

createLedger

src/Particle.js:2349-2357

Creates a new ledger definition in the specified organization or sandbox.

Parameters

  • options Object The options for creating the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledger object The ledger definition object.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created ledger definition data.

getLedger

src/Particle.js:2371-2378

Get a ledger definition in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string The ID of the ledger definition to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger definition data.

updateLedger

src/Particle.js:2393-2401

Updates an existing ledger definition in the specified organization or sandbox.

Parameters

  • options Object The options for updating the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger definition to update.
    • options.ledger object The ledger definition object.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated ledger definition data.

archiveLedger

src/Particle.js:2415-2422

Archives a ledger definition in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for archiving the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger definition to archive.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object confirming the ledger definition was archived.

Scope

src/Particle.js:2443-2456

Type: ("Owner" | "Product" | "Device")

Parameters

  • $0 Object
    • $0.auth
    • $0.org
    • $0.scope
    • $0.page
    • $0.perPage
    • $0.archived
    • $0.headers
    • $0.context

listLedgers

src/Particle.js:2443-2456

Lists all ledger definitions in the specified organization or sandbox.

Parameters

  • options Object The options for listing ledger definitions.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.scope Scope? Filter to show only ledgers of the specified scope
    • options.page number? Page of results to display
    • options.perPage number? Number of results per page. Default is 100
    • options.archived boolean? Filter to show only archived ledger or non-archived ledgers. If not provided, all ledgers are returned.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of ledger definition data.

getLedgerInstance

src/Particle.js:2471-2478

Get ledger instance data.

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger instance data.

SetMode

src/Particle.js:2499-2510

Type: ("Replace" | "Merge")

Parameters

  • $0 Object
    • $0.auth
    • $0.org
    • $0.ledgerName
    • $0.scopeValue
    • $0.instance
    • $0.setMode
    • $0.headers
    • $0.context

setLedgerInstance

src/Particle.js:2499-2510

Set ledger instance data.

Parameters

  • options Object The options for updating the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.instance object The instance with the data
    • options.setMode SetMode? How the data should be set with existing data. Default is "Replace"
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated ledger instance data.

deleteLedgerInstance

src/Particle.js:2525-2532

Delete a ledger instance in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for archiving the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger instance to archive.
    • options.scopeValue string Scope value.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object confirming the ledger instance was deleted.

listLedgerInstances

src/Particle.js:2548-2559

Lists ledger instances in the specified organization or sandbox.

Parameters

  • options Object The options for listing ledger instances.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The unique identifier of the organization.
    • options.ledgerName string Name of the ledger instance to archive.
    • options.page number? Page of results to display
    • options.perPage number? Number of results per page. Default is 100
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of ledger instance data.

listLedgerInstanceVersions

src/Particle.js:2576-2587

List ledger instance versions

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.replacedBefore string? ISO date string to filter to instances replaced before this time
    • options.replacedAfter string? ISO date string to filter to instances replaced after this time
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of ledger instance data.

getLedgerInstanceVersion

src/Particle.js:2603-2610

Get specific ledger instance version

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.version string Version of the ledger instance
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger instance data.

setDefaultAuth

src/Particle.js:2617-2625

Set default auth token that will be used in each method if auth is not provided

Parameters

  • auth Auth The access token or basic auth object
  • Throws Error When not auth string is provided

get

src/Particle.js:2668-2672

Make a GET request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

head

src/Particle.js:2684-2688

Make a HEAD request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

post

src/Particle.js:2700-2704

Make a POST request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

put

src/Particle.js:2717-2721

Make a PUT request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

delete

src/Particle.js:2733-2737

Make a DELETE request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

request

src/Particle.js:2754-2758

Parameters

  • args Object An obj with all the possible request configurations
    • args.uri String The URI to request
    • args.method String The method used to request the URI, should be in uppercase.
    • args.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • args.data object? Arbitrary data to send as the body.
    • args.auth Auth? Authorization
    • args.query Object? Query parameters
    • args.form Object? Form fields
    • args.files Object? Array of file names and file content
    • args.context Object? The invocation context, describing the tool and project.
    • args.isBuffer boolean? Indicate if the response should be treated as Buffer instead of JSON

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

Particle

src/Particle.js:26-2770

Parameters

  • options (optional, default {})

constructor

src/Particle.js:39-48

Contructor for the Cloud API wrapper.

Create a new Particle object and call methods below on it.

Parameters

  • options Object Options for this API call Options to be used for all requests (see Defaults) (optional, default {})
    • options.baseUrl string?
    • options.clientSecret string?
    • options.clientId string?
    • options.tokenDuration number?
    • options.auth Auth? The access token or basic auth object. If not specified here, will have to be added to every request

login

src/Particle.js:85-102

Login to Particle Cloud using an existing Particle acccount.

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.password String Password for the Particle account
    • options.tokenDuration Number How long the access token should last in seconds (optional, default this.tokenDuration)
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

sendOtp

src/Particle.js:113-129

If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login

Parameters

  • options Object Options for this API call
    • options.mfaToken String Given as 'mfa_token' in the error body of .login().
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

enableMfa

src/Particle.js:139-141

Enable MFA on the currently logged in user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

confirmMfa

src/Particle.js:154-168

Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.

Parameters

  • options Object Options for this API call
    • options.mfaToken Object Token given from previous step to
    • options.otp Object Current one-time-password generated from the authentication app
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

disableMfa

src/Particle.js:179-187

Disable MFA for the user.

Parameters

  • options Object Options for this API call
    • options.currentPassword Object User's current password
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createCustomer

src/Particle.js:199-215

Create Customer for Product.

Parameters

  • options Object Options for this API call
    • options.email String Username for the Particle account
    • options.password String Password for the Particle account
    • options.product String Create the customer in this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

loginAsClientOwner

src/Particle.js:224-238

Login to Particle Cloud using an OAuth client.

Parameters

  • options Object Options for this API call
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createUser

src/Particle.js:250-261

Create a user account for the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.username String Email of the new user
    • options.password String Password
    • options.accountInfo String Object that contains account information fields such as user real name, company name, business account flag etc
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

verifyUser

src/Particle.js:271-278

Verify new user account via verification email

Parameters

  • options Object Options for this API call
    • options.token String The string token sent in the verification email
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

resetPassword

src/Particle.js:288-295

Send reset password email for a Particle Cloud user account

Parameters

  • options Object Options for this API call
    • options.username String Email of the user
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteAccessToken

src/Particle.js:307-315

Revoke an access token

Parameters

  • options Object Options for this API call
    • options.username String Username of the Particle cloud account that the token belongs to.
    • options.password String Password for the account
    • options.token String Access token you wish to revoke
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteCurrentAccessToken

src/Particle.js:325-332

Revoke the current session access token

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteActiveAccessTokens

src/Particle.js:342-349

Revoke all active access tokens

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteUser

src/Particle.js:360-368

Delete the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.password String Password
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listAccessTokens

src/Particle.js:380-388

List all valid access tokens for a Particle Cloud account

Parameters

  • options Object Options for this API call
    • options.username String Username
    • options.password String Password
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

trackingIdentity

src/Particle.js:400-408

Retrieves the information that is used to identify the current login for tracking.

Parameters

  • options Object? Options for this API call (optional, default {})
    • options.full Boolean? When true, retrieve all information for registering a user with the tracking API. When false,
                                      retrieve only the unique tracking ID for the current login. (optional, default `false`)
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> Resolve the tracking identify of the current login

listDevices

src/Particle.js:426-445

List devices claimed to the account or product

Parameters

  • options Object Options for this API call
    • options.deviceId String? (Product only) Filter results to devices with this ID (partial matching)
    • options.deviceName String? (Product only) Filter results to devices with this name (partial matching)
    • options.groups Array<string>? (Product only) A list of full group names to filter results to devices belonging to these groups only.
    • options.sortAttr String? (Product only) The attribute by which to sort results. See API docs for options.
    • options.sortDir String? (Product only) The direction of sorting. See API docs for options.
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? List devices in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getDevice

src/Particle.js:457-460

Get detailed informationa about a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

claimDevice

src/Particle.js:472-483

Claim a device to the account. The device must be online and unclaimed.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.requestTransfer boolean True to request the device be transfered from another user
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

addDeviceToProduct

src/Particle.js:497-515

Add a device to a product or move device out of quarantine.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.product String Add to this product ID or slug
    • options.file Object A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
                                     Node: Either a path or Buffer. Browser: a File or Blob.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDevice

src/Particle.js:528-532

Unclaim / Remove a device from your account or product, or deny quarantine

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.deny Boolean? (Product only) Deny this quarantined device, instead of removing an already approved device
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDeviceOwner

src/Particle.js:544-547

Unclaim a product device its the owner, but keep it in the product

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

renameDevice

src/Particle.js:560-562

Rename a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Desired Name
    • options.product String? Rename device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

signalDevice

src/Particle.js:575-577

Instruct the device to turn on/off the LED in a rainbow pattern

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.signal Boolean Signal on or off
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setDeviceNotes

src/Particle.js:590-592

Store some notes about device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.notes String Your notes about this device
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

markAsDevelopmentDevice

src/Particle.js:605-607

Mark device as being used in development of a product so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.development Boolean Set to true to mark as development, false to return to product fleet (optional, default true)
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lockDeviceProductFirmware

src/Particle.js:621-623

Mark device as being used in development of a product, so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.desiredFirmwareVersion Number Lock the product device to run this firmware version.
    • options.flash Boolean? Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

unlockDeviceProductFirmware

src/Particle.js:635-637

Mark device as receiving automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateDevice

src/Particle.js:656-668

Update multiple device attributes at the same time

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String? Desired Name
    • options.signal Boolean? Signal device on or off
    • options.notes String? Your notes about this device
    • options.development Boolean? (Product only) Set to true to mark as development, false to return to product fleet
    • options.desiredFirmwareVersion (Number | null)? (Product only) Lock the product device to run this firmware version.
                                                           Pass `null` to unlock firmware and go back to released firmware.
      
    • options.flash Boolean? (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

provisionDevice

src/Particle.js:679-687

Provision a new device for products that allow self-provisioning

Parameters

  • options Object Options for this API call
    • options.productId String Product ID where to create this device
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getClaimCode

src/Particle.js:701-704

Generate a claim code to use in the device claiming process. To generate a claim code for a product, the access token MUST belong to a customer of the product.

Parameters

  • options Object Options for this API call
    • options.iccid String? ICCID of the SIM card used in the Electron
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getVariable

src/Particle.js:736-742

Get the value of a device variable

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Variable name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashDevice

src/Particle.js:756-767

Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Flash device in this product ID or slug
    • options.files Object Object containing files to be compiled and flashed. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashTinker

src/Particle.js:778-793

DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

compileCode

src/Particle.js:806-824

Compile firmware using the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.files Object Object containing files to be compiled. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.platformId Number? Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFirmwareBinary

src/Particle.js:835-844

Download a firmware binary

Parameters

  • options Object Options for this API call
    • options.binaryId String Binary ID received from a successful compile call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise

sendPublicKey

src/Particle.js:857-871

Send a new device public key to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.key (String | Buffer) Public key contents
    • options.algorithm String Algorithm used to generate the public key. Valid values are rsa or ecc. (optional, default rsa)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

callFunction

src/Particle.js:885-890

Call a device function

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Function name
    • options.argument String Function argument
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getEventStream

src/Particle.js:903-928

Get a stream of events

Parameters

  • options Object Options for this API call
    • options.deviceId String? Device ID or Name, or mine to indicate only your devices.
    • options.name String? Event Name
    • options.org String? Organization Slug
    • options.product String? Events for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor

Returns Promise If the promise resolves, the resolution value will be an EventStream object that will emit 'event' events.

publishEvent

src/Particle.js:942-946

Publish a event to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.name String Event name
    • options.data String Event data
    • options.isPrivate Boolean Should the event be publicly available?
    • options.product String? Event for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

Hook

src/Particle.js:977-999

Type: Object

Parameters

  • $0 Object
    • $0.event
    • $0.url
    • $0.device
    • $0.rejectUnauthorized
    • $0.noDefaults
    • $0.hook
    • $0.product
    • $0.auth
    • $0.headers
    • $0.context

Properties

  • method String? Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
  • auth Object? Auth data like { username: 'me', password: '1234' } to send via basic auth header with the Webhook request
  • headers Object? Additional headers to add to the Webhook like { 'X-ONE': '1', X-TWO: '2' }
  • query Object? Query params to add to the Webhook request like { foo: 'foo', bar: 'bar' }
  • json Object? JSON data to send with the Webhook request - sets Content-Type to application/json
  • form Object? Form data to send with the Webhook request - sets Content-Type to application/x-www-form-urlencoded
  • body String? Custom body to send with the Webhook request
  • responseTemplate Object? Template to use to customize the Webhook response body
  • responseEvent Object? The Webhook response event name that your devices can subscribe to
  • errorResponseEvent Object? The Webhook error response event name that your devices can subscribe to

createWebhook

src/Particle.js:977-999

Create a webhook

Parameters

  • options Object Options for this API call
    • options.event String The name of the Particle event that should trigger the Webhook
    • options.url String The web address that will be targeted when the Webhook is triggered
    • options.device String? Trigger Webhook only for this device ID or Name
    • options.rejectUnauthorized Boolean? Set to false to skip SSL certificate validation of the target URL
    • options.noDefaults Boolean? Don't include default event data in the webhook request
    • options.hook Hook? Webhook configuration settings
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteWebhook

src/Particle.js:1011-1014

Delete a webhook

Parameters

  • options Object Options for this API call
    • options.hookId String Webhook ID
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listWebhooks

src/Particle.js:1025-1028

List all webhooks owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Webhooks for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createIntegration

src/Particle.js:1045-1049

Create an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.event String Event that triggers the integration
    • options.settings Object Settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

editIntegration

src/Particle.js:1067-1071

Edit an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to edit
    • options.event String? Change the event that triggers the integration
    • options.settings Object? Change the settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteIntegration

src/Particle.js:1084-1087

Delete an integration to send events to an external service

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to remove
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listIntegrations

src/Particle.js:1098-1101

List all integrations owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Integrations for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getUserInfo

src/Particle.js:1111-1113

Get details about the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setUserInfo

src/Particle.js:1124-1127

Set details on the current user

Parameters

  • options Object Options for this API call
    • options.accountInfo String Set user's extended info fields (name, business account, company name, etc)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUsername

src/Particle.js:1140-1148

Change username (i.e, email)

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.username String New email
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUserPassword

src/Particle.js:1161-1169

Change user's password

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.password String New password
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listSIMs

src/Particle.js:1185-1189

List SIM cards owned by a user or product

Parameters

  • options Object Options for this API call
    • options.iccid String? (Product only) Filter to SIM cards matching this ICCID
    • options.deviceId String? (Product only) Filter to SIM cards matching this device ID
    • options.deviceName String? (Product only) Filter to SIM cards matching this device name
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getSIMDataUsage

src/Particle.js:1201-1207

Get data usage for one SIM card for the current billing period

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM card for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getFleetDataUsage

src/Particle.js:1218-1225

Get data usage for all SIM cards in a product the current billing period

Parameters

  • options Object Options for this API call
    • options.product String SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

checkSIM

src/Particle.js:1236-1238

Check SIM status

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

activateSIM

src/Particle.js:1253-1263

Activate and add SIM cards to an account or product

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.iccids Array<String> (Product only) ICCID of multiple SIM cards to import
    • options.country String The ISO country code for the SIM cards
    • options.promoCode any?
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deactivateSIM

src/Particle.js:1275-1279

Deactivate a SIM card so it doesn't incur data usage in future months.

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

reactivateSIM

src/Particle.js:1292-1296

Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Number? New monthly data limit. Necessary if unpausing a SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateSIM

src/Particle.js:1309-1313

Update SIM card data limit

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Array Data limit in megabyte for the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeSIM

src/Particle.js:1325-1328

Remove a SIM card from an account so it can be activated by a different account

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listBuildTargets

src/Particle.js:1339-1342

List valid build targets to be used for compiling

Parameters

  • options Object Options for this API call
    • options.onlyFeatured Boolean Only list featured build targets (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listLibraries

src/Particle.js:1368-1385

List firmware libraries

Parameters

  • options Object Options for this API call
    • options.page Number Page index (default, first page)
    • options.limit Number Number of items per page
    • options.filter String Search term for the libraries
    • options.sort String Ordering key for the library list
    • options.architectures Array<String> List of architectures to filter
    • options.category String Category to filter
    • options.scope String The library scope to list. Default is 'all'. Other values are
                                                 \- 'all' - list public libraries and my private libraries
                                                 \- 'public' - list only public libraries
                                                 \- 'private' - list only my private libraries
                                                 \- 'mine' - list my libraries (public and private)
                                                 \- 'official' - list only official libraries
                                                 \- 'verified' - list only verified libraries
                                                 \- 'featured' - list only featured libraries
      
    • options.excludeScopes String list of scopes to exclude
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getLibrary

src/Particle.js:1401-1409

Get firmware library details

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to fetch
    • options.version String Version of the library to fetch (default: latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getLibraryVersions

src/Particle.js:1422-1430

Firmware library details for each version

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to fetch
    • options.page Number Page index (default, first page)
    • options.limit Number Number of items per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

contributeLibrary

src/Particle.js:1442-1455

Contribute a new library version from a compressed archive

Parameters

  • options Object Options for this API call
    • options.archive (String | Buffer) Compressed archive file containing the library sources
                                              Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

publishLibrary

src/Particle.js:1466-1475

Publish the latest version of a library to the public

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to publish
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteLibrary

src/Particle.js:1487-1495

Delete one version of a library or an entire private library

Parameters

  • options Object Options for this API call
    • options.name String Name of the library to remove
    • options.force String Key to force deleting a public library
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFile

src/Particle.js:1505-1507

Download an external file that may not be on the API

Parameters

  • options Object Options for this API call
    • options.uri String URL of the file.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise Resolves to a buffer with the file data

listOAuthClients

src/Particle.js:1518-1521

List OAuth client created by the account

Parameters

  • options Object Options for this API call
    • options.product String? List clients for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createOAuthClient

src/Particle.js:1536-1540

Create an OAuth client

Parameters

  • options Object Options for this API call
    • options.name String Name of the OAuth client
    • options.type String web, installed or web
    • options.redirect_uri String? URL to redirect after OAuth flow. Only for type web.
    • options.scope Object? Limits what the access tokens created by this client can do.
    • options.product String? Create client for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateOAuthClient

src/Particle.js:1554-1558

Update an OAuth client

Parameters

  • options Object Options for this API call
    • options.clientId String The OAuth client to update
    • options.name String? New Name of the OAuth client
    • options.scope Object? New scope of the OAuth client
    • options.product String? Update client linked to this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteOAuthClient

src/Particle.js:1570-1573

Delete an OAuth client

Parameters

  • options Object Options for this API call
    • options.clientId String The OAuth client to update
    • options.product String? OAuth client linked to this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listProducts

src/Particle.js:1583-1585

List products the account has access to

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProduct

src/Particle.js:1596-1598

Get detailed information about a product

Parameters

  • options Object Options for this API call
    • options.product String Product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listProductFirmware

src/Particle.js:1609-1611

List product firmware versions

Parameters

  • options Object Options for this API call
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

uploadProductFirmware

src/Particle.js:1627-1643

List product firmware versions

Parameters

  • options Object Options for this API call
    • options.file Object Path or Buffer of the new firmware file
                                         Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
      
    • options.version Number Version number of new firmware
    • options.title String Short identifier for the new firmware
    • options.description String? Longer description for the new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductFirmware

src/Particle.js:1655-1662

Get information about a product firmware version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateProductFirmware

src/Particle.js:1676-1679

Update information for a product firmware version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.title String? New title
    • options.description String? New description
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadProductFirmware

src/Particle.js:1691-1700

Download a product firmware binary

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

releaseProductFirmware

src/Particle.js:1712-1715

Release a product firmware version as the default version

Parameters

  • options Object Options for this API call
    • options.version Number Version number of new firmware
    • options.product String Firmware for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listTeamMembers

src/Particle.js:1726-1733

List product team members

Parameters

  • options Object Options for this API call
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

inviteTeamMember

src/Particle.js:1745-1753

Invite Particle user to a product team

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeTeamMember

src/Particle.js:1765-1772

Remove Particle user to a product team

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.product String Team for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lookupSerialNumber

src/Particle.js:1783-1790

Fetch details about a serial number

Parameters

  • options Object Options for this API call
    • options.serialNumber String The serial number printed on the barcode of the device packaging
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createMeshNetwork

src/Particle.js:1803-1811

Create a mesh network

Parameters

  • options Object Options for this API call
    • options.name String Network name
    • options.deviceId String Gateway device ID
    • options.iccid String? ICCID of the active SIM card (only for cellular gateway devices)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

removeMeshNetwork

src/Particle.js:1822-1824

Remove a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

listMeshNetworks

src/Particle.js:1836-1839

List all mesh networks

Parameters

  • options Object Options for this API call
    • options.page Number? Current page of results
    • options.perPage Number? Records per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

getMeshNetwork

src/Particle.js:1850-1852

Get information about a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

updateMeshNetwork

src/Particle.js:1865-1873

Modify a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.action String 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

addMeshNetworkDevice

src/Particle.js:1885-1894

Add a device to a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

removeMeshNetworkDevice

src/Particle.js:1906-1922

Remove a device from a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String? Network ID or name
    • options.deviceId String Device ID
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

listMeshNetworkDevices

src/Particle.js:1936-1945

List all devices of a mesh network.

Parameters

  • options Object Options for this API call
    • options.networkId String Network ID or name
    • options.role Number? Device role: 'gateway' or 'node'
    • options.page Number? Current page of results
    • options.perPage Number? Records per page
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> A promise

getProductConfiguration

src/Particle.js:1956-1963

Get product configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductConfigurationSchema

src/Particle.js:1974-1982

Get product configuration schema

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers. (optional, default {})
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceConfiguration

src/Particle.js:1994-2001

Get product device's configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceConfigurationSchema

src/Particle.js:2013-2021

Get product device's configuration schema

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setProductConfiguration

src/Particle.js:2033-2041

Set product configuration

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.config Object Product configuration to update
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setProductDeviceConfiguration

src/Particle.js:2054-2062

Set product configuration for a specific device within the product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Config for this product ID or slug
    • options.deviceId String Device ID to access
    • options.config Object Product configuration to update
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductLocations

src/Particle.js:2081-2098

Query location for devices within a product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Locations for this product ID or slug
    • options.dateRange String Start and end date in ISO8601 format, separated by comma, to query
    • options.rectBl String Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.rectTr String Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.deviceId String Device ID prefix to include in the query
    • options.deviceName String Device name prefix to include in the query
    • options.groups String Array of group names to include in the query
    • options.page String Page of results to display. Defaults to 1
    • options.perPage String Number of results per page. Defaults to 20. Maximum of 100
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getProductDeviceLocations

src/Particle.js:2115-2127

Query location for one device within a product

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.product String Locations for this product ID or slug
    • options.dateRange String Start and end date in ISO8601 format, separated by comma, to query
    • options.rectBl String Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.rectTr String Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
    • options.deviceId String Device ID to query
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

executeLogic

src/Particle.js:2143-2151

Executes the provided logic function once and returns the result. No logs, runs, etc are saved

NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.

Parameters

  • options Object The options for creating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logic Object The logic "function" which will be executed once
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created logic function data.

createLogicFunction

src/Particle.js:2171-2179

Creates a new logic function in the specified organization or sandbox using the provided function data.

When you create a logic function with Event logic triggers, events will immediately start being handled by the function code.

When you create a Scheduled logic trigger, it will immediately be scheduled at the next time according to the cron and start_at properties.

Parameters

  • options Object The options for creating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunction Object The logic function object containing the function details.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created logic function data.

getLogicFunction

src/Particle.js:2193-2200

Get a logic function in the specified organization or sandbox by logic function ID.

Parameters

  • options Object The options for the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified logic function data.

updateLogicFunction

src/Particle.js:2217-2225

Updates an existing logic function in the specified organization or sandbox using the provided function data.

If you include an id on a logic trigger, it will update the logic trigger in place.

Parameters

  • options Object The options for updating the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to update.
    • options.logicFunction Object The logic function object containing the logic function details.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated logic function data.

deleteLogicFunction

src/Particle.js:2239-2246

Deletes a logic function in the specified organization or sandbox by logic function ID.

Parameters

  • options Object The options for deleting the logic function.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function to delete.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object containing the deleted logic function ID.

listLogicFunctions

src/Particle.js:2260-2270

Lists all logic functions in the specified organization or sandbox.

Parameters

  • options Object The options for listing logic functions.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.todayStats boolean? Whether to include today's stats in the response
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of logic functions data.

listLogicRuns

src/Particle.js:2284-2291

Lists all logic runs for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic runs.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of logic run data.

getLogicRun

src/Particle.js:2306-2313

Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic run.
    • options.logicRunId string The ID of the logic run to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of logic run data for the specified logic run ID.

getLogicRunLogs

src/Particle.js:2328-2335

Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.

Parameters

  • options Object The options for the request.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The unique identifier of the organization.
    • options.logicFunctionId string The ID of the logic function for which to retrieve the logic run logs.
    • options.logicRunId string The ID of the logic run for which to retrieve the logs.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the logs for the specified logic run ID.

createLedger

src/Particle.js:2349-2357

Creates a new ledger definition in the specified organization or sandbox.

Parameters

  • options Object The options for creating the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledger object The ledger definition object.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the created ledger definition data.

getLedger

src/Particle.js:2371-2378

Get a ledger definition in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string The ID of the ledger definition to retrieve.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger definition data.

updateLedger

src/Particle.js:2393-2401

Updates an existing ledger definition in the specified organization or sandbox.

Parameters

  • options Object The options for updating the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger definition to update.
    • options.ledger object The ledger definition object.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated ledger definition data.

archiveLedger

src/Particle.js:2415-2422

Archives a ledger definition in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for archiving the ledger definition.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger definition to archive.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object confirming the ledger definition was archived.

Scope

src/Particle.js:2443-2456

Type: ("Owner" | "Product" | "Device")

Parameters

  • $0 Object
    • $0.auth
    • $0.org
    • $0.scope
    • $0.page
    • $0.perPage
    • $0.archived
    • $0.headers
    • $0.context

listLedgers

src/Particle.js:2443-2456

Lists all ledger definitions in the specified organization or sandbox.

Parameters

  • options Object The options for listing ledger definitions.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.scope Scope? Filter to show only ledgers of the specified scope
    • options.page number? Page of results to display
    • options.perPage number? Number of results per page. Default is 100
    • options.archived boolean? Filter to show only archived ledger or non-archived ledgers. If not provided, all ledgers are returned.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of ledger definition data.

getLedgerInstance

src/Particle.js:2471-2478

Get ledger instance data.

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger instance data.

SetMode

src/Particle.js:2499-2510

Type: ("Replace" | "Merge")

Parameters

  • $0 Object
    • $0.auth
    • $0.org
    • $0.ledgerName
    • $0.scopeValue
    • $0.instance
    • $0.setMode
    • $0.headers
    • $0.context

setLedgerInstance

src/Particle.js:2499-2510

Set ledger instance data.

Parameters

  • options Object The options for updating the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.instance object The instance with the data
    • options.setMode SetMode? How the data should be set with existing data. Default is "Replace"
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to the updated ledger instance data.

deleteLedgerInstance

src/Particle.js:2525-2532

Delete a ledger instance in the specified organization or sandbox by ledger name.

Parameters

  • options Object The options for archiving the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Name of the ledger instance to archive.
    • options.scopeValue string Scope value.
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an object confirming the ledger instance was deleted.

listLedgerInstances

src/Particle.js:2548-2559

Lists ledger instances in the specified organization or sandbox.

Parameters

  • options Object The options for listing ledger instances.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The unique identifier of the organization.
    • options.ledgerName string Name of the ledger instance to archive.
    • options.page number? Page of results to display
    • options.perPage number? Number of results per page. Default is 100
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context.

Returns Promise<RequestResponse> A promise that resolves to an array of ledger instance data.

listLedgerInstanceVersions

src/Particle.js:2576-2587

List ledger instance versions

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.replacedBefore string? ISO date string to filter to instances replaced before this time
    • options.replacedAfter string? ISO date string to filter to instances replaced after this time
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to an array of ledger instance data.

getLedgerInstanceVersion

src/Particle.js:2603-2610

Get specific ledger instance version

Parameters

  • options Object The options for the ledger instance.
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.org string? The Organization ID or slug. If not provided, the request will go to your sandbox account.
    • options.ledgerName string Ledger name.
    • options.scopeValue string Scope value.
    • options.version string Version of the ledger instance
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse> A promise that resolves to the specified ledger instance data.

setDefaultAuth

src/Particle.js:2617-2625

Set default auth token that will be used in each method if auth is not provided

Parameters

  • auth Auth The access token or basic auth object
  • Throws Error When not auth string is provided

get

src/Particle.js:2668-2672

Make a GET request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

head

src/Particle.js:2684-2688

Make a HEAD request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

post

src/Particle.js:2700-2704

Make a POST request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

put

src/Particle.js:2717-2721

Make a PUT request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.query object? Key/Value pairs of query params or a correctly formatted string
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

delete

src/Particle.js:2733-2737

Make a DELETE request

Parameters

  • params object
    • params.uri string The URI to request
    • params.auth Auth? Authorization token to use
    • params.headers object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • params.data (string | object)? Request body
    • params.context object? The invocation context, describing the tool and project

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

request

src/Particle.js:2754-2758

Parameters

  • args Object An obj with all the possible request configurations
    • args.uri String The URI to request
    • args.method String The method used to request the URI, should be in uppercase.
    • args.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • args.data object? Arbitrary data to send as the body.
    • args.auth Auth? Authorization
    • args.query Object? Query parameters
    • args.form Object? Form fields
    • args.files Object? Array of file names and file content
    • args.context Object? The invocation context, describing the tool and project.
    • args.isBuffer boolean? Indicate if the response should be treated as Buffer instead of JSON

Returns Promise<RequestResponse, RequestError> A promise that resolves with either the requested data or an error object

Particle

src/Particle.js:26-2770

Particle Cloud API wrapper.

See https://docs.particle.io/reference/javascript/ for examples of using the Particle class.

Most Particle methods take a single unnamed argument object documented as options with key/value pairs for each option.

Parameters

  • options (optional, default {})

constructor

src/Particle.js:39-48

Contructor for the Cloud API wrapper.

Create a new Particle object and call methods below on it.

Parameters

  • options Object Options for this API call Options to be used for all requests (see Defaults) (optional, default {})
    • options.baseUrl string?
    • options.clientSecret string?
    • options.clientId string?
    • options.tokenDuration number?
    • options.auth Auth? The access token or basic auth object. If not specified here, will have to be added to every request

login

src/Particle.js:85-102

Login to Particle Cloud using an existing Particle acccount.

Parameters

  • options Object Options for this API call
    • options.username String Username for the Particle account
    • options.password String Password for the Particle account
    • options.tokenDuration Number How long the access token should last in seconds (optional, default this.tokenDuration)
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

sendOtp

src/Particle.js:113-129

If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login

Parameters

  • options Object Options for this API call
    • options.mfaToken String Given as 'mfa_token' in the error body of .login().
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Number? Request context

Returns Promise A promise

enableMfa

src/Particle.js:139-141

Enable MFA on the currently logged in user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

confirmMfa

src/Particle.js:154-168

Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.

Parameters

  • options Object Options for this API call
    • options.mfaToken Object Token given from previous step to
    • options.otp Object Current one-time-password generated from the authentication app
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

disableMfa

src/Particle.js:179-187

Disable MFA for the user.

Parameters

  • options Object Options for this API call
    • options.currentPassword Object User's current password
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createCustomer

src/Particle.js:199-215

Create Customer for Product.

Parameters

  • options Object Options for this API call
    • options.email String Username for the Particle account
    • options.password String Password for the Particle account
    • options.product String Create the customer in this product ID or slug
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

loginAsClientOwner

src/Particle.js:224-238

Login to Particle Cloud using an OAuth client.

Parameters

  • options Object Options for this API call
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createUser

src/Particle.js:250-261

Create a user account for the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.username String Email of the new user
    • options.password String Password
    • options.accountInfo String Object that contains account information fields such as user real name, company name, business account flag etc
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

verifyUser

src/Particle.js:271-278

Verify new user account via verification email

Parameters

  • options Object Options for this API call
    • options.token String The string token sent in the verification email
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

resetPassword

src/Particle.js:288-295

Send reset password email for a Particle Cloud user account

Parameters

  • options Object Options for this API call
    • options.username String Email of the user
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteAccessToken

src/Particle.js:307-315

Revoke an access token

Parameters

  • options Object Options for this API call
    • options.username String Username of the Particle cloud account that the token belongs to.
    • options.password String Password for the account
    • options.token String Access token you wish to revoke
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteCurrentAccessToken

src/Particle.js:325-332

Revoke the current session access token

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteActiveAccessTokens

src/Particle.js:342-349

Revoke all active access tokens

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteUser

src/Particle.js:360-368

Delete the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.password String Password
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listAccessTokens

src/Particle.js:380-388

List all valid access tokens for a Particle Cloud account

Parameters

  • options Object Options for this API call
    • options.username String Username
    • options.password String Password
    • options.otp String Current one-time-password generated from the authentication application
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

trackingIdentity

src/Particle.js:400-408

Retrieves the information that is used to identify the current login for tracking.

Parameters

  • options Object? Options for this API call (optional, default {})
    • options.full Boolean? When true, retrieve all information for registering a user with the tracking API. When false,
                                      retrieve only the unique tracking ID for the current login. (optional, default `false`)
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<Object> Resolve the tracking identify of the current login

listDevices

src/Particle.js:426-445

List devices claimed to the account or product

Parameters

  • options Object Options for this API call
    • options.deviceId String? (Product only) Filter results to devices with this ID (partial matching)
    • options.deviceName String? (Product only) Filter results to devices with this name (partial matching)
    • options.groups Array<string>? (Product only) A list of full group names to filter results to devices belonging to these groups only.
    • options.sortAttr String? (Product only) The attribute by which to sort results. See API docs for options.
    • options.sortDir String? (Product only) The direction of sorting. See API docs for options.
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? List devices in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getDevice

src/Particle.js:457-460

Get detailed informationa about a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

claimDevice

src/Particle.js:472-483

Claim a device to the account. The device must be online and unclaimed.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.requestTransfer boolean True to request the device be transfered from another user
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

addDeviceToProduct

src/Particle.js:497-515

Add a device to a product or move device out of quarantine.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID
    • options.product String Add to this product ID or slug
    • options.file Object A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
                                     Node: Either a path or Buffer. Browser: a File or Blob.
      
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDevice

src/Particle.js:528-532

Unclaim / Remove a device from your account or product, or deny quarantine

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.deny Boolean? (Product only) Deny this quarantined device, instead of removing an already approved device
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

removeDeviceOwner

src/Particle.js:544-547

Unclaim a product device its the owner, but keep it in the product

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Remove from this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

renameDevice

src/Particle.js:560-562

Rename a device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Desired Name
    • options.product String? Rename device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

signalDevice

src/Particle.js:575-577

Instruct the device to turn on/off the LED in a rainbow pattern

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.signal Boolean Signal on or off
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setDeviceNotes

src/Particle.js:590-592

Store some notes about device

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.notes String Your notes about this device
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

markAsDevelopmentDevice

src/Particle.js:605-607

Mark device as being used in development of a product so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.development Boolean Set to true to mark as development, false to return to product fleet (optional, default true)
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

lockDeviceProductFirmware

src/Particle.js:621-623

Mark device as being used in development of a product, so it opts out of automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.desiredFirmwareVersion Number Lock the product device to run this firmware version.
    • options.flash Boolean? Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

unlockDeviceProductFirmware

src/Particle.js:635-637

Mark device as receiving automatic firmware updates

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateDevice

src/Particle.js:656-668

Update multiple device attributes at the same time

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String? Desired Name
    • options.signal Boolean? Signal device on or off
    • options.notes String? Your notes about this device
    • options.development Boolean? (Product only) Set to true to mark as development, false to return to product fleet
    • options.desiredFirmwareVersion (Number | null)? (Product only) Lock the product device to run this firmware version.
                                                           Pass `null` to unlock firmware and go back to released firmware.
      
    • options.flash Boolean? (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

provisionDevice

src/Particle.js:679-687

Provision a new device for products that allow self-provisioning

Parameters

  • options Object Options for this API call
    • options.productId String Product ID where to create this device
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getClaimCode

src/Particle.js:701-704

Generate a claim code to use in the device claiming process. To generate a claim code for a product, the access token MUST belong to a customer of the product.

Parameters

  • options Object Options for this API call
    • options.iccid String? ICCID of the SIM card used in the Electron
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getVariable

src/Particle.js:736-742

Get the value of a device variable

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Variable name
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashDevice

src/Particle.js:756-767

Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.product String Flash device in this product ID or slug
    • options.files Object Object containing files to be compiled and flashed. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

flashTinker

src/Particle.js:778-793

DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

compileCode

src/Particle.js:806-824

Compile firmware using the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.files Object Object containing files to be compiled. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
    • options.platformId Number? Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
    • options.targetVersion String System firmware version to compile against (optional, default latest)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

downloadFirmwareBinary

src/Particle.js:835-844

Download a firmware binary

Parameters

  • options Object Options for this API call
    • options.binaryId String Binary ID received from a successful compile call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise<RequestResponse, RequestError> A promise

sendPublicKey

src/Particle.js:857-871

Send a new device public key to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.key (String | Buffer) Public key contents
    • options.algorithm String Algorithm used to generate the public key. Valid values are rsa or ecc. (optional, default rsa)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

callFunction

src/Particle.js:885-890

Call a device function

Parameters

  • options Object Options for this API call
    • options.deviceId String Device ID or Name
    • options.name String Function name
    • options.argument String Function argument
    • options.product String? Device in this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getEventStream

src/Particle.js:903-928

Get a stream of events

Parameters

  • options Object Options for this API call
    • options.deviceId String? Device ID or Name, or mine to indicate only your devices.
    • options.name String? Event Name
    • options.org String? Organization Slug
    • options.product String? Events for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor

Returns Promise If the promise resolves, the resolution value will be an EventStream object that will emit 'event' events.

publishEvent

src/Particle.js:942-946

Publish a event to the Particle Cloud

Parameters

  • options Object Options for this API call
    • options.name String Event name
    • options.data String Event data
    • options.isPrivate Boolean Should the event be publicly available?
    • options.product String? Event for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

Hook

src/Particle.js:977-999

Type: Object

Parameters

  • $0 Object
    • $0.event
    • $0.url
    • $0.device
    • $0.rejectUnauthorized
    • $0.noDefaults
    • $0.hook
    • $0.product
    • $0.auth
    • $0.headers
    • $0.context

Properties

  • method String? Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
  • auth Object? Auth data like { username: 'me', password: '1234' } to send via basic auth header with the Webhook request
  • headers Object? Additional headers to add to the Webhook like { 'X-ONE': '1', X-TWO: '2' }
  • query Object? Query params to add to the Webhook request like { foo: 'foo', bar: 'bar' }
  • json Object? JSON data to send with the Webhook request - sets Content-Type to application/json
  • form Object? Form data to send with the Webhook request - sets Content-Type to application/x-www-form-urlencoded
  • body String? Custom body to send with the Webhook request
  • responseTemplate Object? Template to use to customize the Webhook response body
  • responseEvent Object? The Webhook response event name that your devices can subscribe to
  • errorResponseEvent Object? The Webhook error response event name that your devices can subscribe to

createWebhook

src/Particle.js:977-999

Create a webhook

Parameters

  • options Object Options for this API call
    • options.event String The name of the Particle event that should trigger the Webhook
    • options.url String The web address that will be targeted when the Webhook is triggered
    • options.device String? Trigger Webhook only for this device ID or Name
    • options.rejectUnauthorized Boolean? Set to false to skip SSL certificate validation of the target URL
    • options.noDefaults Boolean? Don't include default event data in the webhook request
    • options.hook Hook? Webhook configuration settings
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteWebhook

src/Particle.js:1011-1014

Delete a webhook

Parameters

  • options Object Options for this API call
    • options.hookId String Webhook ID
    • options.product String? Webhook for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listWebhooks

src/Particle.js:1025-1028

List all webhooks owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Webhooks for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

createIntegration

src/Particle.js:1045-1049

Create an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.event String Event that triggers the integration
    • options.settings Object Settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

editIntegration

src/Particle.js:1067-1071

Edit an integration to send events to an external service

See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to edit
    • options.event String? Change the event that triggers the integration
    • options.settings Object? Change the settings specific to that integration type
    • options.deviceId String? Trigger integration only for this device ID or Name
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deleteIntegration

src/Particle.js:1084-1087

Delete an integration to send events to an external service

Parameters

  • options Object Options for this API call
    • options.integrationId String The integration to remove
    • options.product String? Integration for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listIntegrations

src/Particle.js:1098-1101

List all integrations owned by the account or product

Parameters

  • options Object Options for this API call
    • options.product String? Integrations for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getUserInfo

src/Particle.js:1111-1113

Get details about the current user

Parameters

  • options Object Options for this API call
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

setUserInfo

src/Particle.js:1124-1127

Set details on the current user

Parameters

  • options Object Options for this API call
    • options.accountInfo String Set user's extended info fields (name, business account, company name, etc)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUsername

src/Particle.js:1140-1148

Change username (i.e, email)

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.username String New email
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

changeUserPassword

src/Particle.js:1161-1169

Change user's password

Parameters

  • options Object Options for this API call
    • options.currentPassword String Current password
    • options.password String New password
    • options.invalidateTokens Boolean Should all tokens be invalidated (optional, default false)
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

listSIMs

src/Particle.js:1185-1189

List SIM cards owned by a user or product

Parameters

  • options Object Options for this API call
    • options.iccid String? (Product only) Filter to SIM cards matching this ICCID
    • options.deviceId String? (Product only) Filter to SIM cards matching this device ID
    • options.deviceName String? (Product only) Filter to SIM cards matching this device name
    • options.page Number? (Product only) Current page of results
    • options.perPage Number? (Product only) Records per page
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getSIMDataUsage

src/Particle.js:1201-1207

Get data usage for one SIM card for the current billing period

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM card for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

getFleetDataUsage

src/Particle.js:1218-1225

Get data usage for all SIM cards in a product the current billing period

Parameters

  • options Object Options for this API call
    • options.product String SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

checkSIM

src/Particle.js:1236-1238

Check SIM status

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

activateSIM

src/Particle.js:1253-1263

Activate and add SIM cards to an account or product

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.iccids Array<String> (Product only) ICCID of multiple SIM cards to import
    • options.country String The ISO country code for the SIM cards
    • options.promoCode any?
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

deactivateSIM

src/Particle.js:1275-1279

Deactivate a SIM card so it doesn't incur data usage in future months.

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

reactivateSIM

src/Particle.js:1292-1296

Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused

Parameters

  • options Object Options for this API call
    • options.iccid String ICCID of the SIM card
    • options.mbLimit Number? New monthly data limit. Necessary if unpausing a SIM card
    • options.product String? SIM cards for this product ID or slug
    • options.auth Auth? The access token or basic auth object. Can be ignored if provided in constructor
    • options.headers Object? Key/Value pairs like { 'X-FOO': 'foo', X-BAR: 'bar' } to send as headers.
    • options.context Object? Request context

Returns Promise A promise

updateSIM

src/Particle.js:1309-1313

Update SIM card data limit

Parameters

  • options