Skip to main content
The @umami/api-client package is a fully-typed TypeScript client that wraps every Betterumami REST endpoint in a simple function call. Rather than constructing raw HTTP requests, you import a pre-configured client, call the method you need, and get back a typed response object — no boilerplate required. The client works with both Betterumami Cloud and self-hosted instances.
Requirements: Node.js 18.18 or newer.

Setup

1

Install the package

Add @umami/api-client to your project using your preferred package manager.
2

Configure environment variables

The client reads its credentials and target endpoint from environment variables. Which variables you set depends on whether you are using Betterumami Cloud or a self-hosted instance.Betterumami Cloud
Self-hosted instance
3

Call the API

Import getClient from the package, create a client instance, and call any available method. Every method is async and returns a consistent response shape.
Every response follows this TypeScript shape, where T is the typed payload for the specific endpoint:

Function reference

Me

These functions operate on the currently authenticated user.

Websites

These functions let you list, create, update, delete, and query analytics data for websites.

Teams

These functions manage teams and their associated users and websites.

Event data

These functions query custom event data collected by the tracking script.