APIs / Apps and media / OSV

1 credit per call2 endpoints12 datapoints

OSV API

OSV API for open source package vulnerabilities: affected and fixed versions, aliases, CVSS vectors and source licence as JSON. 1 credit per call.

OSV
GET/v1/osv/package-vulns?ecosystem=npm&package=lodash
{
  "success": true,
  "data": {
    "ecosystem": "npm",
    "package": "lodash",
    "count": 10,
    "has_more": false,
    "items": [
      {
        "id": "GHSA-29mw-wpgm-hmr9",
        "summary": "Regular Expression Denial of Service (ReDoS) in lodash",
        "aliases": [
          "CVE-2020-28500"
        ],
        "severity": [
          {
            "type": "CVSS_V3",
            "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
          }
        ],
        "database_severity": "MODERATE",
        "cwe_ids": [
          "CWE-1333",
          "CWE-400"
        ],
        "published": "2022-01-06T20:30:46Z",
        "modified": "2025-09-29T21:12:31.102523Z",
        "source": {
          "database": "GitHub Advisory Database",
          "license": "CC-BY-4.0"
        },
        "url": "https://osv.dev/vulnerability/GHSA-29mw-wpgm-hmr9",
        "affected_ranges": [
          {
            "type": "SEMVER",
            "events": [
              "…",
              "…"
            ]
          }
        ],
        "fixed_versions": [
          "4.17.21"
        ]
      },
      {
        "id": "GHSA-35jh-r3h4-6jhm",
        "summary": "Command Injection in lodash",
        "aliases": [
          "CVE-2021-23337"
        ],
        "severity": [
          {
            "type": "CVSS_V3",
            "vector": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
          }
        ],
        "database_severity": "HIGH",
        "cwe_ids": [
          "CWE-77",
          "CWE-94"
        ],
        "published": "2021-05-06T16:05:51Z",
        "modified": "2026-10-17T02:55:38.085813876Z",
        "source": {
          "database": "GitHub Advisory Database",
          "license": "CC-BY-4.0"
        },
        "url": "https://osv.dev/vulnerability/GHSA-35jh-r3h4-6jhm",
        "affected_ranges": [
          {
            "type": "SEMVER",
            "events": [
              "…",
              "…"
            ]
          }
        ],
        "fixed_versions": [
          "4.17.21"
        ]
      },
      {
        "id": "GHSA-4xc9-xhrj-v574",
        "summary": "Prototype Pollution in lodash",
        "aliases": [
          "CVE-2018-16487"
        ],
        "database_severity": "HIGH",
        "cwe_ids": [
          "CWE-400"
        ],
        "published": "2019-02-07T18:16:48Z",
        "modified": "2025-08-12T21:55:35.778975Z",
        "source": {
          "database": "GitHub Advisory Database",
          "license": "CC-BY-4.0"
        },
        "url": "https://osv.dev/vulnerability/GHSA-4xc9-xhrj-v574",
        "affected_ranges": [
          {
            "type": "SEMVER",
            "events": [
              "…",
              "…"
            ]
          }
        ],
        "fixed_versions": [
          "4.17.11"
        ]
      }
    ]
  },
  "meta": {
    "request_id": "req_e9de1a78ec0a4adfac8f8b3b91eb380d",
    "credits_charged": 1,
    "credits_remaining": 167
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Sample data

What one call returns

A recorded run of package-vulns: the fields and shapes you will get, shortened to 3 items.

#idstringsummarystringaliasesstring[]severityobject[]database_severitystringcwe_idsstring[]publishedstringmodifiedstringsourceobjecturlurlaffected_rangesobject[]fixed_versionsstring[]
1GHSA-29mw-wpgm-hmr9Regular Expression Denial of Service (ReDoS) in lodash[1 item][1 item]MODERATE[2 items]2022-01-06T20:30:46Z2025-09-29T21:12:31.102523Z{2 fields}https://osv.dev/vulnerability/GHSA-29mw-wpgm-hmr9[1 item][1 item]
2GHSA-35jh-r3h4-6jhmCommand Injection in lodash[1 item][1 item]HIGH[2 items]2021-05-06T16:05:51Z2026-10-17T02:55:38.085813876Z{2 fields}https://osv.dev/vulnerability/GHSA-35jh-r3h4-6jhm[1 item][1 item]
3GHSA-4xc9-xhrj-v574Prototype Pollution in lodash[1 item]—HIGH[1 item]2019-02-07T18:16:48Z2025-08-12T21:55:35.778975Z{2 fields}https://osv.dev/vulnerability/GHSA-4xc9-xhrj-v574[1 item][1 item]

Recorded from our API · 3 items shown · 12 datapoints per itemGET /v1/osv/package-vulns?ecosystem=npm&package=lodash

12 datapoints

Identity

  • idstring
  • cwe_idsstring[]

Contact

  • urlurl

Other

  • summarystring
  • aliasesstring[]
  • severityobject[]
  • database_severitystring
  • publishedstring
  • modifiedstring
  • sourceobject
  • affected_rangesobject[]
  • fixed_versionsstring[]

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/osv/package-vulns?ecosystem=npm&package=lodash" \
  -H "X-API-Key: $API_KEY"

OSV · 2 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

EndpointRequired parametersReturnsCost
GET/v1/osv/package-vulns
ecosystempackage+2 optional
ecosystempackageitems
1 credit
GET/v1/osv/vuln
id
idsummaryaliasesseveritydatabase_severitycwe_ids+7 more
1 credit

Overview

About the OSV API

What you can get

The OSV API returns open source vulnerability records from OSV (osv.dev) as JSON through 2 endpoints.

  • Package vulnerabilities: package-vulns takes an ecosystem (npm, PyPI, Maven, Go, crates.io, RubyGems, NuGet, Debian and others, 36 in all) and a package, with an optional version and a page_token for very long lists.
  • Vulnerability: vuln takes an id: an OSV, GHSA, PYSEC, GO, RUSTSEC or CVE id.

The recorded package-vulns call for PyPI jinja2 version 2.4.1 returned 18 vulnerabilities, each with id, summary, aliases (CVE and PYSEC ids), severity (CVSS v3 and v4 vectors), database_severity, cwe_ids, published, modified, affected_ranges for that package, fixed_versions and source. The first, GHSA-462w-v97r-4m45, a sandbox escape, was fixed in 2.10.1. vuln adds details, related, every affected package with its purl, ranges and fixed versions, affected_total and references.

How a call works

Check a dependency: GET /v1/osv/package-vulns?ecosystem=PyPI&package=jinja2&version=2.4.1 with your key in the X-API-Key header returns the vulnerabilities that affect that version; vuln takes one of their ids, for example GET /v1/osv/vuln?id=GHSA-jfh8-c2jp-5v3q. Answers come from a cache for up to an hour. Every successful call costs 1 credit; failed calls cost nothing.

Apps and mediaJSONRESTMCP

More apps and media APIs

Use cases

Check each pinned version in a lockfile and list the fixed version to upgrade to

Use the OSV API to check each pinned version in a lockfile and list the fixed version to upgrade to

Let a coding agent check a package version for known vulnerabilities before adding it

Use the OSV API to let a coding agent check a package version for known vulnerabilities before adding it

Map a CVE to the affected packages and versions across ecosystems

Use the OSV API to map a CVE to the affected packages and versions across ecosystems

Gate a CI build on vulnerabilities with a high `database_severity`

Use the OSV API to gate a CI build on vulnerabilities with a high `database_severity`

FAQ

Questions

Is this the official OSV API?

No. Perceptlayer is an independent service and is not affiliated with OSV. The osv.dev API is free and needs no key. This API calls it on your behalf and adds one key for every source on Perceptlayer, a flatter record with only the queried package's ranges and fixed versions, a cache of up to an hour, and no charge for failed calls.

Who should I credit for the data?

OSV (osv.dev), and the database each record comes from. OSV gathers advisories from many databases under their own licences, most of them CC-BY 4.0, so every record carries its database and licence in `source`, the attribution CC-BY asks for. In the recordings, `source.license` was CC-BY-4.0.

Why is a record missing or a 404?

Records from databases under non-commercial or share-alike terms (Chainguard / Wolfi, Ubuntu and Alpine) are left out, as are databases whose licence osv.dev doesn't state. They are filtered from `package-vulns` results, those ecosystems aren't accepted, and `vuln` answers 404 for their ids. A 404 costs nothing.

How much does the OSV API cost?

Each successful call costs one credit, whatever the number of vulnerabilities in the answer. New accounts get free credits to start, and credit packs bring the price down as you scale.

Should I build an OSV scraper instead?

You can, but an OSV scraper is code you maintain: page changes break it, requests get blocked, and OSV's terms govern how you collect data. The OSV API gives you 2 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

Try the OSV API with 100 free credits

No credit card. Failed calls are never billed.