> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scanoss.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Poll progress / result of an async (Mode A) batch scan

> Report the state of an async session by `scan_id` (given as a path
segment). Reflects upload progress (`uploading`), then scan progress
(`scanning`), then the result (`completed`, with `result`). Terminal
engine failures are reported in-band as `status: failed` with an `error`
string — not as an HTTP error code. Only Mode A creates a session;
Mode B returns its result synchronously and has nothing to poll.




## OpenAPI

````yaml /api-reference/developer-tools/v3-openapi.yaml get /v3/wfp/scan/{id}
openapi: 3.0.3
info:
  title: SCANOSS Services API
  version: 0.28.1
  description: |
    Consolidated HTTP API for the SCANOSS knowledge base. Exposes the
    following domains under a single `/v3/*` prefix:

      * **licenses**      — attribution files + per-file license evidence
      * **copyright**     — copyright evidence + holders (stubbed pending data)
      * **components**    — free-form search, versions and lifecycle status
      * **crypto**        — algorithms, hints and version ranges per purl,
                            plus ruleset tarball downloads
      * **crypto reachability** — stitched cryptographic findings, call
                            chains, entry points, supporting and forward
                            calls per component or frozen dependency tree
      * **dependencies**  — declared dependencies (with composite-license
                            resolution) and bounded transitive walks
      * **geo**           — contributor declared/curated locations and
                            timezone-based origin distribution
      * **vulnerabilities** (path `/vuln/*`) — CVE detection by merging the
                            local NVD KB with osv.dev, enriched with EPSS
      * **scan**          — direct SCANOSS engine scans (WFP upload, MD5 /
                            urlhash / snippet lookups)
      * **contents**      — raw notice / source-code content from the mz store

    Every batch endpoint encodes per-item failures as `info_code` /
    `info_message` so the call as a whole returns 200 with a
    `status.status` ∈ {SUCCESS, PARTIAL_SUCCESS, ERROR}. Single-purl
    GETs derive the same status from the item's `info_code`.
servers:
  - url: https://api.scanoss.com
    description: Production
security: []
tags:
  - name: licenses
    description: License attribution files and per-file license evidence
  - name: copyright
    description: Copyright evidence and holders (stubbed pending KB data)
  - name: components
    description: Component search, versions and lifecycle status
  - name: cryptography
    description: Cryptographic algorithms, hints, version ranges and ruleset downloads
  - name: cryptography-reachability
    description: >
      Crypto reachability over mining results: stitched findings, call chains,
      crypto entry points, supporting calls and bounded forward calls, for one
      component (with its mined dependency closure) or a caller-supplied frozen
      dependency tree. Registered only when reachability_db.dsn is configured.
  - name: dependencies
    description: Declared dependencies (per component) and transitive walks
  - name: geoprovenance
    description: Contributor locations (declared + curated) and origin distribution
  - name: vulnerabilities
    description: CVE detection (local KB + OSV) and CPE lookup
  - name: scan
    description: >
      Direct SCANOSS engine scans (passthrough), plus MD5 / urlhash / snippet
      lookups, and the dual-mode batch endpoint (synchronous single-shot WFP and
      chunked-async upload over the batchScanner pipeline). Registered only when
      scan.engine_path is configured.
  - name: contents
    description: Raw notice / source-code content from the mz store
paths:
  /v3/wfp/scan/{id}:
    get:
      tags:
        - scan
      summary: Poll progress / result of an async (Mode A) batch scan
      description: |
        Report the state of an async session by `scan_id` (given as a path
        segment). Reflects upload progress (`uploading`), then scan progress
        (`scanning`), then the result (`completed`, with `result`). Terminal
        engine failures are reported in-band as `status: failed` with an `error`
        string — not as an HTTP error code. Only Mode A creates a session;
        Mode B returns its result synchronously and has nothing to poll.
      operationId: getScanBatch
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            format: uuid
          description: The `scan_id` returned by the Mode A `POST /v3/wfp/scan`.
      responses:
        '200':
          description: Current session state (and `result` once completed).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanEnvelope'
        '404':
          $ref: '#/components/responses/ScanNotFound'
        '410':
          $ref: '#/components/responses/ScanExpired'
components:
  schemas:
    ScanEnvelope:
      type: object
      description: >
        Unified status envelope returned by `POST /v3/wfp/scan` (both modes) and
        `GET /v3/wfp/scan/{id}`. Mode B returns it synchronously already at
        `status: completed`; Mode A returns it per block (`uploading`) and on
        each poll. Zero-valued fields are omitted, so an uploading session
        carries no scan counters and a running scan carries no result.
      required:
        - scan_id
        - status
      properties:
        scan_id:
          type: string
          format: uuid
          x-go-type: string
          description: >
            Canonical lowercase UUIDv7 session id. In Mode A this is the
            client-supplied id; in Mode B it is a server-generated id for
            traceability only (no session is created).
          example: 018f7b2c-9a3e-7d41-8b6a-2c1d4e5f6a7b
        status:
          type: string
          enum:
            - uploading
            - queued
            - scanning
            - completed
            - failed
            - expired
        received_bytes:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Bytes received so far (Mode A upload; omitted when 0).
        total_bytes:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Declared total upload size (Mode A; omitted when 0).
        upload_percent:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Exact upload progress percent (Mode A; omitted when 0).
        phase:
          type: string
          x-go-type-skip-optional-pointer: true
          description: 'Current pipeline pass while scanning, e.g. ''Pass 1: scan files''.'
        phase_done:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Items processed in the current phase.
        phase_total:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Total items in the current phase.
        files_total:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: File count of the report, filled in on completion.
        result:
          allOf:
            - $ref: '#/components/schemas/ScanResult'
          description: >
            Populated only when status is `completed`. The batchScanner report —
            byte-identical whether obtained synchronously (Mode B) or by polling
            an async session to completion (Mode A).
        error:
          type: string
          x-go-type-skip-optional-pointer: true
          description: Populated only when status is `failed`.
    ScanResult:
      type: object
      description: >
        batchScanner multi-pass report: a `files` array of per-file match
        entries and a `components` map keyed by url_hash. Produced by /wfp/scan
        (not raw engine output).
      properties:
        server:
          allOf:
            - $ref: '#/components/schemas/ScanServer'
          description: >
            Optional run/server metadata passed through from the batchScanner
            pipeline when present; omitted otherwise.
        files:
          type: array
          x-go-type-skip-optional-pointer: true
          description: One entry per scanned file (order is unspecified).
          items:
            $ref: '#/components/schemas/FileResult'
        components:
          type: object
          x-go-type-skip-optional-pointer: true
          description: Resolved components keyed by url_hash. Extra fields may be present.
          additionalProperties:
            $ref: '#/components/schemas/ComponentResult'
    ErrorBody:
      type: object
      required:
        - status
        - error
        - timestamp
      properties:
        status:
          type: string
          enum:
            - error
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: |
                Stable machine-readable error identifier. Possible values:
                  - INVALID_BODY, INVALID_QUERY, INVALID_FILE_HASH, INVALID_RANGE
                  - EMPTY_BATCH
                  - INVALID_PURL, COMPONENT_NOT_FOUND, VERSION_NOT_FOUND
                  - NOTICE_NOT_FOUND, FILE_NOT_FOUND, MZ_READ_FAILED
                  - TIMEOUT, INTERNAL_ERROR
            message:
              type: string
        timestamp:
          type: string
          format: date-time
    ScanServer:
      type: object
      description: >
        Run/server metadata for the scan, produced by the batchScanner pipeline
        and passed through unchanged. Fields may be empty; open to extra
        passthrough fields.
      properties:
        api_version:
          type: string
          x-go-type-skip-optional-pointer: true
          description: batchScanner API version.
        knowledge_base:
          allOf:
            - $ref: '#/components/schemas/KnowledgeBase'
        hostname:
          type: string
          x-go-type-skip-optional-pointer: true
          description: Host that ran the scan.
        elapsed_ms:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Scan wall-clock time, in milliseconds.
    FileResult:
      type: object
      description: One scanned-file entry in a batchScanner report.
      required:
        - path
        - source_hash
        - file_hash
        - match_type
        - matches
      properties:
        path:
          type: string
          description: The scanned file path.
        source_hash:
          type: string
          description: MD5 of the input file (from the WFP).
        file_hash:
          type: string
          description: >-
            MD5 of the matched file: equals `source_hash` for a `file` match,
            the matched OSS file's MD5 for a `snippet` match (differs from
            `source_hash`), and empty for a `none` match.
        match_type:
          type: string
          enum:
            - file
            - snippet
            - none
          description: Full-file match, partial (snippet) match, or no match.
        matches:
          type: array
          description: Matched KB entries for this file.
          items:
            $ref: '#/components/schemas/MatchResult'
    ComponentResult:
      type: object
      description: >
        A resolved component in a batchScanner report, keyed by url_hash in
        `ScanResult.components`. Open to extra upstream fields.
      properties:
        component:
          type: string
          x-go-type-skip-optional-pointer: true
        vendor:
          type: string
          x-go-type-skip-optional-pointer: true
        version:
          type: string
          x-go-type-skip-optional-pointer: true
        file:
          type: string
          x-go-type-skip-optional-pointer: true
        url:
          type: string
          x-go-type-skip-optional-pointer: true
        release_date:
          type: string
          x-go-type-skip-optional-pointer: true
        rank:
          type: integer
          x-go-type-skip-optional-pointer: true
        purls:
          type: array
          items:
            type: string
          x-go-type-skip-optional-pointer: true
    KnowledgeBase:
      type: object
      description: SCANOSS knowledge-base versions the scan ran against.
      properties:
        monthly_version:
          type: string
          x-go-type-skip-optional-pointer: true
          description: Monthly KB snapshot version.
        daily_version:
          type: string
          x-go-type-skip-optional-pointer: true
          description: Daily KB delta version.
    MatchResult:
      type: object
      description: One matched KB entry for a scanned file.
      required:
        - url_hash
        - confidence
      properties:
        url_hash:
          type: string
          description: url_hash of the matched component release.
        confidence:
          type: string
          enum:
            - LOW
            - MEDIUM
            - HIGH
          description: 'Attribution reliability grade for this match: LOW, MEDIUM or HIGH.'
        oss_file_path:
          type: string
          x-go-type-skip-optional-pointer: true
          description: Path of the matched file inside the OSS component.
        match_percentage:
          type: integer
          x-go-type-skip-optional-pointer: true
          description: Snippet matches only; omitted for full-file matches.
        input_line_ranges:
          type: array
          x-go-type-skip-optional-pointer: true
          description: Snippet matches only — matched line ranges in the input file.
          items:
            $ref: '#/components/schemas/LineRange'
        oss_line_ranges:
          type: array
          x-go-type-skip-optional-pointer: true
          description: Snippet matches only — matched line ranges in the OSS file.
          items:
            $ref: '#/components/schemas/LineRange'
    LineRange:
      type: object
      description: A matched line range (inclusive) within a file.
      required:
        - start_line
        - end_line
      properties:
        start_line:
          type: integer
          description: First line of the matched range.
        end_line:
          type: integer
          description: Last line of the matched range.
  responses:
    ScanNotFound:
      description: Unknown scan_id
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: error
            error:
              code: SCAN_NOT_FOUND
              message: scan session not found
            timestamp: '2026-05-19T11:39:56Z'
    ScanExpired:
      description: Session aged out past scan.batch.session_ttl
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: error
            error:
              code: SCAN_EXPIRED
              message: scan session expired
            timestamp: '2026-05-19T11:39:56Z'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.