Node.js SDK

The official TypeScript SDK for the Glance API. Fully typed, ergonomic, and designed to make your integration effortless.

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

OptionTypeDefaultDescription
apiKeystringrequiredYour Glance API key
baseUrlstringhttps://api.glance.co.ilAPI base URL
timeoutnumber30000Request 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

ResourcePropertyDescription
Clientsglance.clientsBusiness clients / customers
Contactsglance.contactsContacts associated with clients
Addressesglance.addressesAddresses for clients
Productsglance.productsProducts and services catalog
Product Serialsglance.productSerialsSerial numbers for physical products
Warehousesglance.warehousesWarehouse locations
Inventoryglance.inventoryStock levels per product/warehouse
Movementsglance.inventoryMovementsStock movement history
Documentsglance.documentsInvoices, receipts, quotes, and more
Vendorsglance.vendorsSuppliers and vendors
Purchaseglance.purchasePurchase orders and vendor invoices
Expensesglance.expensesBusiness expenses
Retainersglance.retainersRecurring retainer agreements
Reportsglance.reportsIncome, expenses, VAT reports
Employeesglance.employeesEmployee management
Filesglance.filesFile attachments
Custom Fieldsglance.customFieldsCustom metadata fields
Paymentsglance.paymentsPayment processing (Grow)
Settingsglance.settingsAccount settings

Requirements

  • Node.js >= 18 (uses native fetch)
  • TypeScript >= 5.0 (optional, works with plain JavaScript too)