ScanMalware JavaScript Segments API

The JavaScript Segments API from ScanMalware — 8 operation(s) for javascript segments.

GitHub OpenAPI

Operations 8

GET /api/v1/js-segments/scan/{scan_id} Get Segments By Scan #
GET /api/v1/js-segments/search/hash/{code_hash} Search By Code Hash #
GET /api/v1/js-segments/search/normalized/{normalized_hash} Search By Normalized Hash #
GET /api/v1/js-segments/search/tlsh/{tlsh_hash} Search By Tlsh Similarity #
GET /api/v1/js-segments/{scan_id}/unknown Get Unknown Segments #
GET /api/v1/js-segments/{scan_id}/suspicious Get Suspicious Segments #
POST /api/v1/js-segments/differential Perform Differential Analysis #
GET /api/v1/js-segments/{scan_id}/differential Get Differential Analysis #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/scanmalware-com:scanmalware-com-javascript-segments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

scanmalware-com-javascript-segments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: ScanMalware JavaScript Segments API
  description: URL Security Scanner API
  version: 1.0.0
tags:
- name: JavaScript Segments
paths:
  /api/v1/js-segments/scan/{scan_id}:
    get:
      tags:
      - JavaScript Segments
      summary: Get Segments By Scan
      description: 'Get all code segments for a scan.


        Returns detailed information about all extracted functions, classes, and code blocks.

        Optionally filter by script_url to get segments for a specific script.'
      operationId: get_segments_by_scan_api_v1_js_segments_scan__scan_id__get
      parameters:
      - name: scan_id
        in: path
        required: true
        schema:
          type: string
          title: Scan Id
      - name: script_url
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by specific script URL
          title: Script Url
        description: Filter by specific script URL
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          description: Maximum segments to return
          default: 100
          title: Limit
        description: Maximum segments to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          maximum: 100000
          minimum: 0
          description: Pagination offset
          default: 0
          title: Offset
        description: Pagination offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentSearchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/search/hash/{code_hash}:
    get:
      tags:
      - JavaScript Segments
      summary: Search By Code Hash
      description: 'Find all segments with matching exact code hash.


        Useful for finding identical code segments across different scans.'
      operationId: search_by_code_hash_api_v1_js_segments_search_hash__code_hash__get
      parameters:
      - name: code_hash
        in: path
        required: true
        schema:
          type: string
          description: SHA-256 code hash
          title: Code Hash
        description: SHA-256 code hash
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          maximum: 100000
          minimum: 0
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentSearchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/search/normalized/{normalized_hash}:
    get:
      tags:
      - JavaScript Segments
      summary: Search By Normalized Hash
      description: 'Find all segments with matching normalized code hash.


        Normalized hashes remove whitespace and comments, enabling fuzzy matching

        of functionally identical code with different formatting.'
      operationId: search_by_normalized_hash_api_v1_js_segments_search_normalized__normalized_hash__get
      parameters:
      - name: normalized_hash
        in: path
        required: true
        schema:
          type: string
          description: Normalized code hash (whitespace removed)
          title: Normalized Hash
        description: Normalized code hash (whitespace removed)
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          maximum: 100000
          minimum: 0
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentSearchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/search/tlsh/{tlsh_hash}:
    get:
      tags:
      - JavaScript Segments
      summary: Search By Tlsh Similarity
      description: 'Find code segments similar to the given TLSH hash.


        TLSH (Trend Micro Locality Sensitive Hash) enables fuzzy matching of code that has been:

        - Minified or beautified

        - Variable names changed

        - Whitespace modified

        - Slightly obfuscated


        **Distance thresholds:**

        - 0: Identical code

        - 1-30: Very similar (minor changes)

        - 31-50: Similar (same structure, some modifications)

        - 51-100: Related (significant changes but similar patterns)

        - >100: Different code


        **Use cases:**

        - Find malware variants

        - Detect code reuse across sites

        - Identify obfuscated versions of known malicious code

        - Track supply chain compromises


        **Coverage — read this before trusting an empty result.** The corpus holds

        ~21.4M distinct TLSH values and no single request can compare against all of

        them. The search runs in tiers, and the response reports which ran:


        - `exact_tlsh` — index-complete. Every stored segment whose TLSH equals the

        query is returned, at distance 0.

        - `normalized_hash_family` — index-complete, and only reachable when the

        query hash is in the corpus. Covers the reformatted / renamed / whitespace

        cases above, which `normalized_hash` already collapses. A real TLSH

        distance is still computed for each member, so a family member beyond

        `max_distance` is dropped rather than assumed similar.

        - `random_sample_pct` — a genuine random sample (TABLESAMPLE), NOT

        exhaustive. Present so an unknown hash still gets some fuzzy reach.


        `exhaustive` is true only when every tier that CONTRIBUTED was index-complete.

        When it is false, an empty `matches` means "not found in what was compared",

        never "not in the corpus" — use `total_candidates_scanned` to judge.

        With `sample_percent=0` only the index-complete tiers run, so the search is

        exhaustive for exact and normalized-family matches (and nothing else). An

        `lsh_bands` banded-similarity tier existed 2026-09-09..22 and was retired

        because its index was never maintained (see the comment in the handler).'
      operationId: search_by_tlsh_similarity_api_v1_js_segments_search_tlsh__tlsh_hash__get
      parameters:
      - name: tlsh_hash
        in: path
        required: true
        schema:
          type: string
          minLength: 70
          description: TLSH hash to search for similar segments
          title: Tlsh Hash
        description: TLSH hash to search for similar segments
      - name: max_distance
        in: query
        required: false
        schema:
          type: integer
          maximum: 300
          minimum: 0
          description: Maximum TLSH distance (0=identical, <50=similar, <100=related)
          default: 50
          title: Max Distance
        description: Maximum TLSH distance (0=identical, <50=similar, <100=related)
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          minimum: 1
          description: Maximum results to return
          default: 100
          title: Limit
        description: Maximum results to return
      - name: include_known_libraries
        in: query
        required: false
        schema:
          type: boolean
          description: Include segments from known libraries
          default: false
          title: Include Known Libraries
        description: Include segments from known libraries
      - name: sample_percent
        in: query
        required: false
        schema:
          type: number
          maximum: 1.0
          minimum: 0.0
          description: Percentage of the corpus to additionally sample at random for fuzzy matching (TABLESAMPLE). 0 disables it, leaving only the index-complete exact and normalized-family tiers. Read the exhaustive flag in the response.
          default: 0.02
          title: Sample Percent
        description: Percentage of the corpus to additionally sample at random for fuzzy matching (TABLESAMPLE). 0 disables it, leaving only the index-complete exact and normalized-family tiers. Read the exhaustive flag in the response.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TLSHSearchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/{scan_id}/unknown:
    get:
      tags:
      - JavaScript Segments
      summary: Get Unknown Segments
      description: 'Identify segments not matching known libraries.


        Returns code segments that aren''t recognized as part of known JavaScript libraries.

        These are candidates for further malware analysis.'
      operationId: get_unknown_segments_api_v1_js_segments__scan_id__unknown_get
      parameters:
      - name: scan_id
        in: path
        required: true
        schema:
          type: string
          title: Scan Id
      - name: min_code_length
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          description: Minimum code length to include
          default: 50
          title: Min Code Length
        description: Minimum code length to include
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          maximum: 100000
          minimum: 0
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentSearchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/{scan_id}/suspicious:
    get:
      tags:
      - JavaScript Segments
      summary: Get Suspicious Segments
      description: 'Get high-risk segments that aren''t known libraries.


        Returns segments with elevated risk scores that are unknown, indicating

        potential malicious code (eval usage, base64 encoding, high entropy, etc.).'
      operationId: get_suspicious_segments_api_v1_js_segments__scan_id__suspicious_get
      parameters:
      - name: scan_id
        in: path
        required: true
        schema:
          type: string
          title: Scan Id
      - name: min_risk_score
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 0
          description: Minimum risk score (0-100)
          default: 60
          title: Min Risk Score
        description: Minimum risk score (0-100)
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          maximum: 100000
          minimum: 0
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentSearchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/differential:
    post:
      tags:
      - JavaScript Segments
      summary: Perform Differential Analysis
      description: 'Compare bundle segments against known library database.


        Analyzes all segments in a scan and identifies:

        - Which segments match known libraries (jQuery, React, etc.)

        - Which segments are unknown (potential malware)

        - Which unknown segments have high risk scores (suspicious)


        Returns a breakdown of library composition and unknown code.'
      operationId: perform_differential_analysis_api_v1_js_segments_differential_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DifferentialAnalysisRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DifferentialAnalysisResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/js-segments/{scan_id}/differential:
    get:
      tags:
      - JavaScript Segments
      summary: Get Differential Analysis
      description: 'GET form of POST /differential, returning the identical result, so the analysis can be opened as a link.


        Its totals can differ from /js-segments/scan/{scan_id} and /js-segments/{scan_id}/unknown, which count segments

        by different rules. The defaults are the ones the result page''s Code Segments panel uses.'
      operationId: get_differential_analysis_api_v1_js_segments__scan_id__differential_get
      parameters:
      - name: scan_id
        in: path
        required: true
        schema:
          type: string
          title: Scan Id
      - name: min_confidence
        in: query
        required: false
        schema:
          type: number
          maximum: 1.0
          minimum: 0.0
          description: Minimum library match confidence
          default: 0.8
          title: Min Confidence
        description: Minimum library match confidence
      - name: include_known_libraries
        in: query
        required: false
        schema:
          type: boolean
          description: Include known-library segments in the details
          default: false
          title: Include Known Libraries
        description: Include known-library segments in the details
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DifferentialAnalysisResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    DifferentialAnalysisRequest:
      properties:
        scan_id:
          type: string
          title: Scan Id
        min_confidence:
          type: number
          maximum: 1.0
          minimum: 0.0
          title: Min Confidence
          default: 0.8
        include_known_libraries:
          type: boolean
          title: Include Known Libraries
          default: false
      type: object
      required:
      - scan_id
      title: DifferentialAnalysisRequest
      description: Request for differential analysis
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    TLSHSearchResult:
      properties:
        query_hash:
          type: string
          title: Query Hash
        max_distance:
          type: integer
          title: Max Distance
        total_candidates_scanned:
          type: integer
          title: Total Candidates Scanned
        matches_found:
          type: integer
          title: Matches Found
        matches:
          items:
            $ref: '#/components/schemas/TLSHSimilarSegment'
          type: array
          title: Matches
        tlsh_available:
          type: boolean
          title: Tlsh Available
          default: true
        exhaustive:
          type: boolean
          title: Exhaustive
          default: false
        search_strategy:
          items:
            type: string
          type: array
          title: Search Strategy
          default: []
        filtered_known_library:
          type: integer
          title: Filtered Known Library
          default: 0
      type: object
      required:
      - query_hash
      - max_distance
      - total_candidates_scanned
      - matches_found
      - matches
      title: TLSHSearchResult
      description: TLSH similarity search result
    SegmentInfo:
      properties:
        segment_id:
          type: integer
          title: Segment Id
        scan_id:
          type: string
          title: Scan Id
        session_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
        script_url:
          type: string
          title: Script Url
        script_url_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Script Url Id
        segment_type:
          type: string
          title: Segment Type
        function_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Function Name
        start_line:
          anyOf:
          - type: integer
          - type: 'null'
          title: Start Line
        end_line:
          anyOf:
          - type: integer
          - type: 'null'
          title: End Line
        start_offset:
          anyOf:
          - type: integer
          - type: 'null'
          title: Start Offset
        end_offset:
          anyOf:
          - type: integer
          - type: 'null'
          title: End Offset
        code_length:
          anyOf:
          - type: integer
          - type: 'null'
          title: Code Length
        code_snippet:
          anyOf:
          - type: string
          - type: 'null'
          title: Code Snippet
        code_hash:
          type: string
          title: Code Hash
        normalized_hash:
          anyOf:
          - type: string
          - type: 'null'
          title: Normalized Hash
        tlsh_hash:
          anyOf:
          - type: string
          - type: 'null'
          title: Tlsh Hash
        patterns:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Patterns
        risk_score:
          anyOf:
          - type: integer
          - type: 'null'
          title: Risk Score
        risk_factors:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Risk Factors
        library_match:
          anyOf:
          - type: string
          - type: 'null'
          title: Library Match
        library_confidence:
          anyOf:
          - type: number
          - type: 'null'
          title: Library Confidence
        is_known_library:
          type: boolean
          title: Is Known Library
          default: false
        is_suspicious:
          type: boolean
          title: Is Suspicious
          default: false
        is_internal_code:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Internal Code
        corpus_occurrences:
          anyOf:
          - type: integer
          - type: 'null'
          title: Corpus Occurrences
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
      - segment_id
      - scan_id
      - script_url
      - segment_type
      - code_hash
      - created_at
      title: SegmentInfo
      description: Individual code segment information
    TLSHSimilarSegment:
      properties:
        segment_id:
          type: integer
          title: Segment Id
        scan_id:
          type: string
          title: Scan Id
        script_url:
          type: string
          title: Script Url
        function_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Function Name
        code_length:
          anyOf:
          - type: integer
          - type: 'null'
          title: Code Length
        code_snippet:
          anyOf:
          - type: string
          - type: 'null'
          title: Code Snippet
        tlsh_hash:
          type: string
          title: Tlsh Hash
        tlsh_distance:
          type: integer
          title: Tlsh Distance
        similarity_score:
          type: number
          title: Similarity Score
        risk_score:
          anyOf:
          - type: integer
          - type: 'null'
          title: Risk Score
        is_known_library:
          type: boolean
          title: Is Known Library
          default: false
        library_match:
          anyOf:
          - type: string
          - type: 'null'
          title: Library Match
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
      - segment_id
      - scan_id
      - script_url
      - tlsh_hash
      - tlsh_distance
      - similarity_score
      - created_at
      title: TLSHSimilarSegment
      description: Segment found via TLSH similarity search
    SegmentSearchResult:
      properties:
        total_count:
          type: integer
          title: Total Count
        segments:
          items:
            $ref: '#/components/schemas/SegmentInfo'
          type: array
          title: Segments
        query_params:
          additionalProperties: true
          type: object
          title: Query Params
        scope:
          type: string
          title: Scope
        inline_attribution:
          anyOf:
          - type: string
          - type: 'null'
          title: Inline Attribution
        total_count_capped:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Total Count Capped
        variant_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Variant Count
      type: object
      required:
      - total_count
      - segments
      - query_params
      - scope
      title: SegmentSearchResult
      description: Search result for segment queries
    DifferentialAnalysisResult:
      properties:
        scan_id:
          type: string
          title: Scan Id
        total_segments:
          type: integer
          title: Total Segments
        matched_segments:
          type: integer
          title: Matched Segments
        unknown_segments:
          type: integer
          title: Unknown Segments
        suspicious_segments:
          type: integer
          title: Suspicious Segments
        library_breakdown:
          additionalProperties:
            type: integer
          type: object
          title: Library Breakdown
        unknown_segment_details:
          items:
            $ref: '#/components/schemas/SegmentInfo'
          type: array
          title: Unknown Segment Details
        suspicious_segment_details:
          items:
            $ref: '#/components/schemas/SegmentInfo'
          type: array
          title: Suspicious Segment Details
      type: object
      required:
      - scan_id
      - total_segments
      - matched_segments
      - unknown_segments
      - suspicious_segments
      - library_breakdown
      - unknown_segment_details
      - suspicious_segment_details
      title: DifferentialAnalysisResult
      description: Differential analysis result
  securitySchemes:
    OptionalHTTPBearer:
      type: http
      scheme: bearer
    HTTPBearer:
      type: http
      scheme: bearer