Star CDNJS!

API

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 reture 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

The API is served over Cloudflare with a hour expiry for requests.


Examples

All Libraries (Cut down a bit)
https://api.cdnjs.com/libraries
{"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"},

All Libraries Human Readable output (Cut down a bit)
https://api.cdnjs.com/libraries?output=human
{
  "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"
    },

Search
https://api.cdnjs.com/libraries?search=ractive
{"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 Human Readable output
https://api.cdnjs.com/libraries?search=jquery&output;=human
{
  "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
https://api.cdnjs.com/libraries?search=ractive&fields;=version,description
{"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
https://api.cdnjs.com/libraries?search=ractive&output;=human&fields;=version,description
{
  "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
https://api.cdnjs.com/libraries?search=1140&fields;=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
https://api.cdnjs.com/libraries?search=1140&fields;=assets&output;=human
{
  "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
}