ArcFlow
Company
Managed Services
Markets
  • News
  • LOG IN
  • GET STARTED

OZ brings Visual Intelligence to physical venues, a managed edge layer that lets real-world environments see, understand, and act in real time.

Talk to us

ArcFlow

  • World Models
  • Sensors

Managed Services

  • OZ VI Venue 1
  • Case Studies

Markets

  • Sports
  • Broadcasting
  • Robotics

Company

  • About
  • Technology
  • Careers
  • Contact

Ready to see it live?

Talk to the OZ team about deploying at your venues, from a single pilot match to a full regional rollout.

Schedule a deployment review

© 2026 OZ. All rights reserved.

LinkedIn

Data SDK

The OZ Data SDK is a TypeScript-first client for consuming Visual Intelligence streams. It handles authentication, connection management, event subscriptions, and schema validation, so you can focus on what you do with the data.

Installation

Install the SDK from npm. Requires Node.js 18+ or any runtime with Web Streams API support.

Install @oz/data-sdk
npm install @oz/data-sdk

Client initialization

Create a single OZClient instance at process start. The client manages token refresh, reconnection, and connection pooling internally. Reuse it across all subscriptions.

typescriptCreate and connect the client
import { OZClient } from '@oz/data-sdk';

const client = new OZClient({
  clientId: process.env.OZ_CLIENT_ID!,
  clientSecret: process.env.OZ_CLIENT_SECRET!,
});

// Connect to a specific venue
await client.connect({
  venue: 'venue-nk9',
  quality: 'production',
});

console.log('Connected:', client.status);

Client options

NameTypeRequiredDescription
clientIdstringrequiredYour OZ application client ID
clientSecretstringrequiredYour OZ application client secret
baseUrlstringdefault: https://api.oz-global.com/v1API base URL override
timeoutnumberdefault: 30000Request timeout in milliseconds
maxRetriesnumberdefault: 3Max automatic retry attempts on transient errors

Sessions and scenes

After connecting, query available scenes and open a session to start receiving events. Sessions are scoped to a single scene and maintain ordering guarantees.

typescriptOpen a scene session
// List available scenes
const scenes = await client.venues.listScenes('venue-nk9');

// Open a session to the first active scene
const session = await client.sessions.create({
  sceneId: scenes[0].id,
  mode: 'realtime',
});

console.log('Session opened:', session.id);

Event handling

Subscribe to scene events using typed event handlers. Events arrive in deterministic order with idempotent IDs, so you can safely replay and deduplicate.

typescriptSubscribe to spatial events
import type { SceneEvent } from '@oz/data-sdk';

client.on('scene.event', (event: SceneEvent) => {
  switch (event.type) {
    case 'object.moved':
      console.log(`Object ${event.payload.object_id} moved to`, event.payload.to);
      break;
    case 'zone.enter':
      console.log(`Object entered zone ${event.payload.zone_id}`);
      break;
    case 'zone.exit':
      console.log(`Object exited zone ${event.payload.zone_id}`);
      break;
  }
});

client.on('error', (err) => {
  console.error('Stream error:', err.code, err.message);
});

Schema validation

The SDK includes runtime schema validators for all event types. Enable strict mode to throw on unexpected payload shapes. This is useful during development and CI.

typescriptEnable strict schema validation
import { OZClient, StrictValidator } from '@oz/data-sdk';

const client = new OZClient({
  clientId: process.env.OZ_CLIENT_ID!,
  clientSecret: process.env.OZ_CLIENT_SECRET!,
  validator: new StrictValidator(),
});

// In strict mode, unknown event types throw a SchemaError
// instead of being silently ignored.
client.on('schema.error', (err) => {
  console.error('Unexpected event shape:', err.eventType, err.details);
});

TypeScript reference

The SDK ships full TypeScript declarations. Key types you'll work with:

typescriptCore types
interface OZClientOptions {
  clientId: string;
  clientSecret: string;
  baseUrl?: string;
  timeout?: number;
  maxRetries?: number;
  validator?: EventValidator;
}

interface SceneEvent {
  event_id: string;
  type: 'object.moved' | 'zone.enter' | 'zone.exit' | 'incident';
  timestamp: string;
  scene_id: string;
  payload: Record<string, unknown>;
}

interface Session {
  id: string;
  scene_id: string;
  mode: 'realtime' | 'historical';
  status: 'active' | 'closed';
  created_at: string;
}

Error handling

The SDK surfaces errors as typed OZError instances with a machine-readable code, message, and request_id. Network errors trigger automatic retries (up to maxRetries). Subscribe to the error event for centralized handling.

typescriptCentralized error handling
import { OZError } from '@oz/data-sdk';

client.on('error', (err: OZError) => {
  logger.error({
    code: err.code,
    message: err.message,
    requestId: err.requestId,
  });

  if (err.code === 'connection_lost') {
    // SDK reconnects automatically, but you can
    // update your UI or health check status here.
    healthCheck.setDegraded('oz-connection');
  }
});

Need help with your integration? Our engineering team is available to pair on your first deployment.

Get SDK access