> ## Documentation Index
> Fetch the complete documentation index at: https://www.halite-app.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Packages Route

> Row-level package search. Used by level 3 (minions with one specific
name+version) and as a power-user query endpoint (version comparison,
multi-field filter).



## OpenAPI

````yaml /api/openapi.json post /api/inventory/packages/search
openapi: 3.1.0
info:
  title: Halite
  version: 0.1.0
servers: []
security: []
paths:
  /api/inventory/packages/search:
    post:
      tags:
        - inventory
      summary: Search Packages Route
      description: |-
        Row-level package search. Used by level 3 (minions with one specific
        name+version) and as a power-user query endpoint (version comparison,
        multi-field filter).
      operationId: search_packages_route_api_inventory_packages_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PackageQueryIn'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PackageQueryOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PackageQueryIn:
      properties:
        name:
          anyOf:
            - $ref: '#/components/schemas/NameFilter'
            - type: 'null'
        version:
          anyOf:
            - $ref: '#/components/schemas/VersionFilter'
            - type: 'null'
        source:
          anyOf:
            - type: string
              enum:
                - apt
                - rpm
                - pacman
            - type: 'null'
          title: Source
        minion_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Minion Id
        limit:
          type: integer
          maximum: 5000
          minimum: 1
          title: Limit
          default: 500
        offset:
          type: integer
          minimum: 0
          title: Offset
          default: 0
      type: object
      title: PackageQueryIn
      description: |-
        Filter for ``GET /api/inventory/packages``.

        At least one of ``name`` or ``minion_id`` MUST be supplied — we don't
        want to accidentally let the UI fetch the entire fleet's package list
        in one request. (A future "browse all" endpoint can lift this rule.)
    PackageQueryOut:
      properties:
        total:
          type: integer
          title: Total
        hits:
          items:
            $ref: '#/components/schemas/PackageQueryHit'
          type: array
          title: Hits
        truncated:
          type: boolean
          title: Truncated
          default: false
      type: object
      required:
        - total
        - hits
      title: PackageQueryOut
      description: |-
        Wrapper that lets us tack pagination metadata on later without breaking
        the wire format.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    NameFilter:
      properties:
        op:
          type: string
          enum:
            - eq
            - prefix
            - contains
          title: Op
          default: eq
        value:
          type: string
          maxLength: 255
          minLength: 1
          title: Value
      type: object
      required:
        - value
      title: NameFilter
      description: >-
        A name-side filter. ``op="eq"`` becomes ``name = ?``;

        ``op="prefix"`` becomes ``name LIKE ? || '%'`` (cheap, hits the index);

        ``op="contains"`` becomes ``name LIKE '%' || ? || '%'`` (slower, full
        scan

        of the (name)-indexed range but acceptable at our fleet size).
    VersionFilter:
      properties:
        op:
          type: string
          enum:
            - eq
            - ne
            - lt
            - lte
            - gt
            - gte
          title: Op
        value:
          type: string
          maxLength: 255
          minLength: 1
          title: Value
      type: object
      required:
        - op
        - value
      title: VersionFilter
      description: A version comparison applied per-row in Python after SQL narrowing.
    PackageQueryHit:
      properties:
        minion_id:
          type: string
          title: Minion Id
        name:
          type: string
          title: Name
        version:
          type: string
          title: Version
        arch:
          anyOf:
            - type: string
            - type: 'null'
          title: Arch
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        collected_at:
          type: string
          format: date-time
          title: Collected At
      type: object
      required:
        - minion_id
        - name
        - version
        - collected_at
      title: PackageQueryHit
      description: One row in the response to a package query.
    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

````