---
title: Check Package Safety API
slug: check-package-safety
url: https://apyhub.com/martin10291/service/check-package-safety
provider: Martin Petrov
categories: [Verification Kit, Safety Kit]
tags: [package-security, dependency-safety, npm, pypi, supply-chain, vulnerability-check]
auth: api_key
version: 1.0
service_type: sync
endpoints: 1
atoms: 100
mcp: true
---

# Check Package Safety API

Package safety check API for npm and PyPI. Send up to 25 packages and get a verdict, risk score and reasons before you install. Free tier, no card.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/martin10291/check-package-safety` | What it does Checks npm or PyPI packages for safety information and returns a row per requested pac… | 100 |

## Endpoint reference

### Package Safety Check API - npm and PyPI before you install

`POST https://api.eu.apyhub.com/martin10291/check-package-safety` · 100 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `packages` | body | array of string | yes | Packages to check, 1 to 25 per call. Each item is a package name with an optional version and ecosystem prefix: `express`, `express@4.18.2`, `npm:lodash@4.17.4`, `pypi:requests==2.19.0`. Without a ve… |
| `ecosystem` | body | string | no | Default ecosystem for items in `packages` that have no `npm:` or `pypi:` prefix: `npm` or `pypi` (default `npm`). One of: npm, pypi. Default: `npm`. Example: `npm`. |

#### Quickstart

Check the safety of a package version before you install it.

```bash
curl -X POST "https://api.eu.apyhub.com/martin10291/check-package-safety" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "packages": ["express@4.18.2"],
    "ecosystem": "npm"
  }'
```

#### What you'll get back

Returns a JSON object with `count` and `items`, one safety report per package. Here express 4.18.2 gets `caution`: it has 2 known vulnerabilities, listed in `vulnerabilities` with the versions that fix them. The report also shows the latest version, downloads, maintainers, licence, install scripts and the data sources.

```json
{
  "count": 1,
  "items": [
    {
      "attribution": "Vulnerability data: OSV.dev (CC BY 4.0). Package metadata: npm public registry API / PyPI JSON API.",
      "checkedAt": "2026-11-26T10:10:18Z",
      "deprecated": false,
      "deprecatedMessage": null,
      "ecosystem": "npm",
      "exists": true,
      "hasInstallScripts": false,
      "homepage": "http://expressjs.com/",
      "installScripts": {},
      "latestVersion": "5.3.0",
      "license": "MIT",
      "maintainersCount": 3,
      "message": null,
      "name": "express",
      "packageAgeDays": 5810,
      "packageCreatedAt": "2010-12-29T19:38:25Z",
      "reasons": [
        "2 known vulnerabilities in 4.18.2, worst MODERATE (GHSA-rv95-896h-c2vc; fixed in 5.0.0-beta.3)"
      ],
      "repositoryUrl": "https://github.com/expressjs/express",
      "requestedVersion": "4.18.2",
      "riskScore": 27,
      "sources": [
        "npm registry API",
        "npm downloads API",
        "OSV.dev"
      ],
      "typosquatOf": null,
      "verdict": "caution",
      "version": "4.18.2",
      "versionAgeHours": 36229.9,
      "versionPublishedAt": "2022-10-08T20:14:32Z",
      "versionsCount": 320,
      "vulnCount": 2,
      "vulnerabilities": [
        {
          "fixedIn": [
            "4.19.2",
            "5.0.0-beta.3"
          ],
          "id": "GHSA-rv95-896h-c2vc",
          "severity": "MODERATE",
          "summary": "Express.js Open Redirect in malformed URLs"
        },
        {
          "fixedIn": [
            "4.20.0",
            "5.0.0"
          ],
          "id": "GHSA-qw6h-vgh9-j6wx",
          "severity": "LOW",
          "summary": "express vulnerable to XSS via response.redirect()"
        }
      ],
      "weeklyDownloads": 209877980,
      "yanked": null,
      "yankedReason": null
    }
  ]
}
```

## About

## What it does
The Package Safety Check API tells you if an npm or PyPI package is safe to install. Send a list of packages and get back a verdict, a risk score and the reasons for each one.

Send `packages` with 1 to 25 items. Each item is a name with an optional version and prefix, such as `express@4.18.2`, `npm:lodash@4.17.4` or `pypi:requests==2.19.0`. Without a version, the latest one is checked. Set `ecosystem` (`npm` or `pypi`, default `npm`) for items that have no prefix.

Each result has a `verdict` of `ok`, `caution`, `avoid` or `not_found`, plus a `riskScore` from 0 to 100. The `reasons` list explains it in plain words. The check looks for known vulnerabilities from OSV.dev, typosquat names such as `expresss`, and deprecated or yanked releases. It also flags npm install scripts, versions published in the last 72 hours and packages with no source repository.

Teams use this package safety check in CI to block risky dependencies before install. AI coding agents use it to catch mistyped or hallucinated package names, which come back as `not_found`. Security teams use it to review new npm and PyPI dependencies.

For a full advisory list across more ecosystems, use the [Check Package Vulnerabilities API](https://apyhub.com/martin10291/service/check-package-vulnerabilities). To find outdated libraries on a live site, use the [Website Security Scan API](https://apyhub.com/martin10291/service/website-security-scan).

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/martin10291/service/check-package-safety
