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

@brewedops-ghl/cli

v0.1.0

Published

GHL CLI - GoHighLevel internal API from the command line (token-id auth, auto-refresh, account audit)

Readme

ghl CLI

GoHighLevel from the command line. Zero dependencies (Node 18+ global fetch). Uses the live-verified universal token-id auth, with Firebase auto-refresh wired in.

Install (developer way)

# published (from anywhere):
npm install -g @brewedops-ghl/cli

# or from this folder (local dev):
cd packs/ghl/cli
npm install -g .     # or: npm link

Requires Node.js 18+. The installed command is ghl (the package is @brewedops-ghl/cli; the command name is separate).

First run

ghl login tokens.json   # paste the Key Grabber JSON (file or stdin)
# Windows:  Get-Clipboard | ghl login
# macOS:    pbpaste | ghl login
ghl whoami              # confirm: company, locations, token expiry

Tokens are stored at ~/.ghl/config.json (mode 0600) — never in any repo.

No Key Grabber extension? Two ways without it

The extension is just a convenience for copying the session token. You don't need it.

Option 1 — Browser DevTools (full CLI, no install). Yields the same session token, so every command works:

  1. Open GHL in the browser, logged in.
  2. Press F12Network tab.
  3. Click around so a request to backend.leadconnectorhq.com appears, click it.
  4. Under Request Headers, copy the token-id value and the authorization: Bearer … value (that's the rs256 token).
  5. Build a small JSON and log in:
    { "tokenId": "<token-id value>", "rs256Bearer": "<bearer value>",
      "locationId": "<sub-account id>", "companyId": "<agency id>" }
    ghl login tokens.json

Option 2 — Private Integration Token (official, nothing to scrape). In the sub-account: Settings → Private Integrations → Create, scope it, copy the token. A PIT is long-lived and needs no browser session. It powers the official v2 / MCP lane (contacts, opportunities, calendars, payments, conversations, locations) — see ../knowledge/v2-mcp-catalog.md. Note: a PIT does not reach the internal-only endpoints (full workflow JSON, email builder, funnel internals); those need a session token (Option 1 or the extension). Full --pit support in this CLI is a planned add.

Use

ghl audit               # full read-only audit of the default location -> markdown
ghl audit <locationId> --out report.md
ghl whoami
ghl fields <locationId> # custom fields
ghl workflows           # workflow list (uses default location)
ghl tags --json
ghl get /locations/<loc>/customValues          # raw GET (backend host)
ghl get /surveys/?locationId=<loc> --services  # raw GET (services host)

Read subcommands: users pipelines workflows fields values tags calendars forms surveys funnels products contacts. loc defaults to the location saved at login; add --json for raw output.

Auto-refresh (retire Key Grabber)

The token from ghl login lasts ~1 hour. To make the CLI self-renewing, capture the refresh token + Firebase key once and enable it:

ghl set-refresh <AMf-refreshToken> <firebaseWebApiKey>

After that, every command checks token expiry and mints a fresh one automatically (securetoken.googleapis.com exchange), and retries once on a 401. No more pasting.

The refresh exchange is standard Firebase but unverified for GHL accounts until we capture a real AMf- token + key. That validation is the make-or-break: if it works, Key Grabber is retired; if not, ghl login per session still beats hourly pasting.

How it maps to the knowledge pack

  • Auth + headers: ../knowledge/auth-and-tokens.md
  • Endpoints + param traps + error catalog: ../knowledge/endpoint-map.md
  • The official MCP alternative (PIT, no token dance): ../knowledge/v2-mcp-catalog.md
  • Design rationale + roadmap: ./DESIGN.md

Files

src/index.mjs     argv parse + dispatch + help
src/config.mjs    ~/.ghl/config.json load/save
src/auth.mjs      JWT decode, expiry, header set, Firebase refresh
src/client.mjs    authenticated GET, refresh-on-expiry, retry-on-401, firstArray()
src/commands.mjs  login, set-refresh, whoami, get, audit, convenience reads