Meet us at Rethink! Accounting / CFO on 20.-21. April in Frankfurt

Maesn TypeScript SDK: Type-Safe Accounting Integrations

The Maesn TypeScript SDK wraps the full Unified API into typed functions with built-in retries, pagination, and runtime validation, eliminating the boilerplate that comes with every raw HTTP integration.

Author Image

Lennart Svensson

April 7, 2026

Blog Illustration Maesn TypeScript SDK

Key Takeaways

  • The SDK replaces raw HTTP calls with typed function calls. Instead of constructing requests manually, you call functions and get typed objects back. Authentication, serialization, error handling, and retries are all handled internally.
  • Complete type safety with Zod validation. Function parameters are fully typed DTOs that show all required and optional fields at a glance. Every response runs through a Zod schema, reducing the risk of unexpected data types reaching your application.
  • Built-in autocompletion and IntelliSense. No need to reference the API documentation for every endpoint. Your IDE shows all available endpoints, parameters, and response shapes as you type.
  • Integrated pagination. No manual offset or cursor logic. Pass page and limit directly in the request and let the SDK handle the rest.
  • Automatic retries for transient errors. Requests that fail with 5xx status codes are retried automatically. No retry logic required on your side.
  • Single client configuration per end user. Create one client instance and reuse it across all API calls for that connection.

Complete Type Safety

Working with a REST API in TypeScript usually means defining your own request and response types, keeping them updated as the API evolves, and hoping that the actual response matches what you expect. The Maesn SDK removes that guesswork.

Every function parameter is a typed DTO that explicitly lists all required and optional fields. When you create an invoice, your IDE shows you the full CreateInvoiceRequestDto with fields like invoiceDate, contactId, currency, lineAmountTypes, and every other parameter the endpoint accepts, each with its correct type.

On the response side, every object returned by the SDK runs through a Zod schema validation. If the response does not match the expected structure, the SDK catches it before your application logic ever sees it. This means fewer runtime surprises, fewer defensive null checks, and less time debugging serialization issues.

Autocompletion and IntelliSense

Switching between your IDE and API documentation for every call slows down development. With the SDK, that context switch disappears.

As you type maesnClient.accounting., your IDE lists every available endpoint. Select a method and the parameter signature appears immediately, showing which fields are required, which are optional, and what types they expect. This works in VS Code, WebStorm, and any editor with TypeScript language server support.

The result: you discover available functionality faster, you make fewer mistakes, and you spend less time reading documentation pages.

Integrated Pagination

Paginated endpoints are a common source of boilerplate. Parsing link headers, tracking cursors, building query strings: all of it adds code that has nothing to do with your actual product logic.

The Maesn SDK handles pagination as simple function parameters. To retrieve the second page of invoices with 10 results per page:

const invoices = await maesnClient.accounting.retrieveInvoices({limit: 10, page: 2})

No offset calculations. No cursor management. No manual query string construction. Just pass the page and limit you need.

Automatic Retries

Transient server errors happen. A 502 from an upstream accounting system, a brief 503 during a deployment window, a timeout on a slow connection. If your integration does not handle these cases, a single intermittent failure can break a sync workflow or surface an error to your end users.

The Maesn SDK retries GET requests that fail with 5xx status codes automatically. You do not need to implement exponential backoff, track attempt counts, or wrap every call in a retry loop. The SDK handles it internally, keeping your code focused on business logic.

Single Client Configuration

Every Maesn API call requires authentication context tied to a specific end-user connection. Without an SDK, you pass headers and tokens on every request. With the SDK, you configure a client once and use it across all subsequent calls for that connection.

One client instance. Multiple calls. No repeated configuration. This keeps your code clean, reduces the risk of misconfigured requests, and makes it straightforward to manage multiple connections in multi-tenant applications.

Currently Available for TypeScript and JavaScript

The SDK is available today for TypeScript and JavaScript projects. It is generated directly from the Maesn OpenAPI specification, which means every new endpoint, parameter, or response field is reflected in the SDK as soon as it ships.

How do I get started?Install the SDK directly from npm, then follow the setup guide in the SDK documentation to configure your first client instance and make your first typed API call.

About the author

Lennart is CTO and Co-Founder of Maesn. With 18 years in the software industry — spanning smartphone OS development, IAM platforms, and enterprise architecture — he holds an M.Sc. in Computer Science from Uppsala University. He founded Maesn to make system integration effortless.

Lennart Svensson

CTO

Frequently asked
questions

You have more questions? We are looking forward hearing from you - book a meeting now!

What is the Maesn TypeScript SDK?

The Maesn TypeScript SDK is a typed client library that wraps the Maesn Unified API. It replaces raw HTTP calls with typed function calls and handles authentication, pagination, retries, and runtime validation out of the box.

Which accounting and ERP systems does the SDK support?

The SDK gives you access to all 30+ accounting and ERP systems available through the Maesn Unified API, including QuickBooks, Xero, Sage, DATEV, weclapp, Bexio, and more, through a single unified interface.

Does the SDK work with JavaScript as well?

Yes. The SDK is available for both TypeScript and JavaScript projects. TypeScript users get the full benefit of typed DTOs and IntelliSense, while JavaScript users benefit from the simplified client interface and built-in error handling.

How does the SDK stay up to date with the API?

The SDK is generated directly from the Maesn OpenAPI specification. Every new endpoint, parameter, or response field is reflected in the SDK as soon as it ships.

Do I need to implement retry logic myself?

No. The SDK automatically retries GET requests that fail with 5xx status codes. You do not need to implement exponential backoff or wrap calls in retry loops.

How does pagination work?

Pass page and limit directly as function parameters. The SDK handles the rest. No offset calculations, cursor management, or manual query string construction required.

How is runtime validation handled?

Every response returned by the SDK runs through a Zod schema. If the response does not match the expected structure, the SDK catches it before your application logic sees it.

How do I get started?

Install the SDK via npm, configure a single client instance with your connection credentials, and start calling typed functions against any supported accounting system.

Kickstart your Integration Journey now