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

# Import Inventory Nodes

> Create or update inventory nodes in bulk. Optionally assign them to a cluster.

This is an upsert. The service matches a node by (name, siteId). For an
existing node, it overwrites the host vars. With ansible_groups, it replaces
the cluster additional.ansibleGroups. Because the operation is an upsert,
both inventory:create and inventory:update are required and scoped to
clusterId. The audit records the acting admin. The prime-admin import command
also needs inventory:read for resolution and collision preflight.



## OpenAPI

````yaml https://api.primeintellect.ai/openapi.json post /api/admin/inventory/nodes
openapi: 3.1.0
info:
  title: PI API
  version: 0.1.0
servers:
  - url: https://api.primeintellect.ai
security: []
paths:
  /api/admin/inventory/nodes:
    post:
      tags:
        - admin-inventory
      summary: Import Inventory Nodes
      description: >-
        Create or update inventory nodes in bulk. Optionally assign them to a
        cluster.


        This is an upsert. The service matches a node by (name, siteId). For an

        existing node, it overwrites the host vars. With ansible_groups, it
        replaces

        the cluster additional.ansibleGroups. Because the operation is an
        upsert,

        both inventory:create and inventory:update are required and scoped to

        clusterId. The audit records the acting admin. The prime-admin import
        command

        also needs inventory:read for resolution and collision preflight.
      operationId: import_inventory_nodes_api_admin_inventory_nodes_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NodeImportRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse_MutationResult_'
        '401':
          description: Authorization failed
        '403':
          description: Insufficient permissions
        '422':
          description: Invalid request data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    NodeImportRequest:
      properties:
        siteId:
          type: string
          title: Siteid
        clusterId:
          anyOf:
            - type: string
            - type: 'null'
          title: Clusterid
        status:
          $ref: '#/components/schemas/InventoryNodeStatusEnum'
          default: ACTIVE
        role:
          $ref: '#/components/schemas/InventoryNodeRoleEnum'
          default: GPU_NODE
        gpuCount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Gpucount
        nodeTypeId:
          anyOf:
            - type: string
            - type: 'null'
          title: Nodetypeid
        ansibleGroups:
          anyOf:
            - type: object
            - type: 'null'
          title: Ansiblegroups
        assignmentType:
          $ref: '#/components/schemas/InventoryNodeAssignmentTypeEnum'
          default: STANDARD
        isController:
          type: boolean
          title: Iscontroller
          default: false
        priceHr:
          anyOf:
            - type: number
            - type: 'null'
          title: Pricehr
        startDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Startdate
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        reassign:
          type: boolean
          title: Reassign
          default: false
        nodes:
          items:
            $ref: '#/components/schemas/NodeImportRow'
          type: array
          maxItems: 1000
          title: Nodes
      type: object
      required:
        - siteId
        - nodes
      title: NodeImportRequest
      description: >-
        Bulk create/upsert nodes (e.g. from a parsed inventory.ini). Batch
        fields apply

        to every node; nodes upsert by (name, site_id). `site_id` is required.
        When

        `cluster_id` is given the nodes are also assigned to that cluster (with
        the shared

        assignment attrs below); otherwise they are just created.
    GenericResponse_MutationResult_:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/MutationResult'
            - type: 'null'
          description: Response data
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Response status
      type: object
      title: GenericResponse[MutationResult]
    ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Errors
      type: object
      required:
        - errors
      title: ErrorResponse
    InventoryNodeStatusEnum:
      type: string
      enum:
        - ACTIVE
        - PLANNED
        - DECOMMISSIONING
        - INVENTORY
        - OFFLINE
        - FAILED
      title: InventoryNodeStatusEnum
    InventoryNodeRoleEnum:
      type: string
      enum:
        - GPU_NODE
        - CPU_NODE
      title: InventoryNodeRoleEnum
    InventoryNodeAssignmentTypeEnum:
      type: string
      enum:
        - STANDARD
        - FAILOVER
      title: InventoryNodeAssignmentTypeEnum
    NodeImportRow:
      properties:
        name:
          type: string
          title: Name
        publicIp:
          anyOf:
            - type: string
            - type: 'null'
          title: Publicip
        publicIpv6:
          anyOf:
            - type: string
            - type: 'null'
          title: Publicipv6
        privateIp:
          anyOf:
            - type: string
            - type: 'null'
          title: Privateip
        privateInterface:
          anyOf:
            - type: string
            - type: 'null'
          title: Privateinterface
        sshUser:
          anyOf:
            - type: string
            - type: 'null'
          title: Sshuser
        serial:
          anyOf:
            - type: string
            - type: 'null'
          title: Serial
        assetTag:
          anyOf:
            - type: string
            - type: 'null'
          title: Assettag
        sshPort:
          anyOf:
            - type: integer
            - type: 'null'
          title: Sshport
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        comments:
          anyOf:
            - type: string
            - type: 'null'
          title: Comments
        storage:
          anyOf:
            - type: object
            - type: 'null'
          title: Storage
        configContext:
          anyOf:
            - type: object
            - type: 'null'
          title: Configcontext
        additional:
          anyOf:
            - type: object
            - type: 'null'
          title: Additional
      type: object
      required:
        - name
      title: NodeImportRow
      description: >-
        One node to upsert. Parsed host vars map to columns; the FE also folds
        the

        shared "optional node fields" JSON into every row (serial/sshPort/… as
        columns,

        storage/configContext/additional merged).
    MutationResult:
      properties:
        operationId:
          type: string
          title: Operationid
        targetId:
          anyOf:
            - type: string
            - type: 'null'
          title: Targetid
        targetName:
          anyOf:
            - type: string
            - type: 'null'
          title: Targetname
        message:
          type: string
          title: Message
        created:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created
        updated:
          anyOf:
            - type: integer
            - type: 'null'
          title: Updated
        assigned:
          anyOf:
            - type: integer
            - type: 'null'
          title: Assigned
      type: object
      required:
        - operationId
        - message
      title: MutationResult
    ErrorDetail:
      properties:
        param:
          type: string
          title: Param
        details:
          type: string
          title: Details
      type: object
      required:
        - param
        - details
      title: ErrorDetail
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````