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

# Get license information for a single software component.

> Examines source code, license files, and package metadata to determine which licenses apply to the component.
Returns license data in both individual SPDX license and SPDX expressions when determinable.

See: https://github.com/scanoss/papi/blob/main/protobuf/scanoss/api/licenses/v2/README.md?tab=readme-ov-file#getcomponentlicenses



## OpenAPI

````yaml /api-reference/licenses-openapi.json get /v2/licenses/component
openapi: 3.0.0
info:
  title: SCANOSS License Service
  description: License service provides license intelligence for software components.
  version: '2.0'
  contact:
    name: scanoss-licenses
    url: https://github.com/scanoss/licenses
    email: support@scanoss.com
servers:
  - url: http://api.scanoss.com
  - url: https://api.scanoss.com
security: []
tags:
  - name: License
paths:
  /v2/licenses/component:
    get:
      tags:
        - License
      summary: Get license information for a single software component.
      description: >-
        Examines source code, license files, and package metadata to determine
        which licenses apply to the component.

        Returns license data in both individual SPDX license and SPDX
        expressions when determinable.


        See:
        https://github.com/scanoss/papi/blob/main/protobuf/scanoss/api/licenses/v2/README.md?tab=readme-ov-file#getcomponentlicenses
      operationId: License_GetComponentLicenses
      parameters:
        - name: purl
          description: Package URL identifying the component to analyze.
          in: query
          required: true
          schema:
            type: string
        - name: requirement
          description: >-
            Version constraint for component resolution when PURL lacks explicit
            version.
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2ComponentLicenseResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
components:
  schemas:
    v2ComponentLicenseResponse:
      type: object
      example:
        component:
          purl: pkg:github/scanoss/engine@1.0.0
          requirement: ''
          version: 1.0.0
          statement: GPL-2.0
          licenses:
            - id: GPL-2.0
              full_name: GNU General Public License v2.0 only
              is_spdx_approved: true
              url: https://spdx.org/licenses/GPL-2.0-only.html
          url: https://github.com/scanoss/engine
        status:
          status: SUCCESS
          message: Licenses Successfully retrieved
      properties:
        component:
          $ref: '#/components/schemas/v2ComponentLicenseInfo'
        status:
          $ref: '#/components/schemas/v2StatusResponse'
      description: >-
        Success example. For error cases, the component block reports the
        failure via info_message and info_code. Example:
        {\"component\":{\"purl\":\"pkg:github/scanoss/unknown-component\",\"requirement\":\"\",\"version\":\"\",\"statement\":\"\",\"licenses\":[],\"url\":\"\",\"info_message\":\"Component
        version not
        found\",\"info_code\":\"VERSION_NOT_FOUND\"},\"status\":{\"status\":\"SUCCESS\",\"message\":\"Success\"}}
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    v2ComponentLicenseInfo:
      type: object
      properties:
        purl:
          type: string
          description: >-
            Package URL (PURL) uniquely identifying the component. See Common
            API Types documentation for format and resolution logic.
        requirement:
          type: string
          title: >-
            Echoes the client's version constraint from the request. See Common
            API Types documentation for resolution logic
        version:
          type: string
          title: Specific version of the component that was analyzed
        statement:
          type: string
          title: >-
            SPDX expression when licensing terms are clearly determinable from
            source analysis
        licenses:
          type: array
          items:
            $ref: '#/components/schemas/v2LicenseInfo'
          title: Individual licenses identified in the component
        url:
          type: string
          title: Component URL
        info_message:
          type: string
          description: Status message describing the outcome of processing this component.
        info_code:
          type: string
          description: |-
            Status code identifying the outcome of processing this component.

            Possible values:
              - "INVALID_PURL":        The provided Package URL (PURL) is invalid or malformed.
              - "COMPONENT_NOT_FOUND": The requested component could not be found in the database.
              - "NO_INFO":             No license information is available for the requested component.
              - "INVALID_SEMVER":      The provided semantic version (SemVer) is invalid or malformed.
              - "VERSION_NOT_FOUND":   The specific component version could not be found.
      description: >-
        License information for a specific component identified by PURL and
        version.
    v2StatusResponse:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/v2StatusCode'
        message:
          type: string
          title: Status message
        db:
          $ref: '#/components/schemas/StatusResponseDB'
        server:
          $ref: '#/components/schemas/StatusResponseServer'
      description: Detailed response details.
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    v2LicenseInfo:
      type: object
      example:
        id: GPL-2.0
        full_name: GNU General Public License v2.0 only
        is_spdx_approved: true
        url: https://spdx.org/licenses/GPL-2.0-only.html
      properties:
        id:
          type: string
          title: |-
            License identifier:
             - For SPDX registry licenses: Standard SPDX ID
             - For non-registry licenses: licenseRef-<custom_license_name>
        full_name:
          type: string
          title: >-
            Best human-readable license name (normalized when possible)

            - For SPDX licenses: Official SPDX name (e.g., "MIT License", "GNU
            General Public License v2.0 only")

            - For non SPDX licenses: Best normalized name from SCANOSS database
            or original statement
        is_spdx_approved:
          type: boolean
          title: Indicates whether the license is approved by the SPDX License List
        url:
          type: string
          title: >-
            URL to the license text or reference page (e.g., SPDX license page
            or original license source)
      description: >-
        Individual license identification with SPDX ID and human-readable name.


        Provides basic license information including standardized identifiers
        and 

        human-readable names for discovered licenses in software components.
    v2StatusCode:
      type: string
      enum:
        - UNSPECIFIED
        - SUCCESS
        - SUCCEEDED_WITH_WARNINGS
        - WARNING
        - FAILED
      default: UNSPECIFIED
      description: Status code Enum.
    StatusResponseDB:
      type: object
      properties:
        schema_version:
          type: string
          title: Semantic schema version (e.g., 'v1.0.0')
        created_at:
          type: string
          title: When this DB was built (ISO 8601 format)
      description: Database version information.
    StatusResponseServer:
      type: object
      properties:
        version:
          type: string
          title: Semantic version (e.g., 'v1.0.0')
      description: Server information.

````