Skip to main content

SDK Libraries

SDK versions

All three SDKs share one version: PyPI spatialflow, npm @spatialflow/sdk, and the Go module tag. Check the registry for the latest release. A major version can remove methods, so read the changelog before upgrading. Each SDK's changelog lists what each release contains: Python, Node.js, and Go.

Requirements:

  • Python SDK: Python >= 3.9
  • Node.js SDK: Node.js >= 18 (required for global fetch)
  • Go SDK: Go >= 1.21

Technical Details:

  • Generated from OpenAPI spec using openapi-generator-cli 7.10.0
  • Dependencies: Python (aiohttp, aiohttp-retry, pydantic v2, urllib3, python-dateutil), Node.js (axios), Go (stdlib only)

Installation​

Python​

pip install spatialflow

Node.js​

npm install @spatialflow/sdk
# or
yarn add @spatialflow/sdk

Go​

go get github.com/spatialflow-io/spatialflow-go/v3

Quick Start​

Python​

import asyncio
from spatialflow import SpatialFlow

async def main():
async with SpatialFlow(api_key="sf_xxx") as client:
# List geofences
response = await client.geofences.list()
for geofence in response.geofences:
print(f"{geofence.name}: {geofence.id}")

asyncio.run(main())

For complete Python SDK documentation, see the Python SDK Guide.

Node.js​

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

const client = new SpatialFlow({ apiKey: "sf_xxx" });

// List geofences
const response = await client.geofences.appsGeofencesApiListGeofences();
for (const geofence of response.data.geofences) {
console.log(`${geofence.name}: ${geofence.id}`);
}

Go​

package main

import (
"context"
"log"
"net/http"

"github.com/spatialflow-io/spatialflow-go/v3/spatialflow"
)

func main() {
// Create client with API key
client, err := spatialflow.NewClient(
spatialflow.WithAPIKey("sf_your_api_key"),
)
if err != nil {
log.Fatal(err)
}

ctx := context.Background()

// Make API requests using the HTTP client (includes auth, retry, User-Agent)
req, _ := http.NewRequestWithContext(ctx, "GET", client.BaseURL()+"/api/v1/geofences", nil)
resp, err := client.HTTPClient().Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()

// Check for API errors
if err := spatialflow.CheckResponse(resp); err != nil {
log.Fatal(err)
}

log.Printf("Got %d response", resp.StatusCode)
}

Features​

All SDKs include:

  • Authentication - API key and JWT token support
  • Full CRUD - Geofences, workflows, webhooks, devices (via generated client or HTTP client)
  • Pagination - Iterators for paginated endpoints
  • Webhook Verification - HMAC-SHA256 signature validation
  • Job Polling - Job status tracking with timeout handling
  • File Uploads - GeoJSON, KML, GPX import helpers
  • Typed Errors - AuthenticationError, NotFoundError, ValidationError, etc.

Documentation​

AI assistants​

To ask Claude, Cursor or another MCP client about your workspace, use the read-only MCP server (uvx spatialflow-mcp).

REST API​

You can also use the REST API directly: