API Directory › 🛠️ Developer Tools › npm Registry
No authHTTPSCORS

npm Registry API

Query npm package metadata, versions and download stats.

Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open npm Registry docs ↗

What it does

The public npm registry is a read API for JavaScript package metadata: full version history, dependencies, maintainers, dist-tags, tarball URLs and README for any published package, plus a search endpoint and (on a separate host) download-count statistics.

Base URL

https://registry.npmjs.org

Authentication

None for public reads. A token is only needed to publish or to read private packages. Send a User-Agent identifying your tool.

Code examples

curl
# Full metadata (the "packument")
curl -s https://registry.npmjs.org/react | head -c 300

# One version only
curl -s https://registry.npmjs.org/react/18.3.1

# Weekly downloads (different host)
curl -s https://api.npmjs.org/downloads/point/last-week/react
Python
import requests

p = requests.get("https://registry.npmjs.org/express", timeout=10).json()
latest = p["dist-tags"]["latest"]
print(latest, p["versions"][latest]["dependencies"])

Rate limits & quotas

No formal published rate limit, but the registry is CDN-fronted and abusive traffic gets blocked — cache aggressively, request one package at a time, and prefer the abbreviated metadata document (send Accept: application/vnd.npm.install-v1+json) when you don’t need every field. The downloads API on api.npmjs.org allows date ranges up to 18 months and bulk queries of up to 128 packages.

Key response fields

dist-tags.latestCurrent published version
versionsObject keyed by version number, each with full package.json
versions[v].dist.tarballDownload URL for that version’s tarball
timePublish timestamp per version, plus created/modified
maintainersPublishers with access

Common errors

404Package name does not exist (or is a private/unpublished name).
429 / 403You are being rate-limited or blocked for hammering the CDN — back off and cache.
405You tried a write method without auth.

When to use it (and alternatives)

Use it to build dependency dashboards, license/security scanners, ‘is this package maintained?’ checks, or version badges. For the equivalent in other ecosystems: PyPI’s JSON API, crates.io, and Packagist all follow the same idea.

FAQ

How do I get download counts?

Use the separate host: https://api.npmjs.org/downloads/point/last-week/<package> for a total, or /downloads/range/ for a daily series. Scoped packages need URL-encoding of the /.

The metadata document is huge — can I get a smaller one?

Yes. Send Accept: application/vnd.npm.install-v1+json for the abbreviated packument, which drops fields npm doesn’t need at install time and is much smaller for popular packages.

Is there an official rate limit?

npm does not publish one for reads, but it will throttle or block clients that generate excessive traffic. Treat it as a shared resource: cache, and don’t crawl the whole registry.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

JSON FormatterJWT DecoderBase64

Related Developer Tools APIs

← Back

More Developer Tools APIs · All 196 APIs