> ## 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:
  - description: Production API V2 (US)
    url: https://api.leen.dev/v2
  - description: Production API V2 (EU)
    url: https://api.eu-c1.leen.dev/v2
  - description: Production API V2 (APAC)
    url: https://api.ap-se2.leen.dev/v2
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:
        - in: path
          name: resource_id
          required: true
          schema:
            format: uuid
            title: Resource Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceRespModel'
          description: Successful Response
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorException'
          description: Resource not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - API-Key: []
          Connection-ID: []
components:
  schemas:
    ResourceRespModel:
      description: Response model for returning resource details via an API endpoint.
      properties:
        cloud_metadata:
          anyOf:
            - $ref: '#/components/schemas/ResourceCloudMetadata'
            - type: 'null'
          description: Cloud metadata for the resource
        data:
          anyOf:
            - $ref: '#/components/schemas/ResourceContainer'
            - $ref: '#/components/schemas/ResourceHost'
            - $ref: '#/components/schemas/ResourceImage'
            - $ref: '#/components/schemas/ResourceBranch'
            - type: 'null'
          description: Additional data or properties about the resource
          title: Data
        first_seen:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Timestamp when the resource was first seen
          title: First Seen
        groups:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceGroup'
              type: array
            - type: 'null'
          description: Groups associated with the resource
          title: Groups
        id:
          description: Leen's UUID for the resource
          format: uuid
          title: Id
          type: string
        last_seen:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Timestamp when the resource was last seen
          title: Last Seen
        name:
          description: Resource name
          title: Name
          type: string
        state:
          $ref: '#/components/schemas/ResourceStateEnum'
          description: State of the resource
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceTag'
              type: array
            - type: 'null'
          description: List of arbitrary tags/metadata for the resource
          title: Tags
        type:
          $ref: '#/components/schemas/ResourceTypeEnum'
          description: Type of the resource
        url:
          anyOf:
            - type: string
            - type: 'null'
          description: URL associated with the resource
          title: Url
        vendor:
          description: The source vendor of the resource
          title: Vendor
          type: string
        vendor_attributes:
          $ref: '#/components/schemas/ResourceVendorAttributes'
          description: Vendor-specific attributes like IDs
      required:
        - id
        - name
        - type
        - state
        - vendor
        - vendor_attributes
      title: Resource
      type: object
    ErrorException:
      properties:
        detail:
          description: Error message
          title: Detail
          type: string
      required:
        - detail
      title: ErrorException
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ResourceCloudMetadata:
      description: ORM model representing cloud metadata in a resource.
      properties:
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud account identifier
          title: Account Id
        account_name:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud account name
          title: Account Name
        cloud_provider:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud service provider
          title: Cloud Provider
        image_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud image identifier
          title: Image Id
        instance_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud instance identifier
          title: Instance Id
        instance_type:
          anyOf:
            - type: string
            - type: 'null'
          description: Type of cloud instance
          title: Instance Type
        region:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud region
          title: Region
        subnet_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud subnet identifier
          title: Subnet Id
        vpc_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Cloud VPC identifier
          title: Vpc Id
      title: ResourceCloudMetadata
      type: object
    ResourceContainer:
      description: ORM model representing a container in a resource.
      properties:
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: List of hostnames for the container
          title: Hostnames
        image:
          anyOf:
            - type: string
            - type: 'null'
          description: Container image identifier
          title: Image
      title: ResourceContainer
      type: object
    ResourceHost:
      description: ORM model representing a host in a resource.
      properties:
        ad_device_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Active Directory device ID
          title: Ad Device Id
        ad_domain:
          anyOf:
            - type: string
            - type: 'null'
          description: Active Directory domain
          title: Ad Domain
        ad_org_unit:
          anyOf:
            - type: string
            - type: 'null'
          description: Active Directory organizational unit
          title: Ad Org Unit
        ad_site_name:
          anyOf:
            - type: string
            - type: 'null'
          description: Active Directory site name
          title: Ad Site Name
        agents:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceHostAgent'
              type: array
            - type: 'null'
          description: Agent information for the host
          title: Agents
        deleted_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When the host was deleted
          title: Deleted At
        fqdns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Fully qualified domain names of the host
          title: Fqdns
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: List of hostnames for the host
          title: Hostnames
        image:
          anyOf:
            - type: string
            - type: 'null'
          description: Host image identifier
          title: Image
        installed_software:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Installed software on the host
          title: Installed Software
        ipv4s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: IPv4 addresses associated with the host
          title: Ipv4S
        ipv6s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: IPv6 addresses associated with the host
          title: Ipv6S
        is_deleted:
          anyOf:
            - type: boolean
            - type: 'null'
          description: Whether the host is deleted
          title: Is Deleted
        mac_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: MAC addresses associated with the host
          title: Mac Addresses
        os_major_version:
          anyOf:
            - type: integer
            - type: 'null'
          description: Major version of the host's operating system
          title: Os Major Version
        os_minor_version:
          anyOf:
            - type: integer
            - type: 'null'
          description: Minor version of the host's operating system
          title: Os Minor Version
        os_version:
          anyOf:
            - type: string
            - type: 'null'
          description: Full operating system version of the host
          title: Os Version
        platform:
          anyOf:
            - $ref: '#/components/schemas/ResourcePlatformEnum'
            - type: 'null'
          description: Platform on which the host is running
      title: ResourceHost
      type: object
    ResourceImage:
      description: ORM model representing an image in a resource.
      properties:
        hash:
          anyOf:
            - $ref: '#/components/schemas/ResourceHash'
            - type: 'null'
          description: Image hash
        labels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Image labels
          title: Labels
      title: ResourceImage
      type: object
    ResourceBranch:
      description: ORM model representing a branch in a resource.
      properties:
        code_repo:
          anyOf:
            - type: string
            - type: 'null'
          description: Code repository name
          title: Code Repo
        repo_branch_name:
          anyOf:
            - type: string
            - type: 'null'
          description: Repository branch name
          title: Repo Branch Name
      title: ResourceBranch
      type: object
    ResourceGroup:
      description: ORM model representing a groups in a resource.
      properties:
        name:
          description: The name of the group.
          title: Name
          type: string
        uid:
          description: The unique identifier of the group.
          title: Uid
          type: string
      required:
        - name
        - uid
      title: ResourceGroup
      type: object
    ResourceStateEnum:
      enum:
        - ACTIVE
        - IGNORED
        - DELETED
        - INACTIVE
        - QUARANTINED
        - UNKNOWN
      title: ResourceStateEnum
      type: string
    ResourceTag:
      properties:
        key:
          title: Key
          type: string
        source:
          $ref: '#/components/schemas/ResourceTagSourceEnum'
        value:
          title: Value
          type: string
      required:
        - key
        - value
        - source
      title: ResourceTag
      type: object
    ResourceTypeEnum:
      description: Enumeration for resource types.
      enum:
        - BRANCH
        - HOST
        - CONTAINER
        - DEPENDENCY
        - IMAGE
        - REPOSITORY
        - VENDOR
        - KUBERNETES
        - UNKNOWN
      title: ResourceTypeEnum
      type: string
    ResourceVendorAttributes:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/QualysDeviceVendorData'
            - $ref: '#/components/schemas/TenableDeviceVendorData'
            - $ref: '#/components/schemas/OrcaResourceVendorAttributesData'
            - $ref: '#/components/schemas/UpwindResourceVendorAttributesData'
            - $ref: '#/components/schemas/CheckmarxResourceVendorAttributesData'
            - $ref: '#/components/schemas/SocketResourceVendorAttributesData'
            - type: 'null'
          description: Vendor specific data
          title: Data
        id:
          description: Vendor specific ID
          title: Id
          type: string
      required:
        - id
      title: ResourceVendorAttributes
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    ResourceHostAgent:
      description: ORM model representing agent information in a resource.
      properties:
        product:
          description: Product name of the agent
          title: Product
          type: string
        signature_version:
          anyOf:
            - type: string
            - type: 'null'
          description: Signature version of the agent, usually related to EDR agents
          title: Signature Version
        vendor:
          description: Vendor of the agent
          title: Vendor
          type: string
        vendor_attributes:
          anyOf:
            - $ref: '#/components/schemas/ResourceHostAgentVendorAttributes'
            - type: 'null'
          description: Vendor-specific attributes of the agent
        version:
          anyOf:
            - type: string
            - type: 'null'
          description: Version of the agent
          title: Version
      required:
        - vendor
        - product
      title: ResourceHostAgent
      type: object
    ResourcePlatformEnum:
      description: Enumeration for resource platforms.
      enum:
        - WINDOWS
        - LINUX
        - MAC
        - UNKNOWN
      title: ResourcePlatformEnum
      type: string
    ResourceHash:
      properties:
        algorithm:
          anyOf:
            - type: string
            - type: 'null'
          title: Algorithm
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
      title: ResourceHash
      type: object
    ResourceTagSourceEnum:
      description: >-
        Which integration contributed a resource tag.


        Named rather than an inline ``Literal`` so the OpenAPI document carries
        a reusable

        ``ResourceTagSourceEnum`` component. An inline literal generates an
        anonymous,

        differently-named enum type in every SDK language.
      enum:
        - wiz_vms
        - gitlab
        - checkmarx
        - mend
        - qualys
        - aws
        - insight_vm
        - orca
        - blackkite
      title: ResourceTagSourceEnum
      type: string
    QualysDeviceVendorData:
      properties:
        asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Id
        host_id:
          title: Host Id
          type: string
        tracking_method:
          anyOf:
            - type: string
            - type: 'null'
          title: Tracking Method
        vendor:
          const: qualys
          title: Vendor
          type: string
      required:
        - vendor
        - host_id
      title: QualysDeviceVendorData
      type: object
    TenableDeviceVendorData:
      properties:
        first_seen:
          anyOf:
            - type: string
            - type: 'null'
          title: First Seen
        is_licensed:
          title: Is Licensed
          type: boolean
        last_seen:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Seen
        operating_systems:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Operating Systems
        vendor:
          const: tenable
          default: tenable
          title: Vendor
          type: string
      required:
        - is_licensed
      title: TenableDeviceVendorData
      type: object
    OrcaResourceVendorAttributesData:
      properties:
        category:
          title: Category
          type: string
        subcategory:
          title: Subcategory
          type: string
        type:
          title: Type
          type: string
        vendor:
          const: ORCA
          default: ORCA
          title: Vendor
          type: string
      required:
        - category
        - subcategory
        - type
      title: OrcaResourceVendorAttributesData
      type: object
    UpwindResourceVendorAttributesData:
      properties:
        type:
          title: Type
          type: string
        vendor:
          const: UPWIND
          default: UPWIND
          title: Vendor
          type: string
      required:
        - type
      title: UpwindResourceVendorAttributesData
      type: object
    CheckmarxResourceVendorAttributesData:
      properties:
        repo_url_inferred:
          title: Repo Url Inferred
          type: boolean
        vendor:
          const: CHECKMARX
          default: CHECKMARX
          title: Vendor
          type: string
      required:
        - repo_url_inferred
      title: CheckmarxResourceVendorAttributesData
      type: object
    SocketResourceVendorAttributesData:
      properties:
        default_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Default Branch
        slug:
          title: Slug
          type: string
        vendor:
          const: SOCKET
          default: SOCKET
          title: Vendor
          type: string
        workspace:
          anyOf:
            - type: string
            - type: 'null'
          title: Workspace
      required:
        - slug
      title: SocketResourceVendorAttributesData
      type: object
    ResourceHostAgentVendorAttributes:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          description: Vendor ID of the agent
          title: Id
        policies:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Policies associated with the agent
          title: Policies
      title: ResourceHostAgentVendorAttributes
      type: object
  securitySchemes:
    API-Key:
      in: header
      name: X-API-KEY
      type: apiKey
    Connection-ID:
      in: header
      name: X-CONNECTION-ID
      type: apiKey

````

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