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

api-introspect

v0.13.3

Published

CLI and HTTP client for discovering and calling API procedures via introspection.

Readme

api-introspect

CLI and HTTP client for discovering and calling API procedures via introspection.

Install

npm install -g api-introspect

CLI Usage

# List all procedures
api-introspect http://localhost:3000

# Call a tRPC query
api-introspect http://localhost:3000 user.getById '{"id":1}'

# Call a tRPC mutation
api-introspect http://localhost:3000 user.create '{"name":"Alice"}'

# Call an HTTP endpoint
api-introspect http://localhost:3001 '/user/:id' '{"id":1}'

# With auth header
api-introspect http://localhost:3000 -H "Authorization:Bearer token"

# Disambiguate by HTTP method (for REST APIs with same path, different methods)
api-introspect http://localhost:3001 -X POST /user '{"name":"Alice","email":"[email protected]"}'

# Force output format
api-introspect http://localhost:3000 --summary
api-introspect http://localhost:3000 --full

Options

| Flag | Description | | -------------------------- | ------------------------------------------------- | | -X, --method <METHOD> | HTTP method to disambiguate endpoints (e.g. POST) | | -H, --header <key:value> | Custom header (repeatable) | | --summary | Force summary format | | --full | Force full JSON output | | -h, --help | Show help |

Output auto-selects summary format when there are more than 10 procedures.

Programmatic API

import { callProcedure, fetchIntrospection } from 'api-introspect'

// Discover endpoints
const result = await fetchIntrospection('http://localhost:3000', {
  headers: { Authorization: 'Bearer ...' }, // Optional headers
})

// Call a procedure
const data = await callProcedure('http://localhost:3000', 'user.getById', {
  input: { id: 1 },
  headers: { Authorization: 'Bearer ...' },
})

// Call a HTTP endpoint
const user = await callProcedure('http://localhost:3001', '/user/:id', {
  input: { id: 1 },
})

fetchIntrospection(baseUrl, options?)

Fetches introspection metadata from a server.

| Option | Type | Description | | --------- | ------------------------ | ------------------------------------------------------ | | path | string | Introspection endpoint path (default: '_introspect') | | headers | Record<string, string> | Custom HTTP headers |

callProcedure(baseUrl, procedure, options?)

Calls a tRPC procedure or REST endpoint.

| Option | Type | Description | | --------------- | ------------------------------------------ | --------------------------------------------------- | | type | 'query' \| 'mutation' | Procedure type (auto-detected if omitted) | | method | string | HTTP method to disambiguate same-path endpoints | | input | unknown | Input data | | transformer | 'json' \| 'superjson' \| TransformerLike | Wire format (auto-detected) | | headers | Record<string, string> | Custom HTTP headers | | introspection | IntrospectionResult | Pre-fetched introspection (avoids extra round-trip) |

License

MIT