SDK Libraries
SDK Version 1.1.0
The published packages are v1.1.0 for all three SDKs: PyPI spatialflow, npm @spatialflow/sdk, and the Go module tag. The webhook signature and payload fixes are in the source of all three and will ship in the next release (1.1.1), so the published packages do not have them yet. 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
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/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
- Python SDK: Complete Python SDK Guide | GitHub
- Node.js SDK: GitHub
- Go SDK: GitHub
REST API
You can also use the REST API directly: