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

agentref

v5.0.2

Published

Official TypeScript/JavaScript SDK for the AgentRef Affiliate API

Readme

AgentRef Node SDK

Official TypeScript/JavaScript SDK for the AgentRef REST API v1.

Install

npm install agentref

Quickstart

import { AgentRef } from 'agentref'

const client = new AgentRef({ apiKey: 'ak_live_...' })
const programs = await client.programs.list()
console.log(programs.meta.requestId)

Authentication

  • API key is sent as Authorization: Bearer <key>.
  • Supported key prefixes: ak_onb_*, ak_live_*, ak_aff_*.
  • You can pass apiKey directly or use AGENTREF_API_KEY.
  • Default behavior hard-fails in browser contexts to prevent API key exposure.

Resources

  • client.programs
    • list, listAll, get, create, update, delete, stats, listAffiliates, listCoupons, createCoupon, deleteCoupon, listInvites, createInvite, updateMarketplace, connectStripe, disconnectStripe
  • client.affiliates
    • list, get, approve, block, unblock
  • client.conversions
    • list, stats, recent
  • client.payouts
    • list, listPending, stats, create
  • client.flags
    • list, stats, resolve
  • client.billing
    • current, tiers, subscribe
  • client.merchant
    • get, update, getPayoutInfo, updatePayoutInfo, getNotifications, updateNotifications
  • client.webhooks
    • list, create, get, update, delete, rotateSecret

Pagination

List endpoints return:

{
  data: T[]
  meta: {
    total: number
    page: number
    pageSize: number
    hasMore: boolean
    nextCursor?: string
    requestId: string
  }
}

For auto-pagination use listAll(). Stop condition is meta.hasMore === false.

Idempotency

POST methods with server idempotency support accept options?: { idempotencyKey?: string }.

  • If set, Idempotency-Key is sent.
  • Retries for mutating requests are only enabled for POST + idempotencyKey.
  • PATCH/DELETE are never auto-retried.

Error Handling

import { AgentRef, ForbiddenError, NotFoundError, RateLimitError, AgentRefError } from 'agentref'

const client = new AgentRef({ apiKey: 'ak_live_...' })

try {
  await client.programs.get('unknown')
} catch (error) {
  if (error instanceof ForbiddenError) console.log(error.code)
  if (error instanceof NotFoundError) console.log(error.requestId)
  if (error instanceof RateLimitError) console.log(error.retryAfter)
  if (error instanceof AgentRefError) console.log(error.status)
}

Configuration

| Option | Default | Description | |---|---|---| | apiKey | process.env.AGENTREF_API_KEY | API key | | baseUrl | https://www.agentref.co/api/v1 | Base API URL | | timeout | 30000 | Request timeout in ms | | maxRetries | 2 | Retry count for GET/HEAD and POST+idempotencyKey | | dangerouslyAllowBrowser | false | Allows browser initialization (unsafe) |