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.
Endpoint tested and returned HTTP 200 on 20 Aug 2026
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 20 Aug 2026, 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 'https://unpkg.com/react@18.2.0/package.json'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);import requests
res = requests.get("https://unpkg.com/react@18.2.0/package.json", timeout=20)
res.raise_for_status()
print(res.json()){
"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
| Parameter | Type | Required | Description |
|---|---|---|---|
<package>@<version>/<file> | path | Required | Package, version or range, and file path. react@18.2.0/package.json |
?meta | query | Optional | Return directory metadata as JSON instead of the file. ?meta |
?module | query | Optional | Rewrite 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
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
JSON Validator
Free online JSON validator: validate JSON and find syntax errors with the exact line and column. See root type, key counts and depth — instant and 100% private.
Alternatives to unpkg API
If unpkg does not fit, these developer & testing apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| GitHub REST API | GitHub REST API with no key for public data: repository details, users, issues, releases and commits. 60 req/hour unauthenticated, 5,000 with a token. | No key | Yes | 19 Aug 2026 |
| JSONPlaceholder | Free fake REST API for testing and prototyping. Posts, comments, users and todos with full GET, POST, PUT and DELETE support. No key. Real curl examples. | No key | Yes | 19 Aug 2026 |
| Postman Echo | Postman Echo reflects your HTTP request back as JSON: headers, body, query params and auth. Free, no key, ideal for debugging clients. Real POST example. | No key | No | 19 Aug 2026 |
| DummyJSON | Free fake REST API with realistic products, users, carts, recipes and auth. Supports search, pagination, sorting and POST. No key. Tested GET and POST examples. | No key | Yes | 19 Aug 2026 |
| UUID Tools API | Free UUID generator API with no key. Generate v1, v3, v4 and v5 UUIDs in bulk over HTTP. Tested curl example, live response and guidance on when to use it. | No key | Yes | 19 Aug 2026 |
| Vector Express | Convert between SVG, DXF, DWG, EPS, PDF, AI, CDR, HPGL and more over HTTP with no key. Query the converter matrix first to find a valid conversion path. | No key | No | 21 Aug 2026 |
unpkg is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 20 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.