- https://public.vulnerablecode.io/api/docs/ for documentation with Swagger
- https://public.vulnerablecode.io/api/schema/ for the OpenAPI schema
The API documentation is available at https://public.vulnerablecode.io/api/docs/.
To use the endpoints you need to authenticate with an API key. Request your API key
from https://public.vulnerablecode.io/account/request_api_key/. Once you have
your API key, click on the Authorize button on the top right of the page and enter
your API key in the value field with Token prefix, so if your token is "1234567890abcdef"
then you have to enter this: Token 1234567890abcdef.
The package endpoint allows you to query vulnerable packages using a purl or purl fields.
Sample python script:
import requests
# Query by purl
resp = requests.post(
"https://public.vulnerablecode.io/api/v3/packages/",
headers={"Authorization": "Token 123456789", "User-Agent": "VCIO_API_AGENT"},
json={
"purls": ["pkg:npm/atob@2.0.3?foo=bar"],
"ignore_qualifiers_subpath": True,
"details": True
}
).json()
Sample using curl:
curl -X POST "https://public.vulnerablecode.io/api/v3/packages/" \
-H "Authorization: Token <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-H "User-Agent: VCIO_API_AGENT" \
-d '{
"purls": [
"pkg:pypi/flask@2.3.2"
],
"ignore_qualifiers_subpath": true,
"details": true,
"reachability": true
}'
The response will be a list of packages, these are packages that are affected by and/or that fix a vulnerability advisory.
| Endpoint | Query Parameters | Expected Output |
|---|---|---|
POST /api/v3/packages/ |
|
Return a list of vulnerable packages |
POST /api/v3/advisories/ |
|
Returns a list of advisories related to the provided packages |
GET /api/v3/affected-by-advisories/ |
|
Returns a paginated list of advisories vulnerabilities that affect given packages. |
GET /api/v3/affected-by-advisories/{id}/ |
|
Returns a specific advisory that affect a given package. |
GET /api/v3/fixing-advisories/ |
|
Return a paginated list of advisories that fix a given package. |
GET /api/v3/fixing-advisories/{id}/ |
|
Returns a specific advisory that fix a given package. |
GET /api/v3/package-types/ |
Return a list of to all the packages types in the database. |
The API is paginated and the default page size is 100. You can change the page size
by passing the page_size parameter. You can also change the page number by passing
the page parameter.