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

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)

Last updated