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

allegro-rest-client

v1.1.1

Published

Allegro Rest Client wrapper, for managing auctions and allegro.pl resources

Readme

allegro-rest-client

Allegro REST API client for managing allegro.pl auctions with ease using node.

Getting Started

This library provides simple wrapper for managing allegro rest api resources according to docs

Prerequisites

Registration new app here. You have to choose between two types of app:

Installation:

yarn add allegro-rest-client
# or
npm install allegro-rest-client

Usage

Following example shows, how to import and use library to fetch allegro categories

import { AllegroRestClient, ClientConfig, ClientOptions } from 'allegro-rest-client'

const config: ClientConfig = {
  app_name: 'rest-client-device', // registered app name
  type: 'device', // or web
  client_id: 'f070c07c4d814b0c8f45f596bf654936',
  client_secret: 'cpbqO3WtsLpyQ4V9RTauaSx0G1rb8S762fZdLYoA7VDAzFvhFrsfvJJIbqMAjyMs',
}
const options: ClientOptions = {
  account: 'allegro-account', // default
  sandbox: true, // false
  logger: true, // false
  storage: {
    // api for storing auth tokens
    async set(account: string, tokens: any) {
      storeApi.save(account, tokens)
    },
    async get(account: string) {
      return storeApi.get(account)
    },
  },
}
try {
  const allegroClient = await AllegroRestClient(config, options)
  const { verification_uri_complete, device_code } = await allegroClient.bindApp()
  // open given url - verification_uri_complete and associate app
  console.log({ verification_uri_complete, device_code })

  await allegroClient.authorize(device_code)

  const { categories } = await allegroClient.get('/sale/categories')
  console.log(categories)
} catch (err) {
  console.error(err)
}

config - holds registered app credentials options - comprises:

  • account: allegro account name used by AllegroRestClient instance
  • sandbox: boolean if use app from allegro sandbox
  • logger: boolean if logging requests info
  • storage: object with set and get methods for storing app credentials per account

Authorizing app via 'device' type is preffered way - after calling bindApp method, you need visit and authorize app from 'verification_uri_complete' url, and call authorize method with obtained device_code along with verification_uri_complete.

What library do:

  • refresh tokens every 12 hours
  • wraps client to call resources from docs
  • passes default 'Authorization' header for all requests and 'Accept' application/vnd.allegro.public.v1+json (for some resources you need different Content-Type - check docs)
  • allows to call allegro.pl resources via request module

Examples:

// ...
const { categories } = await allegroClient.get('/sale/categories')
const { offers, count, totalCount } = await allegroClient.get('/sale/offers')
const { id: offerId, validation, ...offer } = await allegroClient.post('/sale/offers', {
  body: JSON.stringify({
    name: 'Test offer',
  }),
}) // draft offer, 'validation.errors' contains array of missing offer data
const publishedOffer = await allegroClient.put(`/sale/offers/${offerId}`) // complete draft offer and publish
const { rates } = await allegroClient.get(`/sale/offers/${offerId}/shipping-rates`, {
  headers: {
    Accept: 'application/vnd.allegro.beta.v1+json',
  },
})

Future plans

  • replace deprecated request module (axios or bent)
  • ...

License

This project is licensed under the MIT License - see the LICENSE file for details