@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 Every response follows this TypeScript shape, where
getClient from the package, create a client instance, and call any available method. Every method is async and returns a consistent response shape.T is the typed payload for the specific endpoint: