DEV Community

Cover image for 5 Free APIs That Check Any Package in 3 Seconds (Script Included)
Priyanshu Tiwari
Priyanshu Tiwari

Posted on Originally published at Medium

5 Free APIs That Check Any Package in 3 Seconds (Script Included)

One shell script, no API keys. It tells you if a package is deprecated, vulnerable, huge or abandoned before it lands in your project.

npm install takes three seconds. Deciding whether you should install that package usually takes longer, so most of the time we skip the deciding.

You search for a package, the name looks right, the README looks fine, you install it. The package is now part of your app, and so are its 28 dependencies.

I wanted a faster way to ask the boring questions first. Is it deprecated? Does it have known vulnerabilities? How big is it? When did anyone last touch it? Turns out five free public APIs answer all of that, none of them need a key, and one shell script can ask all five at once.

Here is the script, what each API gives you, and what it said about a few real packages on 2026-11-18.

The five APIs

Each one answers one question.

1. npm registry (registry.npmjs.org/<package>): is it deprecated, what's the license, when was this version published?

2. npm downloads API (api.npmjs.org/downloads/point/last-week/<package>): does anyone actually use it?

3. OSV.dev (api.osv.dev/v1/query): does this exact version have known vulnerabilities? This is Google's open vulnerability database. You send a package name and a version in a POST request and get advisories back.

4. Bundlephobia (bundlephobia.com/api/size): how many bytes will it add, and how many dependencies come with it?

5. GitHub API (api.github.com/repos/<owner>/<repo>): is the repo archived, and when was the last push?

All five worked without a key. GitHub limits unauthenticated calls per hour, which is plenty for checking one package at a time.

The script

Save it as pkgcheck.sh, run chmod +x pkgcheck.sh, and you need jq installed (brew install jq).

#!/bin/bash
# pkgcheck <npm-package> [version]
pkg=$1; ver=$2
[ -z "$pkg" ] && { echo "usage: pkgcheck <package> [version]"; exit 1; }
reg=$(curl -s "https://registry.npmjs.org/$pkg")
ver=${ver:-$(echo "$reg" | jq -r '."dist-tags".latest')}
echo "package     $pkg@$ver"
echo "published   $(echo "$reg" | jq -r --arg v "$ver" '.time[$v]')"
echo "license     $(echo "$reg" | jq -r --arg v "$ver" '.versions[$v].license // "none"')"
echo "deprecated  $(echo "$reg" | jq -r --arg v "$ver" '.versions[$v].deprecated // "no"')"
echo "downloads   $(curl -s "https://api.npmjs.org/downloads/point/last-week/$pkg" | jq -r .downloads) last week"
osv=$(curl -s -X POST https://api.osv.dev/v1/query -d "{\"package\":{\"name\":\"$pkg\",\"ecosystem\":\"npm\"},\"version\":\"$ver\"}")
n=$(echo "$osv" | jq -r '(.vulns // []) | length')
ids=$(echo "$osv" | jq -r '[(.vulns // [])[].id] | join(" ")')
echo "vulns       $n known $ids"
size=$(curl -s "https://bundlephobia.com/api/size?package=$pkg@$ver")
echo "size        $(echo "$size" | jq -r 'if .size then "\(.size) B min, \(.gzip) B gzip, \(.dependencyCount) deps" else "n/a" end')"
repo=$(echo "$reg" | jq -r --arg v "$ver" '.versions[$v].repository.url // .repository.url // empty' | sed -E 's#^(git\+)?(https?|git|ssh)://(git@)?github.com[/:]##; s#\.git$##')
[ -n "$repo" ] && curl -s "https://api.github.com/repos/$repo" | jq -r 'if .full_name then "github      \(.full_name): \(.stargazers_count) stars, last push \(.pushed_at), archived: \(.archived)" else "github      repo not found" end'
Enter fullscreen mode Exit fullscreen mode

Usage: ./pkgcheck.sh express for the latest version, or ./pkgcheck.sh lodash 4.17.20 for a specific one.

What it said about real packages

express, the latest version:

package     express@5.3.0
published   2026-10-09T12:56:54.505Z
license     MIT
deprecated  no
downloads   200803554 last week
vulns       0 known
size        581196 B min, 239196 B gzip, 28 deps
github      expressjs/express: 69675 stars, last push 2026-11-02T20:15:26Z, archived: false
Enter fullscreen mode Exit fullscreen mode

That is what a healthy package looks like: recent publish, recent push, no advisories, huge usage.

lodash 4.17.20, an older version:

package     lodash@4.17.20
published   2020-08-13T16:53:54.152Z
license     MIT
deprecated  no
downloads   205327931 last week
vulns       4 known GHSA-29mw-wpgm-hmr9 GHSA-35jh-r3h4-6jhm GHSA-r5fr-rjxr-66jc GHSA-xxjr-mmjv-4gpg
size        69690 B min, 25111 B gzip, 0 deps
github      lodash/lodash: 61347 stars, last push 2026-10-01T23:04:09Z, archived: false
Enter fullscreen mode Exit fullscreen mode

Same package, same name, same 205 million weekly downloads. The version matters. Nothing on the npm page for lodash would have told me that 4.17.20 has four advisories.

request, a package that's still all over older code:

package     request@2.88.2
published   2020-02-11T16:35:36.122Z
license     Apache-2.0
deprecated  request has been deprecated, see https://github.com/request/request/issues/3142
downloads   13425266 last week
vulns       1 known GHSA-p8p7-x288-28g6
size        741096 B min, 192771 B gzip, 20 deps
github      request/request: 25477 stars, last push 2024-08-14T00:09:41Z, archived: false
Enter fullscreen mode Exit fullscreen mode

Deprecated, one advisory, last push in 2024, and still 13 million downloads a week. That's the lesson: download counts tell you what people already installed, not whether you should.

left-pad, the tiny one:

package     left-pad@1.3.0
deprecated  use String.prototype.padStart()
size        423 B min, 283 B gzip, 0 deps
Enter fullscreen mode Exit fullscreen mode

The registry itself tells you not to install it. The deprecation message is the fastest code review you'll get all day.

node-ipc 10.1.1 is the interesting one. OSV flags it with GHSA-97m3-w2cp-4xx6. That's the version from the March 2022 protestware incident. The script doesn't explain what happened, but it tells you something is wrong before you've opened a single file.

A bug I hit while writing this

My first version of the script printed 0 known vulnerabilities for lodash 4.17.20.

That's wrong, and I only caught it because I tested the script on a version I already knew was bad. The problem was how I'd built the JSON for the OSV request. After I rewrote that part it printed the four advisories above.

If you write your own checker, test it against something you know is vulnerable first. A safety check that says "all clear" by mistake is worse than having no check.

Three more one-liners in the same style

These use the same idea: one free API, one question.

Which Node.js versions are still supported?

curl -s https://endoflife.date/api/nodejs.json | jq -r '.[] | select(.eol > "2026-11-18") | "\(.cycle)  eol \(.eol)  latest \(.latest)"'
Enter fullscreen mode Exit fullscreen mode

On the day I ran it: 26 (EOL 2029-04-30), 24 (2028-04-30) and 22 (2027-04-30). The same site covers Python, PostgreSQL, Ruby and most things you'll deploy.

What's the latest version of a Python package?

curl -s https://pypi.org/pypi/requests/json | jq -r '"\(.info.version) uploaded \(.urls[0].upload_time)"'
Enter fullscreen mode Exit fullscreen mode

What's the latest release of any GitHub project?

curl -s https://api.github.com/repos/jqlang/jq/releases/latest | jq -r '.tag_name, .published_at'
Enter fullscreen mode Exit fullscreen mode

That returned jq-1.8.2 published 2026-06-20.

What this won't catch

I'd rather say this plainly. The script reads public records. It will not catch a brand-new malicious package with no advisory yet, and download counts can be faked. A package with zero advisories isn't proven safe, only "nobody has reported anything."

What it does is take the cheap checks off your plate so the expensive ones, reading the code and the dependency list, go to packages that deserve it.

Make it a one-word command

Move the script somewhere on your path and give it a short name in ~/.zshrc:

alias pkgcheck="$HOME/bin/pkgcheck.sh"
Enter fullscreen mode Exit fullscreen mode

Now pkgcheck some-package before every npm install takes about three seconds. On my Mac, the express and request checks above each took about 3.4 seconds end to end.

Quick answers

Do I need an API key for any of these?
No. All five worked without one when I ran them on 2026-11-18. GitHub allows fewer requests per hour without a token.

Does it work for Python or Rust?
OSV supports PyPI, crates.io, Go and many other ecosystems. Change the ecosystem value in the request and use that registry's own API for the metadata.

How is this different from npm audit?
npm audit checks what's already in your lockfile. This checks a package before you add it, and shows size, maintenance and deprecation too.

Can I check my whole project at once?
Yes, with the OSV batch endpoint or osv-scanner. This script is for the single "should I install this?" moment.


I'm Priyanshu, a self-taught developer building in public. I post what I learn on X: @priyanshudotsol.

Top comments (0)