> ## 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 Device by ID

> Retrieve a device by its ID (Leen's UUID).



## OpenAPI

````yaml get /entities/devices/{device_id}
openapi: 3.1.0
info:
  title: Leen Security API
  version: 0.0.1
servers:
  - description: Production API (US)
    url: https://api.leen.dev/v1
  - description: Production API (EU)
    url: https://api.eu-c1.leen.dev/v1
  - description: Production API (APAC)
    url: https://api.ap-se2.leen.dev/v1
security: []
paths:
  /entities/devices/{device_id}:
    get:
      tags:
        - entities
      summary: Get Device by ID
      description: Retrieve a device by its ID (Leen's UUID).
      operationId: get_device_by_id
      parameters:
        - in: path
          name: device_id
          required: true
          schema:
            format: uuid
            title: Device Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceRespModel'
          description: Successful Response
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorException'
          description: Device not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - API-Key: []
          Connection-ID: []
components:
  schemas:
    DeviceRespModel:
      properties:
        ad_info:
          anyOf:
            - $ref: '#/components/schemas/DeviceADInfo'
            - type: 'null'
          description: >-
            Active Directory placement -- organisational unit and site -- where
            the tool reports it.
        cloud_metadata:
          anyOf:
            - $ref: '#/components/schemas/AWSMetadata'
            - type: 'null'
          description: CloudMetadata, currently only AWS is supported
        first_seen:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: >-
            When the tool first registered this device. The tool's own
            timestamp, not when Leen synced it.
          title: First Seen
        fqdns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Fully qualified domain names for this device.
          title: Fqdns
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Hostnames the tool knows this device by. A device can have several.
          title: Hostnames
        id:
          description: Leen's identifier for this device.
          format: uuid
          title: Id
          type: string
        identities:
          anyOf:
            - items:
                $ref: '#/components/schemas/DeviceIdentity'
              type: array
            - type: 'null'
          description: >-
            Accounts associated with the device, such as its last logged-in
            user.
          title: Identities
        installed_software:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Software the tool reported as installed.
          title: Installed Software
        ipv4s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: IPv4 addresses the tool last observed. Not necessarily current.
          title: Ipv4S
        ipv6s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: IPv6 addresses the tool last observed.
          title: Ipv6S
        last_seen:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: >-
            When the tool last had contact with the device. Use it to tell a
            decommissioned machine from one that simply has no findings.
          title: Last Seen
        mac_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: MAC addresses of the device's interfaces.
          title: Mac Addresses
        os_major_version:
          anyOf:
            - type: string
            - type: 'null'
          description: Major version, split out of `os_version` so it can be filtered on.
          title: Os Major Version
        os_minor_version:
          anyOf:
            - type: string
            - type: 'null'
          description: Minor version, split out of `os_version`.
          title: Os Minor Version
        os_version:
          anyOf:
            - type: string
            - type: 'null'
          description: Full operating system version string, as the tool reports it.
          title: Os Version
        platform:
          anyOf:
            - $ref: '#/components/schemas/DevicePlatform'
            - type: 'null'
          description: Operating system family, normalised across tools.
        source_vendors:
          description: >-
            The tool this device came from, and that tool's identifier for it. A
            list because the shape allows several; today a device carries
            exactly one.
          items:
            $ref: '#/components/schemas/DeviceVendor'
          title: Source Vendors
          type: array
        status:
          $ref: '#/components/schemas/DeviceStatus'
          description: >-
            Device state as the tool reports it. `quarantined` means the tool
            has isolated it; `deleted` means the tool no longer returns it.
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/DeviceTags'
              type: array
            - type: 'null'
          description: Tags the tool carries for this device.
          title: Tags
        vendor_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Vendor specific pass through data, values can vary based on vendor
          title: Vendor Data
      required:
        - id
        - status
        - last_seen
        - first_seen
        - source_vendors
        - installed_software
        - ad_info
      title: Device
      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
    DeviceADInfo:
      properties:
        device_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Device Id
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        org_unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Unit
        site_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Site Name
      title: DeviceADInfo
      type: object
    AWSMetadata:
      properties:
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Id
        availability_zone:
          anyOf:
            - type: string
            - type: 'null'
          title: Availability Zone
        cloud_provider:
          $ref: '#/components/schemas/CloudProvider'
          default: aws
        image_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Id
        instance_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Id
        instance_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Type
        kernel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Kernel Id
        region:
          anyOf:
            - type: string
            - type: 'null'
          title: Region
        subnet_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Subnet Id
        vpc_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Vpc Id
      title: AWSMetadata
      type: object
    DeviceIdentity:
      properties:
        user_sid:
          anyOf:
            - type: string
            - type: 'null'
          title: User Sid
        username:
          title: Username
          type: string
      required:
        - username
      title: DeviceIdentity
      type: object
    DevicePlatform:
      enum:
        - mac
        - windows
        - linux
        - unknown
      title: DevicePlatform
      type: string
    DeviceVendor:
      properties:
        agent_info:
          anyOf:
            - $ref: '#/components/schemas/DeviceAgentInfo'
            - type: 'null'
        vendor:
          title: Vendor
          type: string
        vendor_id:
          title: Vendor Id
          type: string
      required:
        - vendor
        - vendor_id
      title: DeviceVendor
      type: object
    DeviceStatus:
      enum:
        - active
        - offline
        - quarantined
        - unknown
        - deleted
      title: DeviceStatus
      type: string
    DeviceTags:
      properties:
        key:
          title: Key
          type: string
        source:
          $ref: '#/components/schemas/DeviceTagSource'
        value:
          title: Value
          type: string
      required:
        - key
        - value
        - source
      title: DeviceTags
      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
    CloudProvider:
      enum:
        - aws
      title: CloudProvider
      type: string
    DeviceAgentInfo:
      properties:
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        policies:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Policies
        signature_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Signature Version
      title: DeviceAgentInfo
      type: object
    DeviceTagSource:
      enum:
        - aws
        - qualys
        - wiz_vms
        - insight_vm
      title: DeviceTagSource
      type: string
  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.