npm Registry API

Beginner's Pick Development / No Auth Required Beginner HTTPS
Free to Use
74 B
Measured Score 0 50 100 Speed 25/30 Consistency 8/20 Security 18/20 Browser access 15/15 Transparency 8/15 TESTED 2026-08-10

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.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://registry.npmjs.org/lodash/latest
Result
HTTP 200 · application/json · 1,669 bytes · compressed
Response time
44 ms (median of 3) · fastest 33 ms
Transport
TLSv1.2 · ECDHE-ECDSA-AES128-GCM-SHA256 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
cloudflare
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
bugs object {1 fields}
dist object {6 fields}
icon string (url) https://lodash.com/icon.svg
main string lodash.js
name string lodash
author object {2 fields}
gitHead string 4f0b76e2eca13de1c1fe8b4305abc1f7d63f4b86
license string MIT
scripts object {1 fields}
_npmUser object {2 fields}
homepage string (url) https://lodash.com/
keywords array [1 item]
repository object {2 fields}
_npmVersion string 10.9.4

Captured Response

Captured from a real request to https://registry.npmjs.org/lodash/latest on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "bugs": {
    "url": "https://github.com/lodash/lodash/issues"
  },
  "dist": {
    "shasum": "ff2b66c1f6326d59513de2407bf881439812771c",
    "tarball": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
    "fileCount": 1051,
    "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
    "signatures": [
      {
        "…": "(2 more fields)"
      }
    ],
    "unpackedSize": 1413741
  },
  "icon": "https://lodash.com/icon.svg",
  "main": "lodash.js",
  "name": "lodash",
  "author": {
    "name": "John-David Dalton",
    "email": "[email protected]"
  },
  "gitHead": "4f0b76e2eca13de1c1fe8b4305abc1f7d63f4b86",
  "license": "MIT",
  "scripts": {
    "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\""
  },
  "_npmUser": {
    "name": "jdalton",
    "email": "[email protected]"
  },
  "homepage": "https://lodash.com/",
  "keywords": [
    "modules"
  ],
  "repository": {
    "url": "git+https://github.com/lodash/lodash.git",
    "type": "git"
  },
  "_npmVersion": "10.9.4",
  "…": "(9 more fields)"
}

Field Reference

name The exact npm package name.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
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.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist application/json
{
  "code": "ResourceNotFound",
  "message": "/lodash/latest/apisscore-nonexistent-path does not exist"
}

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

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.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 25/30
Consistency 8/20
Security 18/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 44ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Development
Difficulty Beginner
Endpoint last called: 2026-08-10

Related Tags

Similar APIs

View All →