BYTETOOLS

unpkg API

Free unpkg CDN with no key: fetch any file from any npm package by URL, including package.json, with version ranges and directory listings. Tested example.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-20

What is the unpkg API?

unpkg is a free, key-free CDN that serves any file from any package published to npm, addressable by package name, version range and file path — including package.json for metadata lookups.

unpkg's model is elegantly simple: `unpkg.com/package@version/path/to/file` returns that exact file. That makes it both a script CDN and, incidentally, a way to read any file inside a published package without installing it.

Version ranges work in the URL, so `react@18` resolves to the latest 18.x. Convenient for development, but pin exact versions in production — a floating range means your dependency can change without any action from you.

Quick facts

Base URL
https://unpkg.com
Authentication
No API key required.
Rate limit
No published limit; globally CDN-cached.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the unpkg API

Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.

1. Read a package.json from npm

GET https://unpkg.com/react@18.2.0/package.json

curl
curl 'https://unpkg.com/react@18.2.0/package.json'
JavaScript (fetch)
const res = await fetch("https://unpkg.com/react@18.2.0/package.json");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://unpkg.com/react@18.2.0/package.json", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "name": "react",
  "description": "React is a JavaScript library for building user interfaces.",
  "keywords": [
    "react"
  ],
  "version": "18.2.0",
  "homepage": "https://reactjs.org/",
  "bugs": "https://github.com/facebook/react/issues",
  "license": "MIT",
  "files": [
    "LICENSE",
    "README.md",
    "index.js",
    "cjs/",
    "umd/",
    "jsx-runtime.js",
    "jsx-dev-runtime.js",
    "react.shared-subset.js"
  ],
  "main": "index.js",
  "exports": {
    ".": {
      "react-server": "./react.shared-subset.js",
      "default": "./index.js"
    },
    "./package.json": "./package.json",
    "./jsx-runtime": "./jsx-runtime.js",
    "./jsx-dev-runtime": "./jsx-dev-runtime.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/facebook/react.git",
    "directory": "packages/react"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "dependencies": {
    "loose-envify": "^1.1.0"
  },
  "browserify": {
    "transform": [
      "loose-envify"
    ]
  }
}

Parameters

ParameterTypeRequiredDescription
<package>@<version>/<file>pathRequiredPackage, version or range, and file path. react@18.2.0/package.json
?metaqueryOptionalReturn directory metadata as JSON instead of the file. ?meta
?modulequeryOptionalRewrite bare imports to unpkg URLs for native ES modules. ?module

Response fields

(file contents)any
The response is the raw file — JSON, JavaScript, CSS or anything else in the package.
(?meta) type / filesobject
With ?meta, a directory listing with file sizes and integrity hashes.

What you can build with the unpkg API

  • Load a library from a CDN without a build step
  • Read a package's package.json or README without installing it
  • Inspect what files a published package actually ships
  • Serve ES modules directly to the browser with ?module

Common errors and how to fix them

404

The file does not exist in that package version.

Fix: Use ?meta on the package root to list what the package actually ships.

Version range resolved unexpectedly

Ranges like @18 float to the newest matching release.

Fix: Pin exact versions in production so behaviour cannot change without a deploy.

Large file downloads

Some packages ship huge bundles.

Fix: Request the specific file you need rather than the package root.

unpkg API — frequently asked questions

Is unpkg free?

Yes, completely free with no API key. It is a community CDN serving anything published to npm.

Can I read a package's files without installing it?

Yes — that is a useful side effect. Request any path inside the package, or add ?meta to list its contents.

Should I use version ranges in production?

No. Ranges like @18 resolve to the newest matching release, so your dependency can change without warning. Pin exact versions.

What does ?module do?

It rewrites bare import specifiers to unpkg URLs, so a package's ES module build can be loaded directly in a browser without a bundler.

Tools that pair with this API

unpkg is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.