The Maesn TypeScript SDK is currently in beta. The API surface may change between releases. We recommend pinning to a specific version in production.
The Maesn TypeScript SDK lets you interact with the unified API from your TypeScript or JavaScript application. It provides full type safety, built-in error handling, and supports all endpoints available in the API reference.
The SDK is available on npm and is actively developed.
Installation
Install the SDK using your preferred package manager:
npm add @maesn/typescript-sdk
The SDK is published as an ES Module (ESM) only. If your project uses CommonJS, import it with await import("@maesn/typescript-sdk").
Authentication
The SDK requires two API keys, which you can pass directly or load from environment variables:
| Key | Environment variable | Description |
|---|
apiKey | MAESN_API_KEY | Authenticates your application with the Maesn API |
accountKey | MAESN_ACCOUNT_KEY | Identifies the end user’s connected target system |
See the authentication guide for how to obtain these keys.
Example
The following example initializes the client and fetches a list of invoices for a connected end user:
import { Maesn } from "@maesn/typescript-sdk";
const maesn = new Maesn({
serverURL: "https://api.maesn.dev",
security: {
apiKey: process.env["MAESN_API_KEY"] ?? "",
accountKey: process.env["MAESN_ACCOUNT_KEY"] ?? "",
},
});
const result = await maesn.accounting.retrieveInvoices();
console.log(result);
Replace the environment variables with your actual API key and account key.