{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-ad/json-schema/azure-ad-microsoft-graph-activity-history-item-schema.json",
  "title": "microsoft.graph.activityHistoryItem",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/azure-ad-users-useractivity-api-openapi.yml#/components/schemas/microsoft.graph.activityHistoryItem",
  "allOf": [
    {
      "$ref": "#/$defs/microsoft.graph.entity"
    },
    {
      "title": "activityHistoryItem",
      "required": [
        "@odata.type"
      ],
      "type": "object",
      "properties": {
        "activeDurationSeconds": {
          "maximum": 2147483647,
          "minimum": -2147483648,
          "type": [
            "number",
            "null"
          ],
          "description": "Optional. The duration of active user engagement. if not supplied, this is calculated from the startedDateTime and lastActiveDateTime.",
          "format": "int32"
        },
        "createdDateTime": {
          "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
          "type": [
            "string",
            "null"
          ],
          "description": "Set by the server. DateTime in UTC when the object was created on the server.",
          "format": "date-time"
        },
        "expirationDateTime": {
          "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
          "type": [
            "string",
            "null"
          ],
          "description": "Optional. UTC DateTime when the activityHistoryItem will undergo hard-delete. Can be set by the client.",
          "format": "date-time"
        },
        "lastActiveDateTime": {
          "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
          "type": [
            "string",
            "null"
          ],
          "description": "Optional. UTC DateTime when the activityHistoryItem (activity session) was last understood as active or finished - if null, activityHistoryItem status should be Ongoing.",
          "format": "date-time"
        },
        "lastModifiedDateTime": {
          "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
          "type": [
            "string",
            "null"
          ],
          "description": "Set by the server. DateTime in UTC when the object was modified on the server.",
          "format": "date-time"
        },
        "startedDateTime": {
          "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
          "type": "string",
          "description": "Required. UTC DateTime when the activityHistoryItem (activity session) was started. Required for timeline history.",
          "format": "date-time"
        },
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/microsoft.graph.status"
            },
            {
              "type": [
                "object",
                "null"
              ]
            }
          ],
          "description": "Set by the server. A status code used to identify valid objects. Values: active, updated, deleted, ignored."
        },
        "userTimezone": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional. The timezone in which the user's device used to generate the activity was located at activity creation time. Values supplied as Olson IDs in order to support cross-platform representation."
        },
        "activity": {
          "$ref": "#/$defs/microsoft.graph.userActivity"
        },
        "@odata.type": {
          "type": "string"
        }
      }
    }
  ],
  "x-ms-discriminator-value": "#microsoft.graph.activityHistoryItem",
  "$defs": {
    "microsoft.graph.activityHistoryItem": {
      "allOf": [
        {
          "$ref": "#/$defs/microsoft.graph.entity"
        },
        {
          "title": "activityHistoryItem",
          "required": [
            "@odata.type"
          ],
          "type": "object",
          "properties": {
            "activeDurationSeconds": {
              "maximum": 2147483647,
              "minimum": -2147483648,
              "type": [
                "number",
                "null"
              ],
              "description": "Optional. The duration of active user engagement. if not supplied, this is calculated from the startedDateTime and lastActiveDateTime.",
              "format": "int32"
            },
            "createdDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Set by the server. DateTime in UTC when the object was created on the server.",
              "format": "date-time"
            },
            "expirationDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. UTC DateTime when the activityHistoryItem will undergo hard-delete. Can be set by the client.",
              "format": "date-time"
            },
            "lastActiveDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. UTC DateTime when the activityHistoryItem (activity session) was last understood as active or finished - if null, activityHistoryItem status should be Ongoing.",
              "format": "date-time"
            },
            "lastModifiedDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Set by the server. DateTime in UTC when the object was modified on the server.",
              "format": "date-time"
            },
            "startedDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": "string",
              "description": "Required. UTC DateTime when the activityHistoryItem (activity session) was started. Required for timeline history.",
              "format": "date-time"
            },
            "status": {
              "anyOf": [
                {
                  "$ref": "#/$defs/microsoft.graph.status"
                },
                {
                  "type": [
                    "object",
                    "null"
                  ]
                }
              ],
              "description": "Set by the server. A status code used to identify valid objects. Values: active, updated, deleted, ignored."
            },
            "userTimezone": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. The timezone in which the user's device used to generate the activity was located at activity creation time. Values supplied as Olson IDs in order to support cross-platform representation."
            },
            "activity": {
              "$ref": "#/$defs/microsoft.graph.userActivity"
            },
            "@odata.type": {
              "type": "string"
            }
          }
        }
      ],
      "x-ms-discriminator-value": "#microsoft.graph.activityHistoryItem"
    },
    "microsoft.graph.entity": {
      "title": "entity",
      "required": [
        "@odata.type"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier for an entity. Read-only."
        },
        "@odata.type": {
          "type": "string"
        }
      }
    },
    "microsoft.graph.imageInfo": {
      "title": "imageInfo",
      "required": [
        "@odata.type"
      ],
      "type": "object",
      "properties": {
        "addImageQuery": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Optional; parameter used to indicate the server is able to render image dynamically in response to parameterization. For example – a high contrast image"
        },
        "alternateText": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional; alt-text accessible content for the image"
        },
        "alternativeText": {
          "type": [
            "string",
            "null"
          ]
        },
        "iconUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional; URI that points to an icon which represents the application used to generate the activity"
        },
        "@odata.type": {
          "type": "string"
        }
      }
    },
    "microsoft.graph.status": {
      "title": "status",
      "enum": [
        "active",
        "updated",
        "deleted",
        "ignored",
        "unknownFutureValue"
      ],
      "type": "string"
    },
    "microsoft.graph.userActivity": {
      "allOf": [
        {
          "$ref": "#/$defs/microsoft.graph.entity"
        },
        {
          "title": "userActivity",
          "required": [
            "@odata.type"
          ],
          "type": "object",
          "properties": {
            "activationUrl": {
              "type": "string",
              "description": "Required. URL used to launch the activity in the best native experience represented by the appId. Might launch a web-based app if no native app exists."
            },
            "activitySourceHost": {
              "type": "string",
              "description": "Required. URL for the domain representing the cross-platform identity mapping for the app. Mapping is stored either as a JSON file hosted on the domain or configurable via Windows Dev Center. The JSON file is named cross-platform-app-identifiers and is hosted at root of your HTTPS domain, either at the top level domain or include a sub domain. For example: https://contoso.com or https://myapp.contoso.com but NOT https://myapp.contoso.com/somepath. You must have a unique file and domain (or sub domain) per cross-platform app identity. For example, a separate file and domain is needed for Word vs. PowerPoint."
            },
            "appActivityId": {
              "type": "string",
              "description": "Required. The unique activity ID in the context of the app - supplied by caller and immutable thereafter."
            },
            "appDisplayName": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. Short text description of the app used to generate the activity for use in cases when the app is not installed on the user’s local device."
            },
            "contentInfo": {
              "description": "Optional. A custom piece of data - JSON-LD extensible description of content according to schema.org syntax."
            },
            "contentUrl": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. Used in the event the content can be rendered outside of a native or web-based app experience (for example, a pointer to an item in an RSS feed)."
            },
            "createdDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Set by the server. DateTime in UTC when the object was created on the server.",
              "format": "date-time"
            },
            "expirationDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Set by the server. DateTime in UTC when the object expired on the server.",
              "format": "date-time"
            },
            "fallbackUrl": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. URL used to launch the activity in a web-based app, if available."
            },
            "lastModifiedDateTime": {
              "pattern": "^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$",
              "type": [
                "string",
                "null"
              ],
              "description": "Set by the server. DateTime in UTC when the object was modified on the server.",
              "format": "date-time"
            },
            "status": {
              "anyOf": [
                {
                  "$ref": "#/$defs/microsoft.graph.status"
                },
                {
                  "type": [
                    "object",
                    "null"
                  ]
                }
              ],
              "description": "Set by the server. A status code used to identify valid objects. Values: active, updated, deleted, ignored."
            },
            "userTimezone": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional. The timezone in which the user's device used to generate the activity was located at activity creation time; values supplied as Olson IDs in order to support cross-platform representation."
            },
            "visualElements": {
              "$ref": "#/$defs/microsoft.graph.visualInfo"
            },
            "historyItems": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/microsoft.graph.activityHistoryItem"
              },
              "description": "Optional. NavigationProperty/Containment; navigation property to the activity's historyItems.",
              "x-ms-navigationProperty": true
            },
            "@odata.type": {
              "type": "string"
            }
          }
        }
      ],
      "x-ms-discriminator-value": "#microsoft.graph.userActivity"
    },
    "microsoft.graph.visualInfo": {
      "title": "visualInfo",
      "required": [
        "@odata.type"
      ],
      "type": "object",
      "properties": {
        "attribution": {
          "anyOf": [
            {
              "$ref": "#/$defs/microsoft.graph.imageInfo"
            },
            {
              "type": [
                "object",
                "null"
              ]
            }
          ],
          "description": "Optional. JSON object used to represent an icon which represents the application used to generate the activity"
        },
        "backgroundColor": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional. Background color used to render the activity in the UI - brand color for the application source of the activity. Must be a valid hex color"
        },
        "content": {
          "description": "Optional. Custom piece of data - JSON object used to provide custom content to render the activity in the Windows Shell UI"
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional. Longer text description of the user's unique activity (example: document name, first sentence, and/or metadata)"
        },
        "displayText": {
          "type": "string",
          "description": "Required. Short text description of the user's unique activity (for example, document name in cases where an activity refers to document creation)"
        },
        "@odata.type": {
          "type": "string"
        }
      }
    }
  }
}