Client library

JavaScript SDK

Embed physical perception directly in Node.js with automatic JSON and multipart request handling.

Setup

The included SDK requires Node.js 20 or newer. Install the API repository dependencies and configure your key.

Terminal
npm install
export OUTERVIEW_API_KEY="YOUR_OUTERVIEW_API_KEY"
export OUTERVIEW_API_BASE_URL="https://api.outerview.ai"

Create a client

The exported class is currently named OuterviewClient. discover() accepts the REST request fields and returns the perception response unchanged.

Node.js
import { OuterviewClient } from "./sdk/index.js";

const client = new OuterviewClient({
  baseUrl: "https://api.outerview.ai",
  apiKey: process.env.OUTERVIEW_API_KEY,
  timeoutMs: 120000,
});

const result = await client.discover({
  query: "coffee shops near parks in Toronto",
  limit: 100,
  answer: true,
});

console.log(result.answer.content);
console.log(result.results.features);

Use the standalone helper

Node.js
import { discover } from "./sdk/index.js";

const result = await discover("public art in Vancouver", {
  baseUrl: "https://api.outerview.ai",
  apiKey: process.env.OUTERVIEW_API_KEY,
  timeoutMs: 120000,
});

Upload a spatial file

When files or images contain File objects, the SDK automatically switches from JSON to multipart form data.

A client timeout aborts the local request, but server-side work may already have started.

Node.js 20+
import { readFile } from "node:fs/promises";
import { OuterviewClient } from "./sdk/index.js";

const client = new OuterviewClient({
  baseUrl: "https://api.outerview.ai",
  apiKey: process.env.OUTERVIEW_API_KEY,
});

const csv = new File([await readFile("./buildings.csv")], "buildings.csv", {
  type: "text/csv",
});

const result = await client.discover({
  query: "Find stop signs near my buildings",
  files: [csv],
  limit: 250,
});