Base URL
/v3/ prefix. An on-premise deployment exposes the same paths under
its own base URL.
Authentication
Send your API key in thex-api-key header on every request:
X-Api-Key works too. The API rejects a missing or
invalid key with HTTP 401. To get a key, see
API keys and authentication.
What the API covers
Identify components by PURL
Component data is keyed by Package URL (PURL), for examplepkg:github/scanoss/engine or pkg:npm/lodash. An optional requirement narrows the
request to a version or, on range endpoints, a version range:
Most lookup endpoints accept both forms:
GETfor one component. Passpurlandrequirementas query parameters.POSTfor many components. Send a JSON body with acomponentsarray. This is the batch form.
Search options
A batch body can also carry asearch object, and the same options are available as query
parameters on GET requests:
Endpoints that support these options say so in the API Reference. Today,
/v3/license/evidence is
the main endpoint that uses them.
Response conventions
Batch status and per-item info codes
A batch request returns HTTP200 even when some components could not be resolved. Each response
has two levels of outcome:
status.statusfor the request as a whole:SUCCESS,PARTIAL_SUCCESS, orERROR, with a human-readablestatus.message.info_codeandinfo_messageon each item incomponents, when that item did not resolve cleanly.
A single-component
GET reports the same status.status, derived from that one item’s
info_code.
Errors
Requests that fail as a whole, such as a malformed body or a server error, return an HTTP error status with this body:error.code is a stable identifier, so parse it instead of message. Common codes include
INVALID_BODY, INVALID_QUERY, EMPTY_BATCH, INVALID_PURL, COMPONENT_NOT_FOUND,
VERSION_NOT_FOUND, TIMEOUT, and INTERNAL_ERROR.
Scanning source code: the fingerprint flow
The API never receives your source code. You send WFP fingerprints, which are compact hashes of each file and of its snippets. Generate them withscanoss-cli wfp, the
Go SDK, or another SCANOSS client, rather than writing
your own fingerprinter:
POST /v3/wfp/scan accepts a WFP in one of two modes. The X-Scan-Id request header selects the
mode. Both return the same ScanEnvelope, and the final result is identical in both.
Small inputs: one synchronous request
Without anX-Scan-Id header, send the whole WFP as the body. The request blocks until the scan
finishes and returns 200 with status: completed and the result:
Large inputs: upload in blocks, then poll
For anything larger, upload the WFP in blocks and poll for the result. This is whatscanoss-cli scan does.
1
Create a scan ID
Generate a new UUID version 7 in canonical lowercase form, for example
018f7b2c-9a3e-7d41-8b6a-2c1d4e5f6a7b. Your client creates this ID, not the server. The
server rejects any other ID format with 400 INVALID_SCAN_ID.2
Upload each block
Split the WFP into byte ranges (scanoss-cli uses 1 MiB blocks by default). Send each one as
Each accepted block returns
POST /v3/wfp/scan with:X-Scan-Id: the same scan ID on every blockContent-Range: bytes <start>-<end>/<total>: the block’s position, zero-based, end inclusiveContent-Type: application/octet-stream
202 with status: uploading and received_bytes. Blocks can
arrive in any order and in parallel. If you resend a block the server already has, with the
same bytes, it returns 202 again, so you can retry a block safely. When the blocks cover the
whole range with no gaps, the server starts the scan.3
Poll for the result
status moves through uploading, queued, scanning, and finally completed, failed,
or expired. While scanning, phase, phase_done, and phase_total report progress. Once
completed, the envelope carries result. The API reports a failed scan in the body with an
error string, not as an HTTP error. scanoss-cli polls every 2 seconds by default.
The server keeps a scan session for a limited time. Polling an unknown ID returns
404 SCAN_NOT_FOUND,
and polling an expired one returns 410 SCAN_EXPIRED.
The scan result
result contains:
files: one entry per scanned file, with itspath, itsmatch_type(file,snippet, ornone), and amatcheslist. Each match names a component release byurl_hashand carries aconfidencegrade (LOW,MEDIUM, orHIGH). Snippet matches also carrymatch_percentageand the matched line ranges in your file and in the open source file.components: the matched component releases, keyed byurl_hash, withcomponent,vendor,version,url,release_date, andpurls.
--include. If you call the
API yourself, you add that data by sending the matched PURLs to the lookup endpoints above.