Skip to Content
🚀 Orga AI is in open beta.

Types

The Node SDK exports a minimal set of TypeScript interfaces and helper types that describe its configuration, responses, and errors.
These types are lightweight and designed for direct integration in your backend routes or custom service layers.


OrgaAIConfig

Configuration object accepted by the OrgaAI class constructor.

export interface OrgaAIConfig { apiKey: string; userEmail: string; // currently required (will be deprecated soon) baseUrl?: string; // defaults to "https://api.orga-ai.com" timeout?: number; // request timeout in ms (default 10000) debug?: boolean; // enable console debugging }
FieldTypeRequiredDefaultDescription
apiKeystringYour long‑lived Orga API key (must remain server‑side).
userEmailstring✅ (for now)Associated email identifier; used for audit logging.
baseUrlstringhttps://api.orga-ai.comOverride the API endpoint (mainly for testing).
timeoutnumber10000Time limit for each HTTP request, in milliseconds.
debugbooleanfalsePrints detailed logs for each SDK operation.

SessionConfig

Represents the object returned by OrgaAI.getSessionConfig().

export interface SessionConfig { ephemeralToken: string; iceServers: IceServer[]; }
FieldTypeDescription
ephemeralTokenstringTemporary credential used by clients to authenticate WebRTC sessions.
iceServersIceServer[]Array of STUN/TURN servers used for WebRTC connectivity.

IceServer

Describes a single WebRTC ICE (STUN/TURN) server configuration.

export interface IceServer { urls: string | string[]; username?: string; credential?: string; }
FieldTypeDescription
urlsstring | string[]STUN/TURN server address(es).
usernamestringOptional TURN username for authenticated servers.
credentialstringOptional credential associated with TURN access.

📘 Note: The ICE servers follow the RTCIceServer spec  for WebRTC compatibility.
These values are directly consumed by client SDKs during peer connection setup.


OrgaAIErrorType

Union type describing the categories of errors thrown by the SDK.

export type OrgaAIErrorType = | "authentication_error" | "server_error" | "timeout_error" | "configuration_error" | "network_error";
ValueDescription
"authentication_error"Invalid or missing API key / userEmail.
"server_error"Internal Orga Cloud error (5xx).
"timeout_error"Request exceeded configured timeout.
"configuration_error"Invalid or missing SDK configuration field.
"network_error"No internet connection or blocked HTTPS request.

Example usage:

import type { OrgaAIErrorType, SessionConfig } from "@orga-ai/node"; function handleError(type: OrgaAIErrorType) { if (type === "authentication_error") { console.error("Invalid API key!"); } }

Example Full Type Flow

import type { OrgaAIConfig, SessionConfig, IceServer, } from "@orga-ai/node"; const config: OrgaAIConfig = { apiKey: "sk_orga_ai_*****", userEmail: "you@example.com", timeout: 15000, debug: true, }; const session: SessionConfig = { ephemeralToken: "eyJhbGciOi...", iceServers: [ { urls: "stun:stun1.l.google.com:19302" }, { urls: ["turn:turn.orga-ai.com:3478"], username: "6b4c...", credential: "a1b2...", }, ], };

Re‑exported Types (for convenience)

@orga-ai/node re‑exports these base types from internal modules:

TypeDescription
OrgaAIConfigConstructor configuration for OrgaAI.
SessionConfigCombined response object with token and ICE servers.
IceServerSTUN/TURN server descriptor.
OrgaAIErrorTypeEnumerated error categories.

Next Steps

  • Classes → Learn how to use OrgaAI in your backend routes.
  • Errors → Understand error classes and handling patterns.
  • Troubleshooting → Troubleshooting guide.
Last updated on