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

# Get Resource by ID

> Return a resource by its ID (Leen's UUID)



## OpenAPI

````yaml get /resources/{resource_id}
openapi: 3.1.0
info:
  title: Leen Security API V2
  version: 0.0.1
servers:
  - url: https://api.leen.dev/v2
    description: Production API V2
  - url: https://api.eu-c1.leen.dev/v2
    description: Production API (EU Region)
security: []
paths:
  /resources/{resource_id}:
    get:
      tags:
        - resources
      summary: Get Resource by ID
      description: Return a resource by its ID (Leen's UUID)
      operationId: get_resource_by_id
      parameters:
        - name: resource_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Resource Id
        - name: use_pool
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Use Pool
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceRespModel'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorException'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Connection-ID: []
          API-Key: []
components:
  schemas:
    ResourceRespModel:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Leen's UUID for the resource
        name:
          type: string
          title: Name
          description: Resource name
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceTag'
              type: array
            - type: 'null'
          title: Tags
          description: List of arbitrary tags/metadata for the resource
        type:
          allOf:
            - $ref: '#/components/schemas/ResourceTypeEnum'
          description: Type of the resource
        state:
          allOf:
            - $ref: '#/components/schemas/ResourceStateEnum'
          description: State of the resource
        groups:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceGroup'
              type: array
            - type: 'null'
          title: Groups
          description: Groups associated with the resource
        data:
          anyOf:
            - $ref: '#/components/schemas/ResourceContainer'
            - $ref: '#/components/schemas/ResourceHost'
            - $ref: '#/components/schemas/ResourceImage'
            - $ref: '#/components/schemas/ResourceBranch'
            - type: 'null'
          title: Data
          description: Additional data or properties about the resource
        cloud_metadata:
          anyOf:
            - $ref: '#/components/schemas/ResourceCloudMetadata'
            - type: 'null'
          description: Cloud metadata for the resource
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: URL associated with the resource
        vendor:
          type: string
          title: Vendor
          description: The source vendor of the resource
        first_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: First Seen
          description: Timestamp when the resource was first seen
        last_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen
          description: Timestamp when the resource was last seen
        vendor_attributes:
          allOf:
            - $ref: '#/components/schemas/ResourceVendorAttributes'
          description: Vendor-specific attributes like IDs
      type: object
      required:
        - id
        - name
        - type
        - state
        - vendor
        - vendor_attributes
      title: Resource
      description: Response model for returning resource details via an API endpoint.
    ErrorException:
      properties:
        detail:
          type: string
          title: Detail
          description: Error message
      type: object
      required:
        - detail
      title: ErrorException
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ResourceTag:
      properties:
        key:
          type: string
          title: Key
        value:
          type: string
          title: Value
        source:
          type: string
          enum:
            - wiz_vms
            - gitlab
            - checkmarx
            - mend
            - qualys
            - aws
            - insight_vm
            - orca
          title: Source
      type: object
      required:
        - key
        - value
        - source
      title: ResourceTag
    ResourceTypeEnum:
      type: string
      enum:
        - BRANCH
        - HOST
        - CONTAINER
        - DEPENDENCY
        - IMAGE
        - REPOSITORY
        - UNKNOWN
      title: ResourceTypeEnum
      description: Enumeration for resource types.
    ResourceStateEnum:
      type: string
      enum:
        - ACTIVE
        - IGNORED
        - DELETED
        - INACTIVE
        - QUARANTINED
        - UNKNOWN
      title: ResourceStateEnum
    ResourceGroup:
      properties:
        name:
          type: string
          title: Name
          description: The name of the group.
        uid:
          type: string
          title: Uid
          description: The unique identifier of the group.
      type: object
      required:
        - name
        - uid
      title: ResourceGroup
      description: ORM model representing a groups in a resource.
    ResourceContainer:
      properties:
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Hostnames
          description: List of hostnames for the container
        image:
          anyOf:
            - type: string
            - type: 'null'
          title: Image
          description: Container image identifier
      type: object
      title: ResourceContainer
      description: ORM model representing a container in a resource.
    ResourceHost:
      properties:
        image:
          anyOf:
            - type: string
            - type: 'null'
          title: Image
          description: Host image identifier
        fqdns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Fqdns
          description: Fully qualified domain names of the host
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Hostnames
          description: List of hostnames for the host
        installed_software:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Installed Software
          description: Installed software on the host
        ipv4s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ipv4S
          description: IPv4 addresses associated with the host
        ipv6s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ipv6S
          description: IPv6 addresses associated with the host
        mac_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Mac Addresses
          description: MAC addresses associated with the host
        os_major_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Os Major Version
          description: Major version of the host's operating system
        os_minor_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Os Minor Version
          description: Minor version of the host's operating system
        os_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Version
          description: Full operating system version of the host
        platform:
          anyOf:
            - $ref: '#/components/schemas/ResourcePlatformEnum'
            - type: 'null'
          description: Platform on which the host is running
        agents:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceHostAgent'
              type: array
            - type: 'null'
          title: Agents
          description: Agent information for the host
        ad_org_unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Ad Org Unit
          description: Active Directory organizational unit
        ad_site_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Ad Site Name
          description: Active Directory site name
        ad_domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Ad Domain
          description: Active Directory domain
        ad_device_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Ad Device Id
          description: Active Directory device ID
        is_deleted:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Deleted
          description: Whether the host is deleted
        deleted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Deleted At
          description: When the host was deleted
      type: object
      title: ResourceHost
      description: ORM model representing a host in a resource.
    ResourceImage:
      properties:
        labels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Labels
          description: Image labels
        hash:
          anyOf:
            - $ref: '#/components/schemas/ResourceHash'
            - type: 'null'
          description: Image hash
      type: object
      title: ResourceImage
      description: ORM model representing an image in a resource.
    ResourceBranch:
      properties:
        code_repo:
          anyOf:
            - type: string
            - type: 'null'
          title: Code Repo
          description: Code repository name
        repo_branch_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Repo Branch Name
          description: Repository branch name
      type: object
      title: ResourceBranch
      description: ORM model representing a branch in a resource.
    ResourceCloudMetadata:
      properties:
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Id
          description: Cloud account identifier
        account_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Name
          description: Cloud account name
        cloud_provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Cloud Provider
          description: Cloud service provider
        image_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Id
          description: Cloud image identifier
        instance_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Id
          description: Cloud instance identifier
        instance_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Type
          description: Type of cloud instance
        region:
          anyOf:
            - type: string
            - type: 'null'
          title: Region
          description: Cloud region
        subnet_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Subnet Id
          description: Cloud subnet identifier
        vpc_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Vpc Id
          description: Cloud VPC identifier
      type: object
      title: ResourceCloudMetadata
      description: ORM model representing cloud metadata in a resource.
    ResourceVendorAttributes:
      properties:
        id:
          type: string
          title: Id
          description: Vendor specific ID
        data:
          anyOf:
            - $ref: '#/components/schemas/QualysDeviceVendorData'
            - $ref: '#/components/schemas/TenableDeviceVendorData'
            - $ref: '#/components/schemas/OrcaResourceVendorAttributesData'
            - type: 'null'
          title: Data
          description: Vendor specific data
      type: object
      required:
        - id
      title: ResourceVendorAttributes
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ResourcePlatformEnum:
      type: string
      enum:
        - WINDOWS
        - LINUX
        - MAC
        - UNKNOWN
      title: ResourcePlatformEnum
      description: Enumeration for resource platforms.
    ResourceHostAgent:
      properties:
        vendor:
          type: string
          title: Vendor
          description: Vendor of the agent
        product:
          type: string
          title: Product
          description: Product name of the agent
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
          description: Version of the agent
        signature_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Signature Version
          description: Signature version of the agent, usually related to EDR agents
        vendor_attributes:
          anyOf:
            - $ref: '#/components/schemas/ResourceHostAgentVendorAttributes'
            - type: 'null'
          description: Vendor-specific attributes of the agent
      type: object
      required:
        - vendor
        - product
      title: ResourceHostAgent
      description: ORM model representing agent information in a resource.
    ResourceHash:
      properties:
        algorithm:
          anyOf:
            - type: string
            - type: 'null'
          title: Algorithm
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
      type: object
      title: ResourceHash
    QualysDeviceVendorData:
      properties:
        vendor:
          type: string
          enum:
            - qualys
          const: qualys
          title: Vendor
        asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Id
        host_id:
          type: string
          title: Host Id
        tracking_method:
          anyOf:
            - type: string
            - type: 'null'
          title: Tracking Method
      type: object
      required:
        - vendor
        - host_id
      title: QualysDeviceVendorData
    TenableDeviceVendorData:
      properties:
        vendor:
          type: string
          enum:
            - tenable
          const: tenable
          title: Vendor
          default: tenable
        is_licensed:
          type: boolean
          title: Is Licensed
        first_seen:
          anyOf:
            - type: string
            - type: 'null'
          title: First Seen
        last_seen:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Seen
      type: object
      required:
        - is_licensed
      title: TenableDeviceVendorData
    OrcaResourceVendorAttributesData:
      properties:
        vendor:
          type: string
          enum:
            - ORCA
          const: ORCA
          title: Vendor
          default: ORCA
        category:
          type: string
          title: Category
        subcategory:
          type: string
          title: Subcategory
        type:
          type: string
          title: Type
      type: object
      required:
        - category
        - subcategory
        - type
      title: OrcaResourceVendorAttributesData
    ResourceHostAgentVendorAttributes:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Vendor ID of the agent
        policies:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Policies
          description: Policies associated with the agent
      type: object
      title: ResourceHostAgentVendorAttributes
  securitySchemes:
    Connection-ID:
      type: apiKey
      in: header
      name: X-CONNECTION-ID
    API-Key:
      type: apiKey
      in: header
      name: X-API-KEY

````