Skip to main content

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.

SearchComponents

Search for software components across ecosystems using name, vendor, or PURL patterns.

Request Format

The search supports multiple modes:
  • General search — Free-text search using the search parameter
  • Targeted search — Use vendor and component parameters
  • Ecosystem filtering — Use package to filter by ecosystem (e.g., github, maven, npm)

HTTP Request Example

curl -X GET 'https://api.scanoss.com/v2/components/search?search=scanoss&limit=10' \
  -H "X-Api-Key: $SC_API_KEY" | jq

Response Example

{
  "components": [
    {
      "name": "scanoss-py",
      "purl": "pkg:github/scanoss/scanoss.py",
      "url": "https://github.com/scanoss/scanoss.py",
      "component": "scanoss-py"
    },
    {
      "name": "engine",
      "purl": "pkg:github/scanoss/engine",
      "url": "https://github.com/scanoss/engine",
      "component": "engine"
    }
  ],
  "status": {
    "status": "SUCCESS",
    "message": "Components successfully retrieved",
    "db": {
      "schema_version": "v1.0.0",
      "created_at": "2024-01-15"
    },
    "server": {
      "version": "v0.1.0"
    }
  }
}
The component field is deprecated and will be removed in future versions. Use the name field instead, which provides the same information.

ComponentVersions

Get available versions for a software component, including license metadata.

Request Format

  • Requires a valid PURL (Package URL)
  • Optional limit parameter sets number of versions returned

HTTP Request Example

curl -X GET 'https://api.scanoss.com/v2/components/versions?purl=pkg:github/scanoss/engine&limit=20' \
  -H "X-Api-Key: $SC_API_KEY" | jq

Response Format

The method returns comprehensive version information including:
  • component: Contains the component details and version list
    • name: Component name
    • purl: Package URL identifier
    • url: Component repository or homepage URL
    • versions: List of available versions with metadata
  • status: Response status indicating success or failure
Each version object contains:
  • Version identifier and release date
  • Associated licenses with SPDX information
  • SPDX approval status for each license

Response Example

{
  "component": {
    "name": "engine",
    "purl": "pkg:github/scanoss/engine",
    "url": "https://github.com/scanoss/engine",
    "versions": [
      {
        "version": "5.0.0",
        "licenses": [
          {
            "name": "GNU General Public License v2.0",
            "spdx_id": "GPL-2.0",
            "is_spdx_approved": true,
            "url": "https://spdx.org/licenses/GPL-2.0.html"
          }
        ],
        "date": "2024-01-15T10:30:00Z"
      },
      {
        "version": "4.5.0",
        "licenses": [
          {
            "name": "GNU General Public License v2.0",
            "spdx_id": "GPL-2.0",
            "is_spdx_approved": true,
            "url": "https://spdx.org/licenses/GPL-2.0.html"
          }
        ],
        "date": "2023-12-10T14:20:00Z"
      }
    ],
    "component": "engine"
  },
  "status": {
    "status": "SUCCESS",
    "message": "Component versions successfully retrieved",
    "db": {
      "schema_version": "v1.0.0",
      "created_at": "2024-01-15"
    },
    "server": {
      "version": "v0.1.0"
    }
  }
}

ComponentStatistics

Get code statistics for software components, including file counts, line counts and language breakdown.

HTTP Request Example

curl -X POST 'https://api.scanoss.com/v2/components/statistics' \
  -H 'Content-Type: application/json' \
  -H "X-Api-Key: $SC_API_KEY" \
  -d '{
    "purls": [
      "pkg:github/scanoss/engine@5.0.0",
      "pkg:github/scanoss/scanoss.py@1.30.0"
    ]
  }' | jq

Response Format

The method returns comprehensive code statistics including:
  • components: List of analyzed components with their statistics
  • status: Response status indicating success or failure
Each component statistics object contains:
  • Component identification (PURL and version)
  • Overall code metrics (total files, lines, blank lines)
  • Language breakdown with file counts per programming language

Response Examples

Components with Code Statistics

{
  "component_statistics": [
    {
      "purl": "pkg:github/scanoss/engine@5.0.0",
      "version": "5.0.0",
      "statistics": {
        "total_source_files": 156,
        "total_lines": 25430,
        "total_blank_lines": 3420,
        "languages": [
          {
            "name": "C",
            "files": 89
          },
          {
            "name": "C Header",
            "files": 45
          },
          {
            "name": "Makefile",
            "files": 12
          },
          {
            "name": "Shell",
            "files": 10
          }
        ]
      }
    },
    {
      "purl": "pkg:github/scanoss/scanoss.py@1.30.0",
      "version": "1.30.0",
      "statistics": {
        "total_source_files": 23,
        "total_lines": 4520,
        "total_blank_lines": 680,
        "languages": [
          {
            "name": "Python",
            "files": 20
          },
          {
            "name": "Markdown",
            "files": 2
          },
          {
            "name": "YAML",
            "files": 1
          }
        ]
      }
    }
  ],
  "status": {
    "status": "SUCCESS",
    "message": "Component statistics successfully retrieved",
    "db": {
      "schema_version": "v1.0.0",
      "created_at": "2024-01-15"
    },
    "server": {
      "version": "v0.1.0"
    }
  }
}

Component with No Available Statistics

{
  "component_statistics": [
    {
      "purl": "pkg:github/example/unknown-component@1.0.0",
      "version": "1.0.0",
      "statistics": {
        "total_source_files": 0,
        "total_lines": 0,
        "total_blank_lines": 0,
        "languages": []
      }
    }
  ],
  "status": {
    "status": "SUCCESS",
    "message": "Component statistics successfully retrieved",
    "db": {
      "schema_version": "v1.0.0",
      "created_at": "2024-01-15"
    },
    "server": {
      "version": "v0.1.0"
    }
  }
}