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 🙏

© 2025 – Pkg Stats / Ryan Hefner

systembolaget-api

v1.2.0

Published

## Documentation

Readme

Systembolaget-api

Documentation

In order to consume the API you need to instante a new client. This is done through the exported method newClient from the systembolaget-api package.

Example:

import { newClient } from "systembolaget-api";

const client = await newClient();

It is advised to reuse the same client instance as much as possible, as it caches an API key that is re-fetched for every new client.

Client

The following documentation examples assume you have a client named client instantiated.

searchProducts(options?: SearchProductsOptions) : Promise<SearchResults>

Searches for products with the given options and returns pagination info and a list of products. The follow options are:

  • page: Which page of the search result to get. Default is 0.
  • size: Number of products per page. Default is 30.
  • category: Which product categories to search for. Default is all categories.
  • store: Which store to search for products in. Default is all stores.

Example:

const products = await client.searchProducts({
  category: {
    category: "Beer",
    subCategory: "PorterAndStout",
  },
});

Or if you prefer to not use strings directly the package also exports some constants and objects:

import { BEER_CATEGORY, BeerSubCategories } from "systembolaget-api";

const { products, pagination } = await client.searchProducts({
  category: {
    category: BEER_CATEGORY,
    subCategory: BeerSubCategories.PorterAndStout,
  },
});

getStores() : Promise<Store[]>

Gets a list of all stores.

Example:

const stores = await client.getStores();

getStockBalance(productId: string, storeId: string) : Promise<StockBalanceForStore>

Gets stock balance for the given product in the given store.

Example:

const stockBalance = await client.getStockBalance("1060903", "1411");

searchProductsInStore(productId: string, storeId: string) : Promise<SearchProductWithStock>

A specialized version of searchProducts that searches for products in stock in a given store. Differs from searchProducts with storeId option as this does an additional request to fetch stock balance for each matched product.

Example:

const searchOptions = {
  category: {
    category: BEER_CATEGORY,
    subCategory: BeerSubCategories.PorterAndStout,
  },
};

const { productsInStore, pagination } = await client.searchProductsInStore(
  "1411",
  searchOptions
);

Types

SearchProductsOptions

type SearchProductsOptions = {
  page?: number; // Which page in the search result to get. Default is 0.
  size?: number; // Number of products per page. Default is 30.
  category?: CategoryOptions; // Which product categories to search for.
  store?: string; // Which store to search for products in
};

SearchResults

type SearchResults = {
  products: SearchProduct[];
  pagination: Pagination;
};

SearchResultsWithStock

type SearchResultsWithStock = {
  products: SearchProductWithStock[];
  pagination: Pagination;
};

SearchProduct

type SearchProduct = {
  productId: string;
  productName: string;
  productNumber: string;
  brewery: string;
  country: string;
  price: number;
  abv: number;
  volume: {
    value: number;
    unit: string;
    formattedString: string;
  };
  category: string;
  subCategory: string | null;
};

SearchProductWithStock

type SearchProductWithStock = SearchProduct & StockBalanceForStore;

Pagination

type Pagination = {
  currentPage: number;
  prevPage: number;
  nextPage: number;
  totalPages: number;
  pageSize: number;
};

Store

type Store = {
  storeId: string;
  storeName: string;
  streetAddress: string;
  county: string;
  city: string;
  position: {
    latitude: number;
    longitude: number;
  };
};

StockBalanceForStore

type StockBalanceForStore = {
  productId: string;
  storeId: string;
  shelf: string | null;
  stock: number;
  isInStoreAssortment: boolean;
};

CategoryOptions

type CategoryOptions =
  | {
      category: "Beer";
      subCategory:
        | "Ale"
        | "DarkLager"
        | "Lager"
        | "PorterAndStout"
        | "Wheat"
        | "Sour"
        | "Other";
    }
  | {
      category: "Wine";
      subCategory:
        | "RedWine"
        | "WhiteWine"
        | "SparklingWine"
        | "RoseWine"
        | "WineBox"
        | "FortifiedWine"
        | "FlavoredAndFruitWine"
        | "MulledWine"
        | "Vermouth"
        | "Sake"
        | "Aperitivo";
    }
  | {
      category: "Liquor";
      subCategory:
        | "Whisky"
        | "Liqueur"
        | "Gin"
        | "Aquavit"
        | "Cognac"
        | "Rum"
        | "Vodka"
        | "Grappa"
        | "Tequila"
        | "ArmagnacAndBrandy"
        | "FlavoredLiquor"
        | "FruitLiquor"
        | "Bitter"
        | "Calvados"
        | "DrinksAndCocktails"
        | "AniseLiquor"
        | "Punch"
        | "MixedSet"
        | "Aperitivo";
    }
  | {
      category: "CiderAndMixedDrinks";
      subCategory: "Cider" | "MixedDrinks";
    }
  | {
      category: "AlcoholFree";
      subCategory:
        | "Beer"
        | "Sparkling"
        | "CiderAndMixedDrinks"
        | "MulledWineAndChristmasDrinks"
        | "Must"
        | "DrinksAndCocktails"
        | "RedWine"
        | "WhiteWine"
        | "Rose"
        | "Avec"
        | "Schnaps";
    };