> ## 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.

# Match a raw WFP body (snippets)

> Match a raw WFP body (`text/plain`) against the KB (`-S`). The body must
contain at least one snippet-hash line (`N=<hashes>`); a WFP with only a
file hash yields `500`. Optional `threshold` sets the minimum match
percentage (`-T`). Also served at the legacy `/v3/scan/snippets` alias
(used by the batchScanner pipeline) — **deprecated, provisional for
compatibility and to be removed in a future version**; new clients should
use `/v3/snippets/scan`.




## OpenAPI

````yaml /api-reference/developer-tools/v3-openapi.yaml post /v3/snippets/scan
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/snippets/scan:
    post:
      tags:
        - scan
      summary: Match a raw WFP body (snippets)
      description: >
        Match a raw WFP body (`text/plain`) against the KB (`-S`). The body must

        contain at least one snippet-hash line (`N=<hashes>`); a WFP with only a

        file hash yields `500`. Optional `threshold` sets the minimum match

        percentage (`-T`). Also served at the legacy `/v3/scan/snippets` alias

        (used by the batchScanner pipeline) — **deprecated, provisional for

        compatibility and to be removed in a future version**; new clients
        should

        use `/v3/snippets/scan`.
      operationId: postScanSnippets
      parameters:
        - in: query
          name: threshold
          required: false
          schema:
            type: integer
            minimum: 0
            maximum: 100
          description: Minimum match threshold (percent).
        - in: query
          name: flags
          required: false
          schema:
            type: integer
            minimum: 0
          description: >-
            Engine flags bitmask (-F). Gate: allow_flags_override.
            (Snippet/ranking tuning applies to /v3/raw/scan only.)
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
            example: |
              file=93d99b95d57fca563c23a2bc4954aeed,12044,src/scanner.c
              12=a1b2c3,d4e5f6
      responses:
        '200':
          description: Snippet match report.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnippetResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/EngineUnavailable'
        '504':
          $ref: '#/components/responses/Timeout'
components:
  schemas:
    SnippetResponse:
      type: object
      properties:
        file_hash:
          type: string
        file_path:
          type: string
        file_size:
          type: integer
        total_lines:
          type: integer
        tolerance_pct:
          type: number
        snippet_groups:
          type: array
          items:
            $ref: '#/components/schemas/SnippetGroup'
    SnippetGroup:
      type: object
      properties:
        group_index:
          type: integer
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/SnippetCandidate'
    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
    SnippetCandidate:
      type: object
      properties:
        file_hash:
          type: string
        hits:
          type: integer
        lines_matched:
          type: integer
        matched_percent:
          type: integer
        input_line_ranges:
          type: string
          description: Comma-separated line ranges in the posted WFP, e.g. "12-148".
        oss_line_ranges:
          type: string
          description: Comma-separated line ranges in the KB component.
  responses:
    BadRequest:
      description: Invalid request parameters or body
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: error
            error:
              code: INVALID_QUERY
              message: purl query parameter is required
            timestamp: '2026-05-19T11:39:56Z'
    InternalError:
      description: Unexpected server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: error
            error:
              code: INTERNAL_ERROR
              message: ...
            timestamp: '2026-05-19T11:39:56Z'
    EngineUnavailable:
      description: The scan engine is not configured or not executable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: error
            error:
              code: ENGINE_UNAVAILABLE
              message: scan engine not available
            timestamp: '2026-05-19T11:39:56Z'
    Timeout:
      description: Request exceeded the server-side deadline
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: error
            error:
              code: TIMEOUT
              message: request timed out
            timestamp: '2026-05-19T11:39:56Z'

````

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