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

# List Devices

> List all the devices for a given connection.



## OpenAPI

````yaml get /entities/devices
openapi: 3.1.0
info:
  title: Leen Security API
  version: 0.0.1
servers:
  - url: https://api.leen.dev/v1
    description: Production API
  - url: https://api.eu-c1.leen.dev/v1
    description: Production API (EU Region)
  - url: https://api.ap-se2.leen.dev/v1
    description: Production Api (APAC Region)
security: []
paths:
  /entities/devices:
    get:
      tags:
        - entities
      summary: List Devices
      description: List all the devices for a given connection.
      operationId: list_devices
      parameters:
        - name: status
          in: query
          required: false
          schema:
            type: string
            title: Status
        - name: vendor
          in: query
          required: false
          schema:
            type: string
            title: Vendor
        - name: ip
          in: query
          required: false
          schema:
            type: string
            title: Ip
        - name: fqdn
          in: query
          required: false
          schema:
            type: string
            title: Fqdn
        - name: hostname
          in: query
          required: false
          schema:
            type: string
            title: Hostname
        - name: includeDeviceGroups
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Includedevicegroups
        - name: enableCursor
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Enable cursor based pagination instead of default offset-based
              pagination
            default: false
            title: Enablecursor
          description: >-
            Enable cursor based pagination instead of default offset-based
            pagination
        - name: updatedSince
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: >-
              Datetime filter, only return items updated since this datetime.
              Example format: `2021-01-01T00:00:00+00:00`
            title: Updatedsince
          description: >-
            Datetime filter, only return items updated since this datetime.
            Example format: `2021-01-01T00:00:00+00:00`
          example: '2021-01-01T00:00:00+00:00'
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Limit size (page size)
            default: 100
            title: Limit
          description: Limit size (page size)
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Offset index (starting index of page)
            default: 0
            title: Offset
          description: Offset index (starting index of page)
        - name: excludeTotal
          in: query
          required: false
          schema:
            type: boolean
            description: Skips returning the total rows, total is set to null when true
            default: false
            title: Excludetotal
          description: Skips returning the total rows, total is set to null when true
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Skip token to continue from the last item in the previous page
            title: Cursor
          description: Skip token to continue from the last item in the previous page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: >-
                      #/components/schemas/OffsetPaginatedResponse_Union_DeviceRespModel__DeviceWithGroupsRespModel__
                  - $ref: >-
                      #/components/schemas/KeySetPaginatedResponse_Union_DeviceRespModel__DeviceWithGroupsRespModel__
                title: Response List Devices
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
      security:
        - Connection-ID: []
          API-Key: []
components:
  schemas:
    OffsetPaginatedResponse_Union_DeviceRespModel__DeviceWithGroupsRespModel__:
      properties:
        count:
          type: integer
          title: Count
          description: Number of items return in the response
        total:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total
          description: Total number of items that can be returned
        items:
          items:
            anyOf:
              - $ref: '#/components/schemas/DeviceRespModel'
              - $ref: '#/components/schemas/DeviceWithGroupsRespModel'
          type: array
          title: Items
          description: List of items returned in the response
      type: object
      required:
        - count
        - items
      title: >-
        OffsetPaginatedResponse[Union[DeviceRespModel,
        DeviceWithGroupsRespModel]]
    KeySetPaginatedResponse_Union_DeviceRespModel__DeviceWithGroupsRespModel__:
      properties:
        items:
          items:
            anyOf:
              - $ref: '#/components/schemas/DeviceRespModel'
              - $ref: '#/components/schemas/DeviceWithGroupsRespModel'
          type: array
          title: Items
          description: List of items returned in the response
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: Skip token to continue from the last item in the previous page
        previous_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous Cursor
          description: Skip token to continue from the first item in the previous page
      type: object
      required:
        - items
      title: >-
        KeySetPaginatedResponse[Union[DeviceRespModel,
        DeviceWithGroupsRespModel]]
    ErrorResponse:
      properties:
        type:
          type: string
          title: Type
          description: Type of error
        code:
          type: string
          title: Code
          description: Error code
        message:
          type: string
          title: Message
          description: Error message
        detail:
          items:
            type: object
          type: array
          title: Detail
          description: List of error dictionaries
      type: object
      required:
        - type
        - code
        - message
        - detail
      title: ErrorResponse
    DeviceRespModel:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        status:
          $ref: '#/components/schemas/DeviceStatus'
        platform:
          anyOf:
            - $ref: '#/components/schemas/DevicePlatform'
            - type: 'null'
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Hostnames
        os_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Version
        os_major_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Major Version
        os_minor_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Minor Version
        fqdns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Fqdns
        ipv4s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ipv4S
        ipv6s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ipv6S
        mac_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Mac Addresses
        last_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen
        first_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: First Seen
        source_vendors:
          items:
            $ref: '#/components/schemas/DeviceVendor'
          type: array
          title: Source Vendors
        installed_software:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Installed Software
        ad_info:
          anyOf:
            - $ref: '#/components/schemas/DeviceADInfo'
            - type: 'null'
        cloud_metadata:
          anyOf:
            - $ref: '#/components/schemas/AWSMetadata'
            - type: 'null'
          description: CloudMetadata, currently only AWS is supported
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/DeviceTags'
              type: array
            - type: 'null'
          title: Tags
        identities:
          anyOf:
            - items:
                $ref: '#/components/schemas/DeviceIdentity'
              type: array
            - type: 'null'
          title: Identities
        vendor_data:
          anyOf:
            - type: object
            - type: 'null'
          title: Vendor Data
          description: Vendor specific pass through data, values can vary based on vendor
      type: object
      required:
        - id
        - status
        - last_seen
        - first_seen
        - source_vendors
        - installed_software
        - ad_info
      title: Device
    DeviceWithGroupsRespModel:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        status:
          $ref: '#/components/schemas/DeviceStatus'
        platform:
          anyOf:
            - $ref: '#/components/schemas/DevicePlatform'
            - type: 'null'
        hostnames:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Hostnames
        os_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Version
        os_major_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Major Version
        os_minor_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Os Minor Version
        fqdns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Fqdns
        ipv4s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ipv4S
        ipv6s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ipv6S
        mac_addresses:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Mac Addresses
        last_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen
        first_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: First Seen
        source_vendors:
          items:
            $ref: '#/components/schemas/DeviceVendor'
          type: array
          title: Source Vendors
        installed_software:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Installed Software
        ad_info:
          anyOf:
            - $ref: '#/components/schemas/DeviceADInfo'
            - type: 'null'
        cloud_metadata:
          anyOf:
            - $ref: '#/components/schemas/AWSMetadata'
            - type: 'null'
          description: CloudMetadata, currently only AWS is supported
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/DeviceTags'
              type: array
            - type: 'null'
          title: Tags
        identities:
          anyOf:
            - items:
                $ref: '#/components/schemas/DeviceIdentity'
              type: array
            - type: 'null'
          title: Identities
        vendor_data:
          anyOf:
            - type: object
            - type: 'null'
          title: Vendor Data
          description: Vendor specific pass through data, values can vary based on vendor
        device_groups:
          items:
            $ref: '#/components/schemas/DeviceGroupsBase'
          type: array
          title: Device Groups
          description: >-
            Pass in the includeDeviceGroups query parameter to include device
            group information.
          default: []
      type: object
      required:
        - id
        - status
        - last_seen
        - first_seen
        - source_vendors
        - installed_software
        - ad_info
      title: DeviceWithGroups
    DeviceStatus:
      type: string
      enum:
        - active
        - offline
        - quarantined
        - unknown
        - deleted
      title: DeviceStatus
    DevicePlatform:
      type: string
      enum:
        - mac
        - windows
        - linux
        - unknown
      title: DevicePlatform
    DeviceVendor:
      properties:
        vendor:
          type: string
          title: Vendor
        vendor_id:
          type: string
          title: Vendor Id
        agent_info:
          anyOf:
            - $ref: '#/components/schemas/DeviceAgentInfo'
            - type: 'null'
      type: object
      required:
        - vendor
        - vendor_id
      title: DeviceVendor
    DeviceADInfo:
      properties:
        org_unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Unit
        site_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Site Name
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        device_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Device Id
      type: object
      title: DeviceADInfo
    AWSMetadata:
      properties:
        cloud_provider:
          allOf:
            - $ref: '#/components/schemas/CloudProvider'
          default: aws
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Id
        region:
          anyOf:
            - type: string
            - type: 'null'
          title: Region
        availability_zone:
          anyOf:
            - type: string
            - type: 'null'
          title: Availability Zone
        instance_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Id
        instance_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Type
        image_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Id
        kernel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Kernel Id
        vpc_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Vpc Id
        subnet_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Subnet Id
      type: object
      title: AWSMetadata
    DeviceTags:
      properties:
        key:
          type: string
          title: Key
        value:
          type: string
          title: Value
        source:
          $ref: '#/components/schemas/DeviceTagSource'
      type: object
      required:
        - key
        - value
        - source
      title: DeviceTags
    DeviceIdentity:
      properties:
        username:
          type: string
          title: Username
        user_sid:
          anyOf:
            - type: string
            - type: 'null'
          title: User Sid
      type: object
      required:
        - username
      title: DeviceIdentity
    DeviceGroupsBase:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        vendor_id:
          type: string
          title: Vendor Id
        vendor_created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Vendor Created At
        vendor_data:
          anyOf:
            - type: object
            - type: 'null'
          title: Vendor Data
          description: Vendor specific pass through data, values can vary based on vendor
        vendor:
          type: string
          title: Vendor
      type: object
      required:
        - id
        - name
        - vendor_id
        - vendor
      title: DeviceGroupsBase
    DeviceAgentInfo:
      properties:
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        signature_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Signature Version
        policies:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Policies
      type: object
      title: DeviceAgentInfo
    CloudProvider:
      type: string
      enum:
        - aws
      const: aws
      title: CloudProvider
    DeviceTagSource:
      type: string
      enum:
        - aws
        - qualys
        - wiz_vms
      title: DeviceTagSource
  securitySchemes:
    Connection-ID:
      type: apiKey
      in: header
      name: X-CONNECTION-ID
    API-Key:
      type: apiKey
      in: header
      name: X-API-KEY

````