---
title: "Create multiple asset relationships"
method: POST
path: "/v2/itam/asset-relationship"
tags: ["Asset Relationships"]
---

# Create multiple asset relationships

`POST /v2/itam/asset-relationship`

Creates one or more relationships between assets. Returns both successful creations and any failures.

## Request body

- object[]
  - `sourceId` integer — Unique identifier of the source entity
  - `sourceType` 'DEVICE' | 'CHECKLIST' | 'CONTACT' | 'CREDENTIAL' | 'APPS_SERVICES_DOCUMENT' | 'TECHNICIAN' | 'END_USER' | 'KB_ARTICLE' | 'LOCATION' | 'ORGANIZATION' — Type of the source entity
  - `targetId` integer — Unique identifier of the target entity
  - `targetType` 'DEVICE' | 'CHECKLIST' | 'CONTACT' | 'CREDENTIAL' | 'APPS_SERVICES_DOCUMENT' | 'TECHNICIAN' | 'END_USER' | 'KB_ARTICLE' | 'LOCATION' | 'ORGANIZATION' — Type of the target entity
  - `relationshipTypeId` integer — Unique identifier of the relationship type

## Response `200`

Partial or full success - returns successfully created relationships and any errors

- object
  - `successfulRelationships` object[] — List of successfully created relationships
    - `relationId` integer — Unique identifier of the relationship
    - `source` object — Target asset in the relationship
      - `id` integer — Unique identifier of the asset
      - `entityType` 'DEVICE' | 'CHECKLIST' | 'CONTACT' | 'CREDENTIAL' | 'APPS_SERVICES_DOCUMENT' | 'TECHNICIAN' | 'END_USER' | 'KB_ARTICLE' | 'LOCATION' | 'ORGANIZATION' — Type of the entity
      - `name` string — Name of the asset
      - `clientId` integer — Client identifier, if applicable
    - `target` object — Target asset in the relationship
      - `id` integer — Unique identifier of the asset
      - `entityType` 'DEVICE' | 'CHECKLIST' | 'CONTACT' | 'CREDENTIAL' | 'APPS_SERVICES_DOCUMENT' | 'TECHNICIAN' | 'END_USER' | 'KB_ARTICLE' | 'LOCATION' | 'ORGANIZATION' — Type of the entity
      - `name` string — Name of the asset
      - `clientId` integer — Client identifier, if applicable
    - `relation` object — Type of the relationship
      - `id` integer — Unique identifier of the relation type
      - `forwardLabel` string — Label for the forward direction
      - `reverseLabel` string — Label for the reverse direction
      - `systemDefault` boolean — Whether this is a system default relation
  - `errors` object[] — List of failed relationship creation attempts
    - `requestIndex` integer — Index of the failed request in the original array (zero-based)
    - `request` object
      - `sourceId` integer — Unique identifier of the source entity
      - `sourceType` 'DEVICE' | 'CHECKLIST' | 'CONTACT' | 'CREDENTIAL' | 'APPS_SERVICES_DOCUMENT' | 'TECHNICIAN' | 'END_USER' | 'KB_ARTICLE' | 'LOCATION' | 'ORGANIZATION' — Type of the source entity
      - `targetId` integer — Unique identifier of the target entity
      - `targetType` 'DEVICE' | 'CHECKLIST' | 'CONTACT' | 'CREDENTIAL' | 'APPS_SERVICES_DOCUMENT' | 'TECHNICIAN' | 'END_USER' | 'KB_ARTICLE' | 'LOCATION' | 'ORGANIZATION' — Type of the target entity
      - `relationshipTypeId` integer — Unique identifier of the relationship type
    - `errorCode` string — Error code indicating the failure reason
    - `errorMessage` string — Human-readable error message

## Other responses

- `400` — Bad request - All requests failed, invalid input, batch size exceeded, or duplicates found
- `401` — Unauthorized
- `403` — Forbidden - Missing required permissions

---

[API](https://skmtc.net/ninjarmm/apis/ninjaone-public-api-2-0.md) · [All operations](https://skmtc.net/ninjarmm/apis/ninjaone-public-api-2-0/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ninjarmm/ninjaone-public-api-2-0/revisions/753f26d46650/schema)
