Skip to content

Installation

Install

Terminal window
npm install @imbrace/sdk@1.0.2
# or
yarn add @imbrace/sdk@1.0.2
# or
pnpm add @imbrace/sdk@1.0.2

Requires Node.js 18+ (or any browser with native fetch and ReadableStream).

Initialize the client

import { ImbraceClient } from "@imbrace/sdk"
// Build on Imbrace — Imbrace IS your backend, end-users log in via OTP
const client = new ImbraceClient({
accessToken: "acc_your_token",
baseUrl: "https://app-gatewayv2.imbrace.co",
})

The client is stateful — create it once and reuse it across your app.

import { ImbraceClient } from "@imbrace/sdk"
// Wrap Imbrace — Imbrace is a feature inside YOUR backend, your users
const client = new ImbraceClient({
apiKey: "api_xxx...",
baseUrl: "https://app-gatewayv2.imbrace.co",
})

The client is stateful — create it once and reuse it across your app.

For when to use each credential, see Authentication. For step-by-step credential setup (env vars, dotenv, secrets), see Setup Guide.

Verify

import { ImbraceClient } from "@imbrace/sdk"
console.log("SDK loaded:", typeof ImbraceClient) // "function"

Environment variables

The SDK does not auto-read environment variables. Pass credentials directly to the constructor and use a loader (dotenv / your framework’s env handling) if you keep them in .env.

VariablePurpose
IMBRACE_API_KEYYour API key (org-level credential)
IMBRACE_ACCESS_TOKENA user’s access token (per-session credential)
IMBRACE_BASE_URLOverride the gateway URL (default: https://app-gatewayv2.imbrace.co)

The org id is encoded inside both API keys and access tokens — you never pass organizationId/organization_id to the SDK. See Authentication for details.