Skip to main content

Node.js SDK

The Node.js SDK is published on npm as @spatialflow/sdk. It needs Node.js 18 or later, and its source is in the spatialflow-node repository.

Check npm for the latest release. A major version can remove methods, so read the changelog before upgrading. The SDK follows Semantic Versioning: breaking changes bump the major version.

Install​

npm install @spatialflow/sdk

Create a client​

import {SpatialFlow} from '@spatialflow/sdk';

const client = new SpatialFlow({apiKey: process.env.SPATIALFLOW_API_KEY});

Create the key under Settings > API Keys and give it permission for each resource the client uses. See Authentication and API keys.

How the SDK is organized​

The package exports one client class and a few helpers:

  • SpatialFlow is the client. Its geofences, workflows, webhooks, devices, account, and storage properties are the generated API classes for those resources. Methods have names like appsGeofencesApiListGeofences and return the Axios response.
  • paginate and collectAll iterate over list endpoints.
  • verifyWebhookSignature checks the X-SF-Signature header on incoming webhooks.
  • A set of error classes, all extending SpatialFlowError, describe failed requests.
  • uploadGeofences and pollJob import geofence files and wait for the job.

The Node.js client exposes the generated method names only, unlike the Python SDK's shorter ones such as client.geofences.list(). The Resources page lists them.

Reference​