{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/kontaktio/main/json-schema/kontaktio-entity-create-update-dto-schema.json",
  "title": "EntityCreateDto",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kontaktio-entity-integration-api-openapi.yml#/components/schemas/EntityCreateUpdateDto",
  "type": "object",
  "properties": {
    "entityId": {
      "type": "string",
      "description": "A unique identifier for the entity. Required for both creating new entities and updating existing ones.",
      "minLength": 2,
      "maxLength": 36
    },
    "name": {
      "type": "string",
      "description": "The name of the entity (e.g. \"IV Pump 1234\" or \"John Smith\").",
      "minLength": 2,
      "maxLength": 36
    },
    "entityTypeId": {
      "type": "string",
      "description": "The ID of an existing Entity Type defined in the Kontakt.io platform."
    },
    "trackingId": {
      "type": "string",
      "description": "The MAC address of the device (e.g. Smart Badge or Tag) assigned to this entity. Will be validated against registered devices in the Device Management API."
    },
    "virtualTrackingId": {
      "type": "array",
      "description": "Virtual Device MAC address assigned to this entity.  Is not validated against registered devices in the Device Management API.\n",
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "status": {
      "$ref": "#/$defs/EntityStatus"
    },
    "attributes": {
      "type": "array",
      "description": "A list of key-value pairs that describe the entity (e.g. `Role: Nurse`).  These must match defined attributes on the entity type.\n",
      "items": {
        "$ref": "#/$defs/Attribute"
      }
    }
  },
  "required": [
    "entityId",
    "name",
    "entityTypeId",
    "status"
  ],
  "$defs": {
    "Attribute": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Id of attribute definition on EntityType level. If not provided attribute will be matched by name if the same name exists  If no match is found, the attribute will be ignored.\n"
        },
        "name": {
          "type": "string",
          "description": "The name of the attribute (e.g. \"Department\", \"Role\")."
        },
        "value": {
          "type": "string",
          "description": "The attribute's value (e.g. \"Radiology\", \"Technician\")."
        }
      },
      "required": [
        "name",
        "value"
      ]
    },
    "EntityStatus": {
      "type": "string",
      "enum": [
        "ACTIVE",
        "DEACTIVATED",
        "DELETED"
      ],
      "description": "Indicates the current lifefcyle of the entity:   - `ACTIVE`: Fully operational.   - `DEACTIVATED`: Entity position data is collected, but not monitored by alert rules (alerts and notfications are disabled). - `DELETED`: Entity is archived and hidden from the UI. The `entityId` can be restored or re-registered with a new entity.\n"
    }
  }
}