NinjaOne Asset Tags API

The Asset Tags API from NinjaOne — 6 operation(s) for asset tags.

OpenAPI Specification

ninjaone-asset-tags-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: NinjaOne Public API 2.0 Asset Tags API
  description: NinjaOne Public API documentation.
  contact:
    email: api@ninjarmm.com
  version: 2.0.9-draft
security:
- oauth2:
  - monitoring
  - management
  - control
- sessionKey:
  - monitoring
  - management
  - control
tags:
- name: Asset Tags
paths:
  /v2/tag/{assetType}:
    post:
      tags:
      - Asset Tags
      summary: Batch tag assets
      description: Update tags for the supplied assetIds. Tags will be added and removed as specified
      operationId: batchUpdateTags
      parameters:
      - name: assetType
        in: path
        required: true
        schema:
          type: string
          enum:
          - device
      requestBody:
        description: Payload supplying the asset ids to modify, as well as tags to add/remove from those assets
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItamManageAssetRequestPublicApiDTO'
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /v2/tag:
    get:
      tags:
      - Asset Tags
      summary: Get Asset Tags
      description: Get a list of created Asset Tags
      operationId: getTags
      responses:
        '200':
          description: Returns a list of tags
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetItamTagsResponse'
    post:
      tags:
      - Asset Tags
      summary: Create an Asset Tag
      description: Create an Asset Tag with the provided name and description
      operationId: createTag
      requestBody:
        description: The Asset Tag to be created
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateItamTagRequest'
      responses:
        '200':
          description: The Asset Tag that was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ItamTagPublicApiDTO'
  /v2/tag/{tagId}:
    put:
      tags:
      - Asset Tags
      summary: Update an Asset Tag
      description: Update an Asset Tag with the provided metadata
      operationId: updateTag
      parameters:
      - name: tagId
        in: path
        required: true
        schema:
          type: integer
          format: int32
      requestBody:
        description: Updated Asset Tag data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateItamTagRequest'
      responses:
        '200':
          description: The Asset Tag that was updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ItamTagPublicApiDTO'
    delete:
      tags:
      - Asset Tags
      summary: Delete an Asset Tag
      description: Delete the Asset Tag with the provided id
      operationId: deleteTag
      parameters:
      - name: tagId
        in: path
        required: true
        schema:
          type: integer
          format: int32
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /v2/tag/delete:
    post:
      tags:
      - Asset Tags
      summary: Delete several Asset Tags
      description: Delete Asset Tags having the provided ids
      operationId: deleteTags
      requestBody:
        description: Array of Asset Tag Ids to delete
        content:
          application/json:
            schema:
              type: array
              items:
                type: integer
                format: int32
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /v2/tag/merge:
    post:
      tags:
      - Asset Tags
      summary: Merge existing tags
      description: Merges tags. Can merge into an existing or new tag depending on the input parameters
      operationId: mergeTags
      requestBody:
        description: Payload specifying the tags to merge, as well as whether they should be merge to a new or existing tag
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeItamTagsPublicApiRequest'
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ItamTagPublicApiDTO'
  /v2/tag/{assetType}/{assetId}:
    put:
      tags:
      - Asset Tags
      description: Set the tags for an asset to exactly the supplied values
      operationId: setTagsForAsset
      parameters:
      - name: assetType
        in: path
        required: true
        schema:
          type: string
          enum:
          - device
      - name: assetId
        in: path
        required: true
        schema:
          type: integer
          format: int32
      requestBody:
        description: Array of Asset Tags to assign to the asset. Existing tags on the asset will be removed.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItamSetAssetTagsRequestPublicApiDTO'
      responses:
        default:
          description: default response
          content:
            application/json: {}
components:
  schemas:
    ItamTagPublicApiDTO:
      type: object
      properties:
        id:
          type: integer
          description: Tag ID
          format: int32
        name:
          type: string
          description: Tag name
        description:
          type: string
          description: Description of the tag
        createTime:
          type: number
          description: Creation time for the tag in seconds since unix epoch
          format: double
        updateTime:
          type: number
          description: Last update time for the tag in seconds since unix epoch
          format: double
        createdByUserId:
          type: integer
          description: Id of the user that created the tag
          format: int32
        updatedByUserId:
          type: integer
          description: Id of the user that last updated the the tag
          format: int32
    UpdateItamTagRequest:
      type: object
      properties:
        name:
          maxLength: 40
          minLength: 0
          type: string
        description:
          maxLength: 250
          minLength: 0
          type: string
    ItamManageAssetRequestPublicApiDTO:
      type: object
      properties:
        assetIds:
          uniqueItems: true
          type: array
          description: Array of asset IDs to perform bulk operations on (provide the type of asset with the URL)
          items:
            type: integer
            description: Array of asset IDs to perform bulk operations on (provide the type of asset with the URL)
            format: int32
        tagIdsToAdd:
          uniqueItems: true
          type: array
          description: Array of tag IDs to add to the supplied assets
          items:
            type: integer
            description: Array of tag IDs to add to the supplied assets
            format: int32
        tagIdsToRemove:
          uniqueItems: true
          type: array
          description: Array of tag IDs to remove from the supplied assets
          items:
            type: integer
            description: Array of tag IDs to remove from the supplied assets
            format: int32
    UserBasicInfo:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
        email:
          type: string
    MergeItamTagsPublicApiRequest:
      type: object
      properties:
        tagIds:
          uniqueItems: true
          type: array
          description: Array of tag ids to merge
          items:
            type: integer
            description: Array of tag ids to merge
            format: int32
        mergeMethod:
          type: string
          description: Method to use - merge into an existing tag or create a new one
          enum:
          - MERGE_INTO_EXISTING_TAG
          - MERGE_INTO_NEW_TAG
        mergeIntoTagId:
          type: integer
          description: If merging into an existing tag, you must provide the target tag id here
          format: int32
          nullable: true
        name:
          maxLength: 40
          minLength: 0
          type: string
          description: If creating a new tag, you must supply the new tag name here
          nullable: true
        description:
          maxLength: 250
          minLength: 0
          type: string
          description: If creating a new tag, you can supply the new tag description here
          nullable: true
    ItamTagDTO:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
        description:
          type: string
        createTime:
          type: number
          format: double
        updateTime:
          type: number
          format: double
        createdByUserId:
          type: integer
          format: int32
        updatedByUserId:
          type: integer
          format: int32
        targetsCount:
          type: integer
          format: int32
        createdBy:
          $ref: '#/components/schemas/UserBasicInfo'
        updatedBy:
          $ref: '#/components/schemas/UserBasicInfo'
    GetItamTagsResponse:
      type: object
      properties:
        tags:
          type: array
          items:
            $ref: '#/components/schemas/ItamTagDTO'
    CreateItamTagRequest:
      type: object
      properties:
        name:
          maxLength: 40
          minLength: 1
          type: string
        description:
          maxLength: 250
          minLength: 0
          type: string
    ItamSetAssetTagsRequestPublicApiDTO:
      type: object
      properties:
        tagIds:
          uniqueItems: true
          type: array
          description: Array of tag IDS to assign to asset from URL. The tags on the asset will be set to exactly these tags, removing existing tags if necessary
          items:
            type: integer
            description: Array of tag IDS to assign to asset from URL. The tags on the asset will be set to exactly these tags, removing existing tags if necessary
            format: int32
  securitySchemes:
    oauth2:
      type: http
      scheme: bearer
      bearerFormat: bearer
    sessionKey:
      type: apiKey
      name: sessionKey
      in: cookie