{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/commercetools/main/json-schema/commercetools-record-paged-query-response-schema.json",
  "title": "RecordPagedQueryResponse",
  "description": "Paginated response containing a list of change history records.",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commercetools-change-history-api-openapi.yml#/components/schemas/RecordPagedQueryResponse",
  "type": "object",
  "required": [
    "limit",
    "offset",
    "count",
    "total",
    "results"
  ],
  "properties": {
    "limit": {
      "type": "integer",
      "description": "Maximum number of records returned."
    },
    "offset": {
      "type": "integer",
      "description": "Number of records skipped."
    },
    "count": {
      "type": "integer",
      "description": "Number of records in this page."
    },
    "total": {
      "type": "integer",
      "description": "Total number of matching records."
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Record"
      },
      "description": "The change history records on this page."
    }
  },
  "$defs": {
    "Change": {
      "type": "object",
      "description": "A single field-level change within a change history record.",
      "required": [
        "change",
        "type"
      ],
      "properties": {
        "change": {
          "type": "string",
          "description": "The name of the update action that caused this change (e.g., 'setCustomField', 'changeOrderState')."
        },
        "type": {
          "type": "string",
          "description": "The type identifier of this change entry."
        },
        "previousValue": {
          "description": "The field value before the change was applied."
        },
        "nextValue": {
          "description": "The field value after the change was applied."
        }
      }
    },
    "ModifiedBy": {
      "type": "object",
      "description": "Information about the actor who made the change.",
      "properties": {
        "id": {
          "type": "string",
          "description": "System-generated ID of the user or client."
        },
        "type": {
          "type": "string",
          "enum": [
            "user",
            "external-user",
            "customer",
            "key"
          ],
          "description": "The type of actor that made the change."
        },
        "clientId": {
          "type": "string",
          "description": "ID of the API client used to make the change."
        },
        "anonymousId": {
          "type": "string",
          "description": "Anonymous session ID if the change was made without a customer login."
        },
        "customer": {
          "$ref": "#/$defs/Reference"
        },
        "isPlatformClient": {
          "type": "boolean",
          "description": "Whether the change was made via the Merchant Center."
        }
      }
    },
    "Record": {
      "type": "object",
      "description": "A change history record capturing a set of changes applied to a resource in a single operation, along with actor and timestamp metadata.",
      "required": [
        "id",
        "resource",
        "resourceType",
        "changes",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "System-generated unique identifier for the record."
        },
        "resource": {
          "$ref": "#/$defs/Reference"
        },
        "resourceVersion": {
          "type": "integer",
          "description": "The version of the resource after these changes were applied."
        },
        "resourceType": {
          "type": "string",
          "description": "The type of resource that was changed."
        },
        "changes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Change"
          },
          "description": "List of individual field-level changes captured in this record."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp when the changes were made."
        },
        "createdBy": {
          "$ref": "#/$defs/ModifiedBy"
        },
        "label": {
          "type": "object",
          "description": "A label identifying the changed resource (e.g., product name, order number)."
        },
        "previousVersion": {
          "type": "integer",
          "description": "The version of the resource before these changes were applied."
        },
        "type": {
          "type": "string",
          "description": "The type of modification (e.g., 'update', 'create', 'delete')."
        }
      }
    },
    "Reference": {
      "type": "object",
      "description": "A reference to another resource by typeId and id.",
      "required": [
        "typeId",
        "id"
      ],
      "properties": {
        "typeId": {
          "type": "string",
          "description": "The type identifier of the referenced resource."
        },
        "id": {
          "type": "string",
          "description": "The system-generated unique identifier of the referenced resource."
        }
      }
    }
  }
}