# zata-vsdc-sdk
A production-friendly TypeScript/JavaScript SDK for the Zata API.
Built for Rwanda e-invoicing and tax-compliance workflows: companies, branches, parties, products, expenses, transactions, insurance, patient flows, and signed invoice downloads.
## Why use this SDK
- Fast onboarding to the Zata API with a single client
- Automatic `Authorization`, `companyId`, and `branchId` header handling
- Clean method names that map directly to documented API actions
- Works in both TypeScript and JavaScript projects
- Built-in request error formatting for faster debugging
## Install
```bash
npm install zata-vsdc-sdk
```
Or with yarn:
```bash
yarn add zata-vsdc-sdk
```
Or with pnpm:
```bash
pnpm add zata-vsdc-sdk
```
## Quick start
```ts
import { ZataClient } from "zata-vsdc-sdk";
const client = new ZataClient({
// token is preferred. apiKey is also supported as an alias.
token: process.env.ZATA_TOKEN,
companyId: 1,
branchId: 1,
baseUrl: "
api.zata.rw", // default
timeout: 30000, // default
});
async function run() {
// 1) Pull reference data
const paymentModes = await client.getPaymentModes();
const taxes = await client.getProductTaxes();
// 2) Create a customer
await client.createCustomer({
name: "John Doe",
address: "Kigali",
phone: "0780000000",
email: "john@example.com",
tin: "123456789",
hasInsurance: "no",
});
// 3) Create a product
await client.createProduct({
name: "Service Item",
packagingUnitID: 1,
quantityUnitID: 1,
countryID: 1,
taxID: 1,
branchProductCategoryID: 1,
hasStock: "yes",
});
// 4) Create a sale transaction
const sale = await client.createSaleTransaction({
paymentMethodID: 1,
transactionDate: "2026-01-01",
items: [{ productID: 1, units: 1, unitPrice: 1000, discountRate: 0 }],
});
return { paymentModes, taxes, sale };
}
```
## JavaScript (CommonJS)
```js
const { ZataClient } = require("zata-vsdc-sdk");
const client = new ZataClient({
token: process.env.ZATA_TOKEN,
companyId: 1,
branchId: 1,
}); …