You can query cdnjs via our API as below
Without any query parameters it will return the name and main file URL of every library on cdnjs:
https://api.cdnjs.com/libraries
To search, use:
https://api.cdnjs.com/libraries?search=[query]
You can also "select" a certain library if you already know its name on CDNJS, e.g.
https://api.cdnjs.com/libraries/[name]
Without any query parameters it will return the whole meta data of the library, if you want to specify the info you want (recommended), use "fields" query:
https://api.cdnjs.com/libraries/jquery?fields=name,filename,version
All the usable fields is the same as the library's package.json on
CDNJS
(except auto-update config, we'll only return the auto-update type (currently npm or git
)
API will return minified result by default, if you wanna have a human readable result, try
output=human
like so:
https://api.cdnjs.com/libraries?output=human
https://api.cdnjs.com/libraries?search=[query]?output=human
If you would like more data, use the fields parameter which takes comma-separated values:
https://api.cdnjs.com/libraries?search=[query]&fields;=version,description
To get a list of all files for that library, use the assets field:
https://api.cdnjs.com/libraries?search=[query]&fields;=assets
Other fields available are:
version
description
homepage
keywords
license
repository
autoupdate
author
assets
{"results":[{"name":"1140","latest":"https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.min.css"},{"name":"1000hz-bootstrap-validator","latest":"https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.6/validator.min.js"},{"name":"10up-sanitize.css","latest":"https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/4.1.0/sanitize.min.css"},{"name":"16pixels","latest":"https://cdnjs.cloudflare.com/ajax/libs/16pixels/0.1.8/16pixels.min.css"},
{
"results": [
{
"name": "1140",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.min.css"
},
{
"name": "1000hz-bootstrap-validator",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.8/validator.min.js"
},
{
"name": "10up-sanitize.css",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/4.1.0/sanitize.min.css"
},
{
"name": "16pixels",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/16pixels/0.1.8/16pixels.min.css"
},
{"name":"jquery","filename":"jquery.min.js","version":"3.1.1","description":"JavaScript library for DOM operations","homepage":"http://jquery.com/","keywords":["jquery","library","ajax","framework","toolkit","popular"],"namespace":"jQuery","repository":{"type":"git","url":"https://github.com/jquery/jquery.git"},"license":"MIT","author":{"name":"jQuery Foundation and other contributors","url":"https://github.com/jquery/jquery/blob/master/AUTHORS.txt"},"autoupdate":{"type":"npm","target":"jquery"},"assets":[{"version":"3.1.1","files":["core.js","jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"3.1.0","files":["core.js","jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"3.0.0-rc1","files":["core.js","jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"3.0.0-beta1","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"3.0.0-alpha1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"3.0.0","files":["core.js","jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"2.2.4","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.2.3","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"2.2.2","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"2.2.1","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"2.2.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.4","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.3","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.1-rc2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.1-rc1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.1-beta1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.0-rc1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.0-beta3","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.0-beta2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.1.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.0.3","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.0.2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.0.1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"2.0.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.12.4","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.12.3","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"1.12.2","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"1.12.1","files":["jquery.js","jquery.min.js","jquery.min.map","jquery.slim.js","jquery.slim.min.js","jquery.slim.min.map"]},{"version":"1.12.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.3","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.1-rc2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.1-rc1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.1-beta1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.0-rc1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.0-beta3","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.11.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.10.2","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.10.1","files":["jquery.js","jquery.min.js","jquery.min.map","themes/base/images/animated-overlay.gif","themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png","themes/base/images/ui-bg_flat_75_ffffff_40x100.png","themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png","themes/base/images/ui-bg_glass_65_ffffff_1x400.png","themes/base/images/ui-bg_glass_75_dadada_1x400.png","themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png","themes/base/images/ui-bg_glass_95_fef1ec_1x400.png","themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png","themes/base/images/ui-icons_222222_256x240.png","themes/base/images/ui-icons_2e83ff_256x240.png","themes/base/images/ui-icons_454545_256x240.png","themes/base/images/ui-icons_888888_256x240.png","themes/base/images/ui-icons_cd0a0a_256x240.png","themes/base/jquery.ui.accordion.css","themes/base/jquery.ui.accordion.min.css","themes/base/jquery.ui.all.css","themes/base/jquery.ui.all.min.css","themes/base/jquery.ui.autocomplete.css","themes/base/jquery.ui.autocomplete.min.css","themes/base/jquery.ui.base.css","themes/base/jquery.ui.base.min.css","themes/base/jquery.ui.button.css","themes/base/jquery.ui.button.min.css","themes/base/jquery.ui.core.css","themes/base/jquery.ui.core.min.css","themes/base/jquery.ui.datepicker.css","themes/base/jquery.ui.datepicker.min.css","themes/base/jquery.ui.dialog.css","themes/base/jquery.ui.dialog.min.css","themes/base/jquery.ui.menu.css","themes/base/jquery.ui.menu.min.css","themes/base/jquery.ui.progressbar.css","themes/base/jquery.ui.progressbar.min.css","themes/base/jquery.ui.resizable.css","themes/base/jquery.ui.resizable.min.css","themes/base/jquery.ui.selectable.css","themes/base/jquery.ui.selectable.min.css","themes/base/jquery.ui.slider.css","themes/base/jquery.ui.slider.min.css","themes/base/jquery.ui.spinner.css","themes/base/jquery.ui.spinner.min.css","themes/base/jquery.ui.tabs.css","themes/base/jquery.ui.tabs.min.css","themes/base/jquery.ui.theme.css","themes/base/jquery.ui.theme.min.css","themes/base/jquery.ui.tooltip.css","themes/base/jquery.ui.tooltip.min.css"]},{"version":"1.10.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.9.1","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.9.0","files":["jquery.js","jquery.min.js","jquery.min.map"]},{"version":"1.8.3","files":["jquery.js","jquery.min.js"]},{"version":"1.8.2","files":["jquery.js","jquery.min.js"]},{"version":"1.8.1","files":["jquery.js","jquery.min.js"]},{"version":"1.8.0","files":["jquery-1.8.0.js","jquery-1.8.0.min.js","jquery.js","jquery.min.js"]},{"version":"1.7.2","files":["jquery.min.js"]},{"version":"1.7.1","files":["jquery.min.js"]},{"version":"1.7","files":["jquery.min.js"]},{"version":"1.6.4","files":["jquery.js","jquery.min.js"]},{"version":"1.6.3","files":["jquery.js","jquery.min.js"]},{"version":"1.6.2","files":["jquery.js","jquery.min.js"]},{"version":"1.6.1","files":["jquery.js","jquery.min.js"]},{"version":"1.5.1","files":["jquery.js","jquery.min.js"]},{"version":"1.4.4","files":["jquery.js","jquery.min.js"]},{"version":"1.4.3","files":["jquery.js","jquery.min.js"]},{"version":"1.4.2","files":["jquery.js","jquery.min.js"]},{"version":"1.4.1","files":["jquery.js","jquery.min.js"]},{"version":"1.4.0","files":["jquery.js","jquery.min.js"]},{"version":"1.3.2","files":["jquery.js","jquery.min.js"]},{"version":"1.3.1","files":["jquery.js","jquery.min.js"]},{"version":"1.3.0","files":["jquery.js","jquery.min.js"]},{"version":"1.2.6","files":["jquery.js","jquery.min.js"]},{"version":"1.2.3","files":["jquery.js","jquery.min.js"]}]}
{"results":[{"name":"ractive","latest":"https://cdnjs.cloudflare.com/ajax/libs/ractive/0.8.5/ractive.min.js"},{"name":"ractive.js","latest":"https://cdnjs.cloudflare.com/ajax/libs/ractive.js/0.3.7/ractive.min.js"},{"name":"ractive-require","latest":"https://cdnjs.cloudflare.com/ajax/libs/ractive-require/0.6.12/ractive-require.min.js"}],"total":3}
{
"results": [
{
"name": "ractive",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/ractive/0.8.5/ractive.min.js"
},
{
"name": "ractive.js",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/ractive.js/0.3.7/ractive.min.js"
},
{
"name": "ractive-require",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/ractive-require/0.6.12/ractive-require.min.js"
}
],
"total": 3
}
Search with specific fields{"results":[{"name":"ractive","latest":"https://cdnjs.cloudflare.com/ajax/libs/ractive/0.8.5/ractive.min.js","version":"0.8.5","description":"Next-generation DOM manipulation"},{"name":"ractive.js","latest":"https://cdnjs.cloudflare.com/ajax/libs/ractive.js/0.3.7/ractive.min.js","version":"0.3.7","description":"Next-generation DOM manipulation"},{"name":"ractive-require","latest":"https://cdnjs.cloudflare.com/ajax/libs/ractive-require/0.6.12/ractive-require.min.js","version":"0.6.12","description":"Require Ractive views on demand in Package by Feature way"}],"total":3}
Search with specific fields Human Readable output{
"results": [
{
"name": "ractive",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/ractive/0.8.5/ractive.min.js",
"version": "0.8.5",
"description": "Next-generation DOM manipulation"
},
{
"name": "ractive.js",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/ractive.js/0.3.7/ractive.min.js",
"version": "0.3.7",
"description": "Next-generation DOM manipulation"
},
{
"name": "ractive-require",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/ractive-require/0.6.12/ractive-require.min.js",
"version": "0.6.12",
"description": "Require Ractive views on demand in Package by Feature way"
}
],
"total": 3
}
Specific Library Assets{"results":[{"name":"1140","latest":"https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.min.css","assets":[{"version":"2.0","files":["1140.css","1140.min.css"]}]}],"total":1}
Specific Library Assets Human Readable output{
"results": [
{
"name": "1140",
"latest": "https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.min.css",
"assets": [
{
"version": "2.0",
"files": [
"1140.css",
"1140.min.css"
]
}
]
}
],
"total": 1
}