{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-ai-search/json-schema/azure-ai-search-knowledge-source-status-schema.json",
  "title": "KnowledgeSourceStatus",
  "description": "Represents the status and synchronization history of a knowledge source.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/azure-ai-search-knowledgesources-sourcename-api-openapi.yml#/components/schemas/KnowledgeSourceStatus",
  "type": "object",
  "properties": {
    "kind": {
      "$ref": "#/$defs/KnowledgeSourceKind",
      "description": "Identifies the Knowledge Source kind directly from the Status response."
    },
    "synchronizationStatus": {
      "$ref": "#/$defs/KnowledgeSourceSynchronizationStatus",
      "description": "The current synchronization status."
    },
    "synchronizationInterval": {
      "type": [
        "string",
        "null"
      ],
      "description": "The synchronization interval (e.g., '1d' for daily). Null if no schedule is configured."
    },
    "currentSynchronizationState": {
      "$ref": "#/$defs/SynchronizationState",
      "description": "Current synchronization state that spans multiple indexer runs."
    },
    "lastSynchronizationState": {
      "$ref": "#/$defs/CompletedSynchronizationState",
      "description": "Details of the last completed synchronization. Null on first sync."
    },
    "statistics": {
      "$ref": "#/$defs/KnowledgeSourceStatistics",
      "description": "Statistical information about the knowledge source synchronization history. Null on first sync."
    },
    "fileCapacity": {
      "$ref": "#/$defs/KnowledgeSourceFileCapacity",
      "description": "File upload capacity for a File knowledge source. Omitted for other knowledge source kinds.",
      "readOnly": true
    }
  },
  "required": [
    "synchronizationStatus"
  ],
  "$defs": {
    "CompletedSynchronizationState": {
      "type": "object",
      "description": "Represents the completed state of the last synchronization.",
      "properties": {
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "The start time of the last completed synchronization."
        },
        "endTime": {
          "type": "string",
          "format": "date-time",
          "description": "The end time of the last completed synchronization."
        },
        "itemsUpdatesProcessed": {
          "type": "integer",
          "format": "int32",
          "description": "The number of item updates successfully processed in the last synchronization."
        },
        "itemsUpdatesFailed": {
          "type": "integer",
          "format": "int32",
          "description": "The number of item updates that failed in the last synchronization."
        },
        "itemsSkipped": {
          "type": "integer",
          "format": "int32",
          "description": "The number of items skipped in the last synchronization."
        }
      },
      "required": [
        "startTime",
        "endTime",
        "itemsUpdatesProcessed",
        "itemsUpdatesFailed",
        "itemsSkipped"
      ]
    },
    "KnowledgeSourceFileCapacity": {
      "type": "object",
      "description": "File upload capacity for a File knowledge source.",
      "properties": {
        "maxFileCount": {
          "type": "integer",
          "format": "int32",
          "description": "The maximum number of files allowed in the knowledge source.",
          "readOnly": true
        },
        "remainingFileCount": {
          "type": "integer",
          "format": "int32",
          "description": "The number of additional files that can be uploaded at the time of the request.",
          "readOnly": true
        },
        "maxFileSizeBytes": {
          "type": "integer",
          "format": "int64",
          "description": "The maximum size in bytes of an individual uploaded file.",
          "readOnly": true
        }
      },
      "required": [
        "maxFileCount",
        "remainingFileCount",
        "maxFileSizeBytes"
      ]
    },
    "KnowledgeSourceKind": {
      "type": "string",
      "description": "The kind of the knowledge source.",
      "enum": [
        "searchIndex",
        "azureBlob",
        "indexedSharePoint",
        "indexedOneLake",
        "indexedSql",
        "web",
        "file"
      ],
      "x-ms-enum": {
        "name": "KnowledgeSourceKind",
        "modelAsString": true,
        "values": [
          {
            "name": "SearchIndex",
            "value": "searchIndex",
            "description": "A knowledge source that reads data from a Search Index."
          },
          {
            "name": "AzureBlob",
            "value": "azureBlob",
            "description": "A knowledge source that read and ingest data from Azure Blob Storage to a Search Index."
          },
          {
            "name": "IndexedSharePoint",
            "value": "indexedSharePoint",
            "description": "A knowledge source that reads data from indexed SharePoint."
          },
          {
            "name": "IndexedOneLake",
            "value": "indexedOneLake",
            "description": "A knowledge source that reads data from indexed OneLake."
          },
          {
            "name": "IndexedSql",
            "value": "indexedSql",
            "description": "A knowledge source that retrieves and ingests data from Azure SQL Database or SQL Managed Instance to a Search Index."
          },
          {
            "name": "Web",
            "value": "web",
            "description": "A knowledge source that reads data from the web."
          },
          {
            "name": "File",
            "value": "file",
            "description": "A knowledge source that supports direct file upload and indexing."
          }
        ]
      }
    },
    "KnowledgeSourceStatistics": {
      "type": "object",
      "description": "Statistical information about knowledge source synchronization history.",
      "properties": {
        "totalSynchronization": {
          "type": "integer",
          "format": "int32",
          "description": "Total number of synchronizations."
        },
        "averageSynchronizationDuration": {
          "type": "string",
          "description": "Average synchronization duration in HH:MM:SS format."
        },
        "averageItemsProcessedPerSynchronization": {
          "type": "integer",
          "format": "int32",
          "description": "Average items processed per synchronization."
        }
      },
      "required": [
        "totalSynchronization",
        "averageSynchronizationDuration",
        "averageItemsProcessedPerSynchronization"
      ]
    },
    "KnowledgeSourceSynchronizationError": {
      "type": "object",
      "description": "Represents a document-level indexing error encountered during a knowledge source synchronization run.",
      "properties": {
        "docId": {
          "type": "string",
          "description": "The unique identifier for the failed document or item within the synchronization run."
        },
        "statusCode": {
          "type": "integer",
          "format": "int32",
          "description": "HTTP-like status code representing the failure category (e.g., 400)."
        },
        "name": {
          "type": "string",
          "description": "Name of the ingestion or processing component reporting the error."
        },
        "errorMessage": {
          "type": "string",
          "description": "Human-readable, customer-visible error message."
        },
        "details": {
          "type": "string",
          "description": "Additional contextual information about the failure."
        },
        "documentationLink": {
          "type": "string",
          "description": "A link to relevant troubleshooting documentation."
        }
      },
      "required": [
        "errorMessage"
      ]
    },
    "KnowledgeSourceSynchronizationStatus": {
      "type": "string",
      "description": "The current synchronization status of the knowledge source.",
      "enum": [
        "creating",
        "active",
        "deleting"
      ],
      "x-ms-enum": {
        "name": "KnowledgeSourceSynchronizationStatus",
        "modelAsString": true,
        "values": [
          {
            "name": "Creating",
            "value": "creating",
            "description": "The knowledge source is being provisioned."
          },
          {
            "name": "Active",
            "value": "active",
            "description": "The knowledge source is active and synchronization runs are occurring."
          },
          {
            "name": "Deleting",
            "value": "deleting",
            "description": "The knowledge source is being deleted and synchronization is paused."
          }
        ]
      }
    },
    "SynchronizationState": {
      "type": "object",
      "description": "Represents the current state of an ongoing synchronization that spans multiple indexer runs.",
      "properties": {
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "The start time of the current synchronization."
        },
        "itemsUpdatesProcessed": {
          "type": "integer",
          "format": "int32",
          "description": "The number of item updates successfully processed in the current synchronization."
        },
        "itemsUpdatesFailed": {
          "type": "integer",
          "format": "int32",
          "description": "The number of item updates that failed in the current synchronization."
        },
        "itemsSkipped": {
          "type": "integer",
          "format": "int32",
          "description": "The number of items skipped in the current synchronization."
        },
        "errors": {
          "type": "array",
          "description": "Collection of document-level indexing errors encountered during the current synchronization run. Returned only when errors are present.",
          "items": {
            "$ref": "#/$defs/KnowledgeSourceSynchronizationError"
          }
        }
      },
      "required": [
        "startTime",
        "itemsUpdatesProcessed",
        "itemsUpdatesFailed",
        "itemsSkipped"
      ]
    }
  }
}