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

# Create multiple asset relationships

`POST /v2/itam/asset-relationship`

## Request

- Base URL: `https://app.ninjarmm.com` (the document declares no server; this is the origin it was published from)
- URL: `https://app.ninjarmm.com/v2/itam/asset-relationship`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `sessionKey`
- TypeScript: <https://skmtc.dev/ninjarmm/apis/ninjaone-public-api-2-0/docs/v2/itam/asset-relationship/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Changes

- **2026-07-12** `dec5d4ed264e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/ninjarmm/apis/ninjaone-public-api-2-0/changes/v2/itam/asset-relationship/post.md)

---

[API](https://skmtc.dev/ninjarmm/apis/ninjaone-public-api-2-0.md) - [All operations](https://skmtc.dev/ninjarmm/apis/ninjaone-public-api-2-0/llms.txt) - [OpenAPI document](https://skmtc.dev/ninjarmm/apis/ninjaone-public-api-2-0/revisions/5ce571d1bb71?raw)
