# NPM Package Dependency Tree Analyzer

> NPM Package Dependency Tree Analyzer is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Returns a full dependency tree for an NPM package with counts and version constraints across runtime, dev, peer, and optional dependency categories.

## Facts

- Endpoint: GET https://api.x402node.dev/npm/deps
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x402node-dev-b094ea06
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_LQjBycL_TbaWfeFqFQZq2

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability api-x402node-dev-b094ea06
```

Example prompt: Can you pull the full dependency tree for react version 18.2.0 and tell me the counts broken down by runtime, dev, peer, and optional deps, along with their version constraints?

## When to prefer this

Use this endpoint when you need a structured, categorized breakdown of an npm package's dependencies — especially for dependency auditing, bundle bloat analysis, or understanding peer/optional dependency requirements. Prefer this over manually parsing package.json when you need counts and version constraints in one call without setting up a local npm environment.

## Known failure modes

- Package not found on npm registry — returns error indicating unknown package
- Invalid or non-existent version specified — returns version-not-found error
- Missing required query parameters (package or version) — returns 400 bad request
- Payment not included or invalid — returns 402 Payment Required
- Network timeout fetching registry data — returns 503 or timeout error

## How this service works

Get NPM package dependency tree with counts (runtime, dev, peer, optional) and version constraints. Use ?package=react and version=18.2.0. Built for dependency audit and bundle bloat analysis.

## Output

A structured dependency tree for the specified npm package and version, including categorized counts (runtime, dev, peer, optional) and version constraint strings for each dependency.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "version": {
       "type": "string",
       "description": "Version (optional)"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-x402node-dev-b094ea06/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402node.dev](https://www.zero.xyz/host/api.x402node.dev/llms.txt)
