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

# Upsert cable inventory projection (internal)

> Internal upsert, soft-delete, and list endpoint for cable projections.



## OpenAPI

````yaml /openapi/fleet-manager-openapi.yaml post /api/v1/inventory/cable-projections/
openapi: 3.0.3
info:
  title: Fleet Manager API
  version: 1.0.0
  description: API for the Nscale Fleet Manager
servers: []
security: []
paths:
  /api/v1/inventory/cable-projections/:
    post:
      tags:
        - Inventory
      summary: Upsert cable inventory projection (internal)
      description: Internal upsert, soft-delete, and list endpoint for cable projections.
      operationId: api_v1_inventory_cable_projections_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CableProjectionUpsert'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CableProjectionUpsert'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CableProjectionUpsert'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CableProjectionUpsertResponse'
          description: ''
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication credentials were not provided or are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: You do not have permission to perform this action.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - oauth2:
            - inventory:write
        - cookieAuth: []
components:
  schemas:
    CableProjectionUpsert:
      type: object
      description: >-
        Write contract for the cable projection upsert endpoint.


        ``netbox_cable_id`` is the natural key. Exactly one payload group must
        be

        supplied, matching ``link_kind`` — validated here so a mismatch fails
        the

        request instead of tripping the DB check constraint.
      properties:
        netbox_cable_id:
          type: integer
          minimum: 1
        link_kind:
          $ref: '#/components/schemas/CableLinkKindEnum'
        site_netbox_id:
          type: integer
          minimum: 1
        site_slug:
          type: string
          maxLength: 100
          pattern: ^[-a-zA-Z0-9_]+$
        ethernet:
          allOf:
            - $ref: '#/components/schemas/EthernetCableLink'
          nullable: true
        infiniband:
          allOf:
            - $ref: '#/components/schemas/InfinibandCableLink'
          nullable: true
        far_datacenter:
          allOf:
            - $ref: '#/components/schemas/FarDatacenter'
          nullable: true
        source_updated_at:
          type: string
          format: date-time
      required:
        - link_kind
        - netbox_cable_id
        - site_netbox_id
        - site_slug
        - source_updated_at
    CableProjectionUpsertResponse:
      type: object
      description: |-
        Response contract for a cable projection upsert.

        Carries the row id and site scope so the agent can build the NATS cable
        postcard (spec 0036 §3.5) without re-reading the row.
      properties:
        id:
          type: string
          format: uuid
        changed:
          type: boolean
        content_hash:
          type: string
        last_synced_at:
          type: string
          format: date-time
        site_netbox_id:
          type: integer
        site_slug:
          type: string
      required:
        - changed
        - content_hash
        - id
        - last_synced_at
        - site_netbox_id
        - site_slug
    ErrorResponse:
      type: object
      description: >-
        Uniform error body for every 4xx/5xx response. `detail` is a
        human-readable message, always present, safe to display to end users.
        `code` is the machine-readable identifier. `field_errors` lists
        per-input-field validation messages and is empty for non-field errors
        (auth, permission, not-found, conflict, server).
      required:
        - detail
        - code
        - field_errors
      properties:
        detail:
          type: string
        code:
          $ref: '#/components/schemas/ErrorCodeEnum'
        field_errors:
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
    CableLinkKindEnum:
      enum:
        - ethernet
        - infiniband
      type: string
      description: |-
        * `ethernet` - Ethernet
        * `infiniband` - InfiniBand
    EthernetCableLink:
      type: object
      description: |-
        Resolved ethernet/console link payload (mirrors ``EthInterfaceLink``).

        String fields that the legacy transforms can emit as ``""`` (region/code
        parsing, asset-type extraction) allow blank; everything else is required
        non-empty because the transforms validate it before emitting a record.
      properties:
        site_id:
          type: string
          maxLength: 64
        dc_region:
          type: string
          maxLength: 255
        dc_code:
          type: string
          maxLength: 255
        start_device:
          type: string
          maxLength: 255
        start_device_type:
          type: string
          maxLength: 64
        start_port:
          type: string
          maxLength: 128
        end_device:
          type: string
          maxLength: 255
        end_device_type:
          type: string
          maxLength: 64
        end_port:
          type: string
          maxLength: 128
        link_type:
          $ref: '#/components/schemas/EthCableLinkTypeEnum'
        link_id:
          type: string
          maxLength: 1024
        bandwidth_gbps:
          type: integer
          nullable: true
      required:
        - dc_code
        - dc_region
        - end_device
        - end_device_type
        - end_port
        - link_id
        - link_type
        - site_id
        - start_device
        - start_device_type
        - start_port
    InfinibandCableLink:
      type: object
      description: |-
        Resolved InfiniBand link payload (mirrors ``IbSwitchLink``).

        Port names are already transposed / RDMA-normalized by the legacy
        transform; rack units and U-heights are NetBox decimals exposed as JSON
        numbers (same convention as the device projection's ``u_height``).
      properties:
        connection_type:
          $ref: '#/components/schemas/IbCableConnectionTypeEnum'
        start_device:
          type: string
          maxLength: 255
        start_port:
          type: string
          maxLength: 128
        start_device_location:
          type: string
          maxLength: 255
        start_data_hall:
          type: string
          maxLength: 255
        start_rack_id:
          type: string
          maxLength: 255
        start_rack_unit:
          type: number
          format: double
          nullable: true
        start_u_height:
          type: number
          format: double
          nullable: true
        end_device:
          type: string
          maxLength: 255
        end_port:
          type: string
          maxLength: 128
        end_device_location:
          type: string
          maxLength: 255
        end_data_hall:
          type: string
          maxLength: 255
        end_rack_id:
          type: string
          maxLength: 255
        end_rack_unit:
          type: number
          format: double
          nullable: true
        end_u_height:
          type: number
          format: double
          nullable: true
        hostname:
          type: string
          nullable: true
          maxLength: 255
        region:
          type: string
          maxLength: 255
        link_type:
          type: string
          maxLength: 64
        speed:
          type: string
          maxLength: 32
        source:
          type: string
          maxLength: 255
        source_cluster:
          type: string
          maxLength: 100
      required:
        - connection_type
        - end_data_hall
        - end_device
        - end_device_location
        - end_port
        - end_rack_id
        - link_type
        - region
        - source
        - source_cluster
        - speed
        - start_data_hall
        - start_device
        - start_device_location
        - start_port
        - start_rack_id
    FarDatacenter:
      type: object
      description: >-
        Cross-DC far-end site's DataCenter attributes (spec 0036 cross-DC
        links).


        Present only on a cross-datacenter ethernet row: the far (end-side) site
        has

        no projected devices, so the connector emits its ``DataCenter`` from
        these

        NetBox site attributes. ``region`` / ``description`` allow null/blank
        because

        NetBox omits them for some sites — but ``description`` is what the
        connector

        parses into ``DCRegionCode``, so a far site missing it fails loud at
        emit

        time (``transform_far_datacenter``) rather than silently shipping a link

        whose far datacenter cannot be rendered.
      properties:
        netbox_id:
          type: integer
          minimum: 1
        name:
          type: string
          maxLength: 255
        region:
          type: string
          nullable: true
          maxLength: 255
        description:
          type: string
          nullable: true
          maxLength: 255
      required:
        - name
        - netbox_id
    ErrorCodeEnum:
      type: string
      description: >-
        Stable machine-readable error identifier. New members may be added
        within this API version; clients must tolerate unknown values.
      enum:
        - error
        - invalid
        - parse_error
        - authentication_failed
        - not_authenticated
        - permission_denied
        - not_found
        - method_not_allowed
        - not_acceptable
        - unsupported_media_type
        - conflict
        - enrollment_infrastructure_reference_pending
        - enrollment_infrastructure_reference_changed
        - unprocessable_entity
        - throttled
        - service_unavailable
    FieldError:
      type: object
      description: One input field's validation messages.
      required:
        - field
        - messages
      properties:
        field:
          type: string
          description: >-
            Dotted path to the offending input field, or to the collection row
            when the whole row is invalid (e.g. `filters.end_date`,
            `memberships.0.role`, `memberships.0`).
        messages:
          type: array
          minItems: 1
          items:
            type: string
    EthCableLinkTypeEnum:
      enum:
        - DeviceInterfaceLink
        - ConsoleLink
      type: string
      description: |-
        * `DeviceInterfaceLink` - Device interface link
        * `ConsoleLink` - Console link
    IbCableConnectionTypeEnum:
      enum:
        - IB_IB
        - IB_SERVER
      type: string
      description: |-
        * `IB_IB` - Switch to switch
        * `IB_SERVER` - Switch to server
  securitySchemes:
    oauth2:
      type: oauth2
      flows: {}
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid

````

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