Get Packages by PURL (Org Scoped)
Changed onBatch retrieval of package metadata and alerts by PURL strings for a specific organization. Compatible with CycloneDX reports.
Package URLs (PURLs) are an ecosystem agnostic way to identify packages. CycloneDX SBOMs use the purl format to identify components. This endpoint supports fetching metadata and alerts for multiple packages at once by passing an array of purl strings, or by passing an entire CycloneDX report.
Note: This endpoint has a batch size limit (default: 1024 PURLs per request). Requests exceeding this limit will return a 400 Bad Request error.
More information on purl and CycloneDX:
This endpoint returns the latest available alert data for artifacts in the batch (stale while revalidate). Actively running analysis will be returned when available on subsequent runs.
When alerts=true, Socket may synthesize two alert types to make partial results actionable:
- pendingScan: the package is known but analysis has not completed yet
- notFound: Socket could not resolve the package/version metadata
When purlErrors=true, unresolved notFound inputs keep the legacy purlError stream shape instead of emitting synthetic notFound artifacts.
Use poll=false (default) to fail open and return the current known state quickly. Use poll=true to fail closed and wait up to timeoutSec for pending analysis before returning.
Conda (temporary compatibility): pkg:conda inputs are served from the already-scanned PyPI package with the same normalized name and version when one exists; the response row keeps the original conda PURL in inputPurl but reports type: pypi. Conda build, subdir, type, and channel qualifiers are ignored, and conda packages without a scanned PyPI counterpart return the normal notFound result. This mapping will be replaced by native conda support.
Query Parameters
This endpoint supports all query parameters from POST /v0/purl including: alerts, actions, compact, mode, fixable, licenseattrib, licensedetails, purlErrors, poll, cachedResultsOnly, and summary.
Additionally, you may provide a labels query parameter to apply a repository label's security policies. Pass the label slug as the value (e.g., ?labels=production). Only one label is currently supported.
Examples:
Looking up an npm package:
{
"components": [
{
"purl": "pkg:npm/express@4.19.2"
}
]
}
Looking up a PyPi package:
{
"components": [
{
"purl": "pkg:pypi/django@5.0.6"
}
]
}
Looking up a Maven package:
{
"components": [
{
"purl": "pkg:maven/log4j/log4j@1.2.17"
}
]
}
Batch lookup
{
"components": [
{
"purl": "pkg:npm/express@4.19.2"
},
{
"purl": "pkg:pypi/django@5.0.6"
},
{
"purl": "pkg:maven/log4j/log4j@1.2.17"
}
]
}
With label and options (query parameters):
POST /v0/orgs/{org_slug}/purl?labels=production&alerts=true&compact=true
{
"components": [
{
"purl": "pkg:npm/express@4.19.2"
}
]
}
This endpoint consumes 100 units of your quota.
This endpoint requires the following org token scopes:
- packages:list
Request
- Base URLhttps://api.socket.dev/v0
- URLhttps://api.socket.dev/v0/orgs/{org_slug}/purl
- Auth
- HTTP bearer
- or HTTP basic
Path parameters
The slug of the organization
Query parameters
Repository label slugs to apply policies. Only one label is supported currently; the parameter is an array to allow future support for multiple labels.
Include alert metadata.
Include only alerts with comma separated actions defined by security policy.
Compact metadata. When enabled, excludes metadata fields like author, scores, size, dependencies, and manifest files. Always includes: id, type, name, version, release, namespace, subpath, alerts, and alertPriorities. The same as mode=compact, which wins when both are given.
Response shape. default is the full record; compact is the compact flag by another name and wins over it; firewall-check is the subset the Socket firewall check reads.
Include only fixable alerts.
Include license attribution data, including license text and author information. Maps attribution/license text to a list of data objects to which that attribution info applies.
Include detailed license information, including location and match strength, for each license datum.
Return errors found with handling PURLs as error objects in the stream.
When true, wait up to timeoutSec for pending analysis to complete before returning. When false (default), return the current known state immediately, including synthesized pendingScan and notFound alerts when alerts=true unless purlErrors=true keeps legacy not-found errors.
Legacy fallback for older clients. Only used when poll is omitted: cachedResultsOnly=true behaves like poll=false, while cachedResultsOnly=false preserves the older blocking behavior.
Include a summary object at the end of the stream with counts of malformed, resolved, and not found PURLs.
Maximum time in seconds to wait for package resolution and, when poll=true, pending analysis. Inputs that have not completed processing when the timeout is reached return pendingScan alerts when alerts=true, or errors when purlErrors=true.
Request body
Response
Socket issue lists and scores for all packages, and optional metadata objects
Changes
- info
endpoint added
- info