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

@geobadges/badgr-api-client

v0.12.0

Published

API Client for Accessing a Badgr Server

Readme

badgr-api-client

API Client for Accessing a Badgr Server

install

npm install @geobadges/badgr-api-client

contributing

Your contributions are welcomed! This repo is open to issues and pull requests.

usage

initialization

const API = require("@geobadges/badgr-api-client");

const client = new API({ endpoint, password, username });

get access token

const {
    accessToken,
    expirationDate,
    refreshToken
} = await client.getAccessToken();
// accessToken is asdfasdyfbasbdif6basdf

get a specific badge

const entityId = '12asd8f7glasi8df7'; // badge id
const fields = ['name', 'entityId', 'criteriaNarrative', 'tags'];
const badge = await api.getBadge({
    entityId,
    fields
})

register a user

const data = {
    agreedToTermsOfService: true,
    email: "[email protected]",
    firstName: "First Name",
    lastName: "Last Name",
    optedInToMarketing: false,
    password: "acomplexpassword",
};
const sucessful = await client.register(data);
// sucessful is true

request a password reset

const data = {
    email: "[email protected]"
};
const successful = await client.requestPasswordReset(data);
// successful is true if HTTP request, requesting a reset, returned successfully

get a specific user

If you don't supply an entityId, it automatically returns the user that you used to initialize the api client.

/*
    The following fields are available:
    entityType, entityId, firstName, lastName, emails, url,
    telephone, agreedTermsVersion, hasAgreedToLatestTermsVersion,
    marketingOptIn, badgrDomain, hasPasswordSet, and recipient
*/
const fields = ['emails', 'entityId', 'firstName', 'lastName'];
const user = await api.getUser({
    entityId,
    fields
})

get assertions/claims to a badge

const entityId = '12asd8f7glasi8df7'; // badge id
const fields = ['entityId', 'recipient']; // fields to include in return
const assertions = await client.getBadgeAssertions({ entityId, fields });

get all badges

const fields = ['entityId', 'name', 'description']; // fields to include in return
const badges = await client.getBadgeClasses({ fields });

get available issuers

This returns issuers that the current authenticated user has access to unless you pass in an accessToken

const fields = ['entityId', 'name'];
const issuers = await client.getIssuers({ fields });
// an array of issuer objects

get issuer details

const entityId = '12378t12uy3gkj1h2b31';
const fields = ['entityId', 'name'];
const issuer = await client.getIssuer({ entityId, fields });

get backpack

const fields = ['entityId', 'image'];
const badges = await client.getBackpack({ fields });
// badges is an array of badges

grant a badge to a user

const status = await client.grant({
    badgeClassEntityId: "asl8dyb712tyev6tvdsafasdf",
    createNotification: false,
    email: "[email protected]",
    evidence = [],
    issuerEntityId: "adsfiubashfv7asgdfasdf",
    narrative = "This person earned the badge by creating a JavaScript Notebook that..."
})

enable admin access

Passing in admin: true will basically add the rw:serverAdmin scope to all requests.

const client = new API({ endpoint, password, username, admin: true });

support

Email the package author at [email protected] or post an issue at https://github.com/GeoBadges/badgr-api-client