npm Registry API

⭐ Beginner's Pick Development / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

The npm Registry API exposes package metadata for every module published to the npm ecosystem, including version history, author information, download counts, and README content. It requires no authentication for read-only queries and is the same API powering the npmjs.com website. Developers use it to build package search tools, dependency analyzers, and security audit dashboards.

💡

Beginner Tip

No API key or sign-up is required. Fetch metadata for any package by calling https://registry.npmjs.org/{package-name} — for example, https://registry.npmjs.org/lodash. The response is a large document; focus on the "dist-tags.latest" field to get the current version, then look under "versions[latest]" for that version's details.

Available Data

phone number validation
carrier information
country code
line type

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from npm Registry",
    "description": "Query information about your favorite Node.js libraries programatically",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

name The exact npm package name.
description Short description from the package's package.json.
dist-tags.latest The version string of the most recently published stable release.
version Version string of the specific document being viewed (when fetching a single version).
dist.tarball Download URL for the .tgz source tarball of this version.
maintainers List of npm usernames and emails who have publish access to the package.

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://github.com/npm/registry/blob/master/docs/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

404 Not Found The package name does not exist on the registry or is misspelled.
Double-check the exact package name on npmjs.com. Scoped packages need the @ prefix encoded as %40 in the URL, e.g. %40babel%2Fcore.
Response payload too large Popular packages like "react" have thousands of versions, making the full document many megabytes.
Append the version after the package name to fetch just that version: https://registry.npmjs.org/react/18.2.0.
Rate limited or 429 High-frequency automated requests without a delay can trigger rate limiting.
Add a small delay between requests or cache responses locally. For bulk data, use the npm download count API or a mirror service.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 305ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Development
Difficulty Beginner
Verified: 2026-04-07

Similar APIs

View All →