Skip to main content
Install the BosonMail SDK with your preferred package manager. The package is ESM-only and ships with its own TypeScript declarations, so no separate @types package is needed.

Package managers

Requirements

  • Node.js 18 or newer (the SDK uses native fetch, FormData, Blob, and AbortController)
  • ESM module resolution (see TypeScript setup below)
  • A valid BosonMail API key
The SDK has zero runtime dependencies.

TypeScript setup

Because the package is ESM-only, your project must resolve it as an ES module. In tsconfig.json, use one of these combinations:
tsconfig.json
Or, if you are bundling with Vite, esbuild, or a similar tool:
tsconfig.json
For plain Node.js without a bundler, also set "type": "module" in your package.json:
package.json

CommonJS workaround

If your project uses CommonJS (require), dynamically import the default export:
commonjs.cjs

Verify the installation

Create a small script that constructs the client and prints the base URL. If this runs without errors, the package is installed correctly.
verify.ts

Troubleshooting

You are trying to require() an ESM-only package. Switch to import, add "type": "module" to package.json, or use the dynamic import workaround shown above.
Upgrade to Node.js 18 or newer. The SDK relies on the global fetch implementation and does not bundle a polyfill.
Ensure your tsconfig.json uses "moduleResolution": "NodeNext" or "bundler", and that the package is listed in package.json dependencies. Delete node_modules and lockfiles and reinstall if needed.

Next steps

Quickstart

Send your first email in under five minutes.

Authentication

Set up your API key and Bearer token security.