cdnjs API
Free cdnjs API with no key: search 4,000+ front-end libraries, get versions, file listings and SRI hashes for secure script tags. Tested curl example.
Endpoint tested and returned HTTP 200 on 2026-08-20
What is the cdnjs API?
The cdnjs API is a free, key-free API for the cdnjs content delivery network, providing metadata for over 4,000 front-end libraries including every version, the files each ships and Subresource Integrity hashes.
cdnjs is one of the oldest and most widely used front-end CDNs, and its API exposes the full library catalogue — useful for building version pickers, checking for updates, or discovering what a library actually ships.
The SRI hashes are the security-relevant part. Including an integrity attribute on a CDN script tag means the browser refuses to execute the file if it has been tampered with, and cdnjs provides those hashes directly so you do not have to compute them.
Quick facts
- Base URL
https://api.cdnjs.com- Authentication
- No API key required.
- Rate limit
- No published hard limit; CDN-backed.
- Pricing
- Free and open source, operated by Cloudflare.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the cdnjs 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. Fetch metadata for a library
GET https://api.cdnjs.com/libraries/jquery?fields=name,version,description
curl 'https://api.cdnjs.com/libraries/jquery?fields=name,version,description'const res = await fetch("https://api.cdnjs.com/libraries/jquery?fields=name,version,description");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://api.cdnjs.com/libraries/jquery?fields=name,version,description", timeout=20)
res.raise_for_status()
print(res.json()){
"name": "jquery",
"description": "JavaScript library for DOM operations",
"version": "4.0.0"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
libraries/<name> | path | Optional | Metadata for one library. libraries/jquery |
libraries | path | Optional | Search or list libraries. libraries?search=chart |
fields | string | Optional | Comma-separated fields to return — responses are huge without it. name,version,description |
search | string | Optional | Search term. chart |
Response fields
namestring- Library name.
versionstring- Latest version available.
descriptionstring- Library description.
homepage / repositorystring- Project links.
licensestring- Licence identifier.
assetsarray- Every version with its file list and SRI hashes.
sriobject- Subresource Integrity hashes keyed by filename.
What you can build with the cdnjs API
- Build a CDN script tag generator with integrity hashes
- Check whether a front-end library has a newer version
- Discover which files a library ships before including one
- Search available libraries from a build tool
Common errors and how to fix them
Enormous response
Without `fields`, every version and file is returned.
Fix: Always pass fields= with just what you need; jQuery's full record is megabytes.
404
Library name not found.
Fix: cdnjs names do not always match npm names; use the search endpoint first.
Missing SRI hash
Older versions predate SRI generation.
Fix: Fall back to omitting the integrity attribute, or pick a newer version.
cdnjs API — frequently asked questions
Is the cdnjs API free?
Yes, completely free with no API key. cdnjs is operated by Cloudflare as a community service.
What is an SRI hash and why does it matter?
A Subresource Integrity hash lets the browser verify a CDN file has not been tampered with, refusing to execute it if the content changed. cdnjs provides these so you can add integrity attributes to script tags.
Why is the response so large?
By default it returns every version with every file. Always use the `fields` parameter to request only what you need.
Do cdnjs names match npm names?
Usually but not always. Use the search endpoint to resolve a name before assuming the npm package name works.
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.
SHA-256 Hash Generator
Generate SHA-256 hashes of text or files with the browser's Web Crypto API. 64-character hex digest, uppercase option, instant copy. Free and private.
cdnjs 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.