API reference
SpatialEngine exposes its statement API through gRPC for native applications and through the npm SDK for an in-page WebAssembly engine. The Python and TypeScript SDKs include generated method signatures and statement documentation.
Python
Browse client.std in your editor. Types are importable modules under spatialengine.types.
from spatialengine.types.std.math import Quat, Vec3Client provides blocking calls. AsyncClient provides coroutines. Engine errors raise typed exceptions.
TypeScript
Import statements from @fslabs/spatialengine for the in-page engine. Methods accept typed request objects and return typed values. Import the types namespace for request and result types. Camera methods use std.viewport.camera.
API areas
| Namespace | Use |
|---|---|
std.object | Versioned nodes, hierarchy, representations, transforms, and visibility. |
std.project | Project lifecycle, transactions, undo, redo, and scene synchronization. |
std.scene | Temporary shapes, transforms, and interactions. |
std.viewport | Input, picking, and camera controls. |
std.server | SpatialDrive connection and authentication. |
std.csg | Block-model CSG operations. |
wmts | Map tile configuration. |
Other languages
Any language with a gRPC client can control the native engine, including Rust, Go, C++, C#, Java, and Python. The Python SDK supplies generated methods and types for convenience.
gRPC server reflection
The running engine exposes gRPC server reflection v1 and v1alpha. Tools such as grpcurl can discover services and inspect their methods without a local protobuf schema:
grpcurl -plaintext localhost:50051 list
grpcurl -plaintext localhost:50051 describeUse the gRPC address reported in the engine’s startup output. The default is localhost:50051.
Export the protobuf schema
The native executable includes a schema export command:
SpatialEngine --emit-proto ./protoThis command starts the engine, writes its protobuf schema to ./proto, and exits. Generate a client for your language from those files, then connect to a running engine’s gRPC endpoint.
The Python package also includes the schema. spatialengine.proto_path() returns its location.
Web portal
The running engine’s portal provides engine settings and an embeddable streaming viewport at
/streaming/viewport. The default portal address is http://localhost:8080.
Embed the viewport in any application that can host a webview, including native UI frameworks and web-based UIs. You can also open it directly in a browser to inspect the scene. Viewports explains how to integrate it into your application.
SDK and engine versions
Install the Python wheel supplied with your native engine release. Studio installs its matching SDK automatically. Pin your npm package version and use that release’s request signatures.