Node.js SDK
The official TypeScript SDK for the Glance API. Fully typed, ergonomic, and designed to make your integration effortless.
The SDK is at 0.1.1 and is behind this reference. It was typed from an earlier version of these pages, before they were checked against the server, so several of its shapes do not match what the API actually accepts or returns — it wraps every response in
{ success, data }, which most endpoints do not return; it names custom-field parameters label / fieldType rather than name / type; it allocates receipts with invoiceIds instead of allocations; and it addresses products by numeric id where the API takes a visibleId. Where the two disagree, the endpoint reference is the one that matches the server.Installation
Terminal
npm install @glance-il/sdk
Initialization
Create a client instance with your API key:
TypeScript
import { GlanceClient } from "@glance-il/sdk";
const glance = new GlanceClient({
apiKey: process.env.GLANCE_API_KEY!,
});Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your Glance API key |
baseUrl | string | https://api.glance.co.il | API base URL |
timeout | number | 30000 | Request timeout in milliseconds |
Basic Usage
All resources follow a consistent pattern with list, get, create, update, and delete methods:
TypeScript
// List clients with pagination
const { data: clients, pagination } = await glance.clients.list({
search: "acme",
limit: 20,
});
console.log(`Found ${pagination.total} clients`);
// Get a single client
const { data: client } = await glance.clients.get(1);
// Create a client
const { data: newClient } = await glance.clients.create({
name: "Acme Corp",
type: "COMPANY",
email: "billing@acme.com",
});
// Update a client
const { data: updated } = await glance.clients.update(1, {
email: "new@acme.com",
});Creating an Invoice
TypeScript
const { data: invoice } = await glance.documents.create("invoice", {
clientId: 1,
products: [
{
description: "Web Development Services",
units: 40,
price: 150,
typeOfUnit: "hours",
},
],
payments: [
{
amount: 6000,
paymentMethod: "bankTransfer",
},
],
sendToClient: true,
});
console.log(`Invoice ${invoice.visibleId} created`);Managing Inventory
TypeScript
// Check stock for a product across all warehouses
const { data: stock } = await glance.inventory.getByProduct(42);
// Adjust inventory
await glance.inventory.adjust({
actions: [
{
productId: 42,
warehouseId: 1,
amount: -5,
reason: "Damaged goods",
},
],
});
// Track movements
const { data: movements } = await glance.inventoryMovements.list({
warehouseId: 1,
limit: 50,
});Generating Reports
TypeScript
const { data: report } = await glance.reports.income({
dateFrom: "2026-01-01",
dateTo: "2026-03-31",
});
console.log(`Revenue: ${report.total}`);Available Resources
| Resource | Property | Description |
|---|---|---|
| Clients | glance.clients | Business clients / customers |
| Contacts | glance.contacts | Contacts associated with clients |
| Addresses | glance.addresses | Addresses for clients |
| Products | glance.products | Products and services catalog |
| Product Serials | glance.productSerials | Serial numbers for physical products |
| Warehouses | glance.warehouses | Warehouse locations |
| Inventory | glance.inventory | Stock levels per product/warehouse |
| Movements | glance.inventoryMovements | Stock movement history |
| Documents | glance.documents | Invoices, receipts, quotes, and more |
| Vendors | glance.vendors | Suppliers and vendors |
| Purchase | glance.purchase | Purchase orders and vendor invoices |
| Expenses | glance.expenses | Business expenses |
| Retainers | glance.retainers | Recurring retainer agreements |
| Reports | glance.reports | Income, expenses, VAT reports |
| Employees | glance.employees | Employee management |
| Files | glance.files | File attachments |
| Custom Fields | glance.customFields | Custom metadata fields |
| Payments | glance.payments | Payment processing (Grow) |
| Settings | glance.settings | Account settings |
Requirements
- Node.js >= 18 (uses native
fetch) - TypeScript >= 5.0 (optional, works with plain JavaScript too)