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:
SpatialFlowis the client. Itsgeofences,workflows,webhooks,devices,account, andstorageproperties are the generated API classes for those resources. Methods have names likeappsGeofencesApiListGeofencesand return the Axios response.paginateandcollectAlliterate over list endpoints.verifyWebhookSignaturechecks theX-SF-Signatureheader on incoming webhooks.- A set of error classes, all extending
SpatialFlowError, describe failed requests. uploadGeofencesandpollJobimport 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
- Client and authentication: API key and token setup, options, and request overrides.
- Resources: the generated methods on each resource, with examples.
- Pagination:
paginateandcollectAll. - Webhook verification:
verifyWebhookSignature. - Errors: the error classes and how HTTP and network failures map to them.
- File uploads and jobs:
uploadGeofencesandpollJob.