The npm registry API: package data without the CLI

npm's public registry is itself a JSON API: registry.npmjs.org/react returns every version, and registry.npmjs.org/react/latest returns just the latest manifest with licence and dependencies. Download counts come from a separate service, api.npmjs.org/downloads/point/last-week/react, and search is at registry.npmjs.org/-/v1/search. Our npm Package API calls all three and returns one summary (version, licence, weekly downloads, dependency count, maintainers, last publish, deprecation) for $0.002.

Try it free npm Package API — version, downloads, licence, $0.002 · $0.002 / call

The endpoints

Scoped packages need the slash encoded: @types/node becomes @types%2Fnode. The full document for a popular package can be several megabytes, so fetch /latest when that's all you need.

WhatURL
All versions and metadatahttps://registry.npmjs.org/{name}
Latest version manifesthttps://registry.npmjs.org/{name}/latest
Weekly downloadshttps://api.npmjs.org/downloads/point/last-week/{name}
Searchhttps://registry.npmjs.org/-/v1/search?text={words}&size=20

In JavaScript

const name = "@types/node";
const path = name.replace("/", "%2F");
const [latest, dl] = await Promise.all([
  fetch("https://registry.npmjs.org/" + path + "/latest").then((r) => r.json()),
  fetch("https://api.npmjs.org/downloads/point/last-week/" + path).then((r) => r.json()),
]);
console.log(latest.version, latest.license, Object.keys(latest.dependencies ?? {}).length, dl.downloads);

What developers check before installing

One call for coding agents

An agent choosing a package needs those five answers, not a 5 MB document. Our npm Package API returns name, version, description, license, deprecated, weekly_downloads with the period, dependencies, peer_dependencies, maintainers, last_publish, has_types, module_type, node_engines and links. It's $0.002 per call via x402 (USDC on Base), and a package that doesn't exist isn't charged.

It isn't a security audit: run npm audit, Socket or similar for known vulnerabilities and malware. Figures are for the latest version only.

curl -i -X POST https://iamai.markets/api/x402/services/GY0PTcJIsqJQ \
  -H "Content-Type: application/json" \
  -d '{"name": "react"}'

The product

Questions

Does the npm registry API need a key?

Not for reading public packages. Tokens are only needed to publish or to read private packages.

Is there a rate limit?

npm doesn't publish a fixed number for reads, but heavy scripts get throttled. Cache results and fetch /latest instead of full documents.

Can I get downloads for a date range?

Yes: api.npmjs.org/downloads/range/2026-01-01:2026-06-30/{name}. Our API returns last week only.

Related

Updated 2026-12-02