npm Version API
One published version by exact number or dist-tag, with the tarball, dependencies, scripts and publisher npm recorded for it.
GET /v1/npm/package/version1 credit Failed requests are free
About this endpoint
GET /v1/npm/package/version?name=express&version=5.3.0 returns data.version, a copy of the version document npm stores: name, version, description, license, repository, author, maintainers, publisher, dependencies, devDependencies, peerDependencies, scripts, bin, entrypoints, engines, files, dist and publishedWith.
version accepts an exact version such as 5.3.0, a prerelease such as 5.0.0-alpha.1, or a dist-tag such as latest or latest-4. Semver ranges (^4, 4.x, *) are refused with HTTP 400 because the route promises one version, not a resolution. A version or package that does not exist returns lookupStatus: not_found with data.version: null.
npm Version API FAQ
Can I pass a range such as ^4 or 4.x?
No. The version parameter is an exact version or a dist-tag. Ranges are refused with HTTP 400 instead of resolving to a version, so the answer cannot silently change under you. Use GET /v1/npm/package/versions to see the exact versions.
How do I fetch the latest version?
Use version=latest, or omit version to get the default latest. Any other dist-tag npm stores, such as latest-4, works too. data.version.version tells you the exact version behind the tag.
What does the dist block contain?
tarballUrl, shasum, integrity, fileCount, unpackedSize and the registry signatures, with the legacy PGP block left out. The version document also says whether the version carries a provenance attestation.
What is returned when the version was never published?
HTTP 200 with data.lookupStatus not_found and data.version null. A missing package behaves the same way. Check lookupStatus rather than the HTTP status.
What does the request cost?
Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth.
Other npm endpoints
- PackageGET /v1/npm/package
- Package detailsGET /v1/npm/package/details
- VersionsGET /v1/npm/package/versions
- DownloadsGET /v1/npm/package/downloads
- Downloads by versionGET /v1/npm/package/downloads/versions
- Downloads by nameGET /v1/npm/packages/downloads
- AdvisoriesGET /v1/npm/package/advisories
- ProvenanceGET /v1/npm/package/provenance