npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

umami-api-client

v2.17.3

Published

Umami API nodeJS client

Downloads

39

Readme

umami-api-client

NPM

Umami ReST API.

  • compatible with JavaScript.

Note that a typescript compatible API client exists (but deprecated/archived) : cf. https://github.com/jakobbouchard/umami-api-client

UmamiClient

Features

using apiKey:

  • login
  • getSites
  • getStats, getPageViews, getEvents, getMetrics

accepted periods are : 1h, 1d, 7d, 30d, 31d.

Quick start

First, set up your environment :

cp ./env/initenv_cloud.template.sh ./env/initenv_cloud.dontpush.sh
# update ./env/initenv_cloud.dontpush.sh
. ./env/initenv_cloud.dontpush.sh

install umami-api-client

pnpm install umami-api-client
# or
npm install umami-api-client

then let's go, cf. example below.

HowTo use UmamiClient with Umami Cloud server ?

Umami Cloud is "Umami as a service" : cf. https://cloud.umami.is/

Rely on following mandatory variable (setup your own) : UMAMI_CLOUD_API_KEY

NOTE: when an API key is set, the cloud mode is always activated (!) prior to hosted mode. To use hosted mode, you will have to unset UMAMI_CLOUD_API_KEY or use explicit config.

$ node.exe ./tests/manual/cloud_sample.js

import UmamiClient from 'umami-api-client';

const doIt = async () => {
    try {
        const client = new UmamiClient();
        // default is // new UmamiClient({cloudApiKey:process.env.UMAMI_CLOUD_API_KEY});
        const identity = await client.me();
        console.log(`🔑 Api key details:\n${JSON.stringify(identity?.user,null,2)}`);

        const sitesData = await client.websites();
        const filteredSitesData = sitesData.map(({ id, name, createdAt, domain }) => ({ id, name, createdAt, domain }));
        console.log("🗂️ List of Tracked Websites:");
        console.table(filteredSitesData);

        const websiteStats = await client.websiteStats(sitesData[0].id);
        console.log(`📊 Website Stats for: ${sitesData[0].name}`);
        console.table(websiteStats);
    } catch(error) {
        console.error(error);
    }
};

doIt().then(r => {});

HowTo use UmamiClient with an Umami hosted server ?

Umami hosted server is a server with umami product hosted by you or by a company which is not Umami (or for ex. locally using docker).

So a URL is available to query Umami hosted server (aka UMAMI_SERVER). Ex. https://umami.exemple.com

By default, UmamiClient rely on following environment variables : UMAMI_SERVER UMAMI_USER UMAMI_PASSWORD

$ node.exe ./tests/manual/host_sample.js

import UmamiClient from 'umami-api-client';

const doIt = async () => {
    try {
        const client = new UmamiClient();
        // default is // new UmamiClient({server:process.env.UMAMI_SERVER});
        await client.login();
        // default is // client.login(process.env.UMAMI_USER, process.env.UMAMI_PASSWORD)
        const sitesData = await client.websites();
        const filteredSitesData = sitesData.map(({ id, name, createdAt, domain }) => ({ id, name, createdAt, domain }));
        console.log("🗂️ List of Tracked Websites:");
        console.table(filteredSitesData);

        const websiteStats = await client.websiteStats(sitesData[0].id);
        console.log(`📊 Website Stats for: ${sitesData[0].name}`);
        console.table(websiteStats);
    } catch(error) {
        console.error(error);
    }
};

doIt().then(r => {});

Note that relying on environment is not mandatory, you could use explicit config or arguments. ex.

var client = new UmamiClient({server:'umami.exemple.com'});
await client.login("admin","mySecret");

HowTo better understand UmamiClient use ?

You could play mocha tests to get more examples (cf. CONTRIBUTING).

How to contribute

cf. CONTRIBUTING

Services or activated bots

| CI/CD | Automated Release Notes by gren | | | | ---- | ---- | ---- | ---- |

  • Github actions : continuous tests + coverage using c8 reported on github pages website
  • Github security checks activated
  • Houndci : JavaScript automated review (configured by .hound.yml)
  • gren : Release notes automation
  • Github pages website hosts some metrics for the main branch of this project: code coverage