{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure/json-schema/microsoft-azure-analyze-job-state-schema.json",
  "title": "AnalyzeJobState",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-analyze-api-openapi.yml#/components/schemas/AnalyzeJobState",
  "allOf": [
    {
      "$ref": "#/$defs/AnalyzeJobMetadata"
    },
    {
      "$ref": "#/$defs/TasksState"
    },
    {
      "properties": {
        "errors": {
          "items": {
            "$ref": "#/$defs/TextAnalyticsError"
          },
          "type": "array"
        },
        "statistics": {
          "$ref": "#/$defs/RequestStatistics"
        }
      },
      "type": "object"
    },
    {
      "$ref": "#/$defs/Pagination"
    }
  ],
  "$defs": {
    "AnalyzeJobMetadata": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/JobMetadata"
        },
        {
          "properties": {
            "displayName": {
              "type": "string"
            }
          }
        }
      ]
    },
    "DocumentEntities": {
      "type": "object",
      "required": [
        "id",
        "entities",
        "warnings"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique, non-empty document identifier."
        },
        "entities": {
          "type": "array",
          "description": "Recognized entities in the document.",
          "items": {
            "$ref": "#/$defs/Entity"
          }
        },
        "warnings": {
          "type": "array",
          "description": "Warnings encountered while processing document.",
          "items": {
            "$ref": "#/$defs/TextAnalyticsWarning"
          }
        },
        "statistics": {
          "description": "if showStats=true was specified in the request this field will contain information about the document payload.",
          "$ref": "#/$defs/DocumentStatistics"
        }
      }
    },
    "DocumentError": {
      "type": "object",
      "required": [
        "id",
        "error"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Document Id."
        },
        "error": {
          "type": "object",
          "description": "Document Error.",
          "$ref": "#/$defs/TextAnalyticsError"
        }
      }
    },
    "DocumentKeyPhrases": {
      "type": "object",
      "required": [
        "id",
        "keyPhrases",
        "warnings"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique, non-empty document identifier."
        },
        "keyPhrases": {
          "type": "array",
          "description": "A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document.",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "description": "Warnings encountered while processing document.",
          "items": {
            "$ref": "#/$defs/TextAnalyticsWarning"
          }
        },
        "statistics": {
          "description": "if showStats=true was specified in the request this field will contain information about the document payload.",
          "$ref": "#/$defs/DocumentStatistics"
        }
      }
    },
    "DocumentLinkedEntities": {
      "type": "object",
      "required": [
        "id",
        "entities",
        "warnings"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique, non-empty document identifier."
        },
        "entities": {
          "type": "array",
          "description": "Recognized well known entities in the document.",
          "items": {
            "$ref": "#/$defs/LinkedEntity"
          }
        },
        "warnings": {
          "type": "array",
          "description": "Warnings encountered while processing document.",
          "items": {
            "$ref": "#/$defs/TextAnalyticsWarning"
          }
        },
        "statistics": {
          "description": "if showStats=true was specified in the request this field will contain information about the document payload.",
          "$ref": "#/$defs/DocumentStatistics"
        }
      }
    },
    "DocumentStatistics": {
      "type": "object",
      "required": [
        "charactersCount",
        "transactionsCount"
      ],
      "properties": {
        "charactersCount": {
          "type": "integer",
          "format": "int32",
          "description": "Number of text elements recognized in the document."
        },
        "transactionsCount": {
          "type": "integer",
          "format": "int32",
          "description": "Number of transactions for the document."
        }
      },
      "description": "if showStats=true was specified in the request this field will contain information about the document payload."
    },
    "EntitiesResult": {
      "type": "object",
      "required": [
        "documents",
        "errors",
        "modelVersion"
      ],
      "properties": {
        "documents": {
          "type": "array",
          "description": "Response by document",
          "items": {
            "$ref": "#/$defs/DocumentEntities"
          }
        },
        "errors": {
          "type": "array",
          "description": "Errors by document id.",
          "items": {
            "$ref": "#/$defs/DocumentError"
          }
        },
        "statistics": {
          "$ref": "#/$defs/RequestStatistics"
        },
        "modelVersion": {
          "type": "string",
          "description": "This field indicates which model is used for scoring."
        }
      }
    },
    "Entity": {
      "type": "object",
      "required": [
        "text",
        "category",
        "offset",
        "length",
        "confidenceScore"
      ],
      "properties": {
        "text": {
          "type": "string",
          "description": "Entity text as appears in the request."
        },
        "category": {
          "type": "string",
          "description": "Entity type."
        },
        "subcategory": {
          "type": "string",
          "description": "(Optional) Entity sub type."
        },
        "offset": {
          "type": "integer",
          "format": "int32",
          "description": "Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned."
        },
        "length": {
          "type": "integer",
          "format": "int32",
          "description": "Length for the entity text. Use of different 'stringIndexType' values can affect the length returned."
        },
        "confidenceScore": {
          "type": "number",
          "format": "double",
          "description": "Confidence score between 0 and 1 of the extracted entity."
        }
      }
    },
    "EntityLinkingResult": {
      "type": "object",
      "required": [
        "documents",
        "errors",
        "modelVersion"
      ],
      "properties": {
        "documents": {
          "type": "array",
          "description": "Response by document",
          "items": {
            "$ref": "#/$defs/DocumentLinkedEntities"
          }
        },
        "errors": {
          "type": "array",
          "description": "Errors by document id.",
          "items": {
            "$ref": "#/$defs/DocumentError"
          }
        },
        "statistics": {
          "$ref": "#/$defs/RequestStatistics"
        },
        "modelVersion": {
          "type": "string",
          "description": "This field indicates which model is used for scoring."
        }
      }
    },
    "InnerError": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "InvalidParameterValue",
            "InvalidRequestBodyFormat",
            "EmptyRequest",
            "MissingInputRecords",
            "InvalidDocument",
            "ModelVersionIncorrect",
            "InvalidDocumentBatch",
            "UnsupportedLanguageCode",
            "InvalidCountryHint"
          ],
          "x-ms-enum": {
            "name": "InnerErrorCodeValue",
            "modelAsString": true
          },
          "description": "Error code."
        },
        "message": {
          "type": "string",
          "description": "Error message."
        },
        "details": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Error details."
        },
        "target": {
          "type": "string",
          "description": "Error target."
        },
        "innererror": {
          "$ref": "#/$defs/InnerError",
          "description": "Inner error contains more specific information."
        }
      }
    },
    "JobMetadata": {
      "properties": {
        "createdDateTime": {
          "format": "date-time",
          "type": "string"
        },
        "expirationDateTime": {
          "format": "date-time",
          "type": "string"
        },
        "jobId": {
          "format": "uuid",
          "type": "string"
        },
        "lastUpdateDateTime": {
          "format": "date-time",
          "type": "string"
        },
        "status": {
          "enum": [
            "notStarted",
            "running",
            "succeeded",
            "failed",
            "cancelled",
            "cancelling",
            "partiallyCompleted"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": false,
            "name": "State"
          }
        }
      },
      "required": [
        "jobId",
        "lastUpdateDateTime",
        "createdDateTime",
        "status"
      ],
      "type": "object"
    },
    "KeyPhraseResult": {
      "type": "object",
      "required": [
        "documents",
        "errors",
        "modelVersion"
      ],
      "properties": {
        "documents": {
          "type": "array",
          "description": "Response by document",
          "items": {
            "$ref": "#/$defs/DocumentKeyPhrases"
          }
        },
        "errors": {
          "type": "array",
          "description": "Errors by document id.",
          "items": {
            "$ref": "#/$defs/DocumentError"
          }
        },
        "statistics": {
          "$ref": "#/$defs/RequestStatistics"
        },
        "modelVersion": {
          "type": "string",
          "description": "This field indicates which model is used for scoring."
        }
      }
    },
    "LinkedEntity": {
      "type": "object",
      "required": [
        "name",
        "matches",
        "language",
        "url",
        "dataSource"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Entity Linking formal name."
        },
        "matches": {
          "type": "array",
          "description": "List of instances this entity appears in the text.",
          "items": {
            "$ref": "#/$defs/Match"
          }
        },
        "language": {
          "type": "string",
          "description": "Language used in the data source."
        },
        "id": {
          "type": "string",
          "description": "Unique identifier of the recognized entity from the data source."
        },
        "url": {
          "type": "string",
          "description": "URL for the entity's page from the data source."
        },
        "dataSource": {
          "type": "string",
          "description": "Data source used to extract entity linking, such as Wiki/Bing etc."
        },
        "bingId": {
          "type": "string",
          "description": "Bing Entity Search API unique identifier of the recognized entity."
        }
      }
    },
    "Match": {
      "type": "object",
      "required": [
        "confidenceScore",
        "text",
        "offset",
        "length"
      ],
      "properties": {
        "confidenceScore": {
          "type": "number",
          "format": "double",
          "description": "If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned."
        },
        "text": {
          "type": "string",
          "description": "Entity text as appears in the request."
        },
        "offset": {
          "type": "integer",
          "format": "int32",
          "description": "Start position for the entity match text."
        },
        "length": {
          "type": "integer",
          "format": "int32",
          "description": "Length for the entity match text."
        }
      }
    },
    "Pagination": {
      "properties": {
        "@nextLink": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "PiiDocumentEntities": {
      "type": "object",
      "required": [
        "id",
        "redactedText",
        "entities",
        "warnings"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique, non-empty document identifier."
        },
        "redactedText": {
          "type": "string",
          "description": "Returns redacted text."
        },
        "entities": {
          "type": "array",
          "description": "Recognized entities in the document.",
          "items": {
            "$ref": "#/$defs/Entity"
          }
        },
        "warnings": {
          "type": "array",
          "description": "Warnings encountered while processing document.",
          "items": {
            "$ref": "#/$defs/TextAnalyticsWarning"
          }
        },
        "statistics": {
          "description": "if showStats=true was specified in the request this field will contain information about the document payload.",
          "$ref": "#/$defs/DocumentStatistics"
        }
      }
    },
    "PiiResult": {
      "type": "object",
      "required": [
        "documents",
        "errors",
        "modelVersion"
      ],
      "properties": {
        "documents": {
          "type": "array",
          "description": "Response by document",
          "items": {
            "$ref": "#/$defs/PiiDocumentEntities"
          }
        },
        "errors": {
          "type": "array",
          "description": "Errors by document id.",
          "items": {
            "$ref": "#/$defs/DocumentError"
          }
        },
        "statistics": {
          "$ref": "#/$defs/RequestStatistics"
        },
        "modelVersion": {
          "type": "string",
          "description": "This field indicates which model is used for scoring."
        }
      }
    },
    "RequestStatistics": {
      "type": "object",
      "required": [
        "documentsCount",
        "validDocumentsCount",
        "erroneousDocumentsCount",
        "transactionsCount"
      ],
      "properties": {
        "documentsCount": {
          "type": "integer",
          "format": "int32",
          "description": "Number of documents submitted in the request."
        },
        "validDocumentsCount": {
          "type": "integer",
          "format": "int32",
          "description": "Number of valid documents. This excludes empty, over-size limit or non-supported languages documents."
        },
        "erroneousDocumentsCount": {
          "type": "integer",
          "format": "int32",
          "description": "Number of invalid documents. This includes empty, over-size limit or non-supported languages documents."
        },
        "transactionsCount": {
          "type": "integer",
          "format": "int64",
          "description": "Number of transactions for the request."
        }
      },
      "description": "if showStats=true was specified in the request this field will contain information about the request payload."
    },
    "TaskState": {
      "properties": {
        "lastUpdateDateTime": {
          "format": "date-time",
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "status": {
          "enum": [
            "notStarted",
            "running",
            "succeeded",
            "failed",
            "rejected",
            "cancelled",
            "cancelling"
          ],
          "x-ms-enum": {
            "modelAsString": false,
            "name": "State"
          }
        }
      },
      "required": [
        "status",
        "lastUpdateDateTime"
      ],
      "type": "object"
    },
    "TasksState": {
      "properties": {
        "tasks": {
          "properties": {
            "details": {
              "allOf": [
                {
                  "$ref": "#/$defs/TaskState"
                }
              ],
              "type": "object"
            },
            "completed": {
              "type": "integer"
            },
            "failed": {
              "type": "integer"
            },
            "inProgress": {
              "type": "integer"
            },
            "total": {
              "type": "integer"
            },
            "entityRecognitionTasks": {
              "type": "array",
              "items": {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/TaskState"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "results": {
                        "$ref": "#/$defs/EntitiesResult"
                      }
                    }
                  }
                ]
              }
            },
            "entityRecognitionPiiTasks": {
              "type": "array",
              "items": {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/TaskState"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "results": {
                        "$ref": "#/$defs/PiiResult"
                      }
                    }
                  }
                ]
              }
            },
            "keyPhraseExtractionTasks": {
              "type": "array",
              "items": {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/TaskState"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "results": {
                        "$ref": "#/$defs/KeyPhraseResult"
                      }
                    }
                  }
                ]
              }
            },
            "entityLinkingTasks": {
              "type": "array",
              "items": {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/$defs/TaskState"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "results": {
                        "$ref": "#/$defs/EntityLinkingResult"
                      }
                    }
                  }
                ]
              }
            }
          },
          "required": [
            "total",
            "completed",
            "failed",
            "inProgress"
          ],
          "type": "object"
        }
      },
      "required": [
        "tasks"
      ],
      "type": "object"
    },
    "TextAnalyticsError": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "InvalidRequest",
            "InvalidArgument",
            "InternalServerError",
            "ServiceUnavailable",
            "NotFound"
          ],
          "x-ms-enum": {
            "name": "ErrorCodeValue",
            "modelAsString": false
          },
          "description": "Error code."
        },
        "message": {
          "type": "string",
          "description": "Error message."
        },
        "target": {
          "type": "string",
          "description": "Error target."
        },
        "innererror": {
          "$ref": "#/$defs/InnerError",
          "description": "Inner error contains more specific information."
        },
        "details": {
          "type": "array",
          "description": "Details about specific errors that led to this reported error.",
          "items": {
            "$ref": "#/$defs/TextAnalyticsError"
          }
        }
      }
    },
    "TextAnalyticsWarning": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "LongWordsInDocument",
            "DocumentTruncated"
          ],
          "x-ms-enum": {
            "name": "WarningCodeValue",
            "modelAsString": true
          },
          "description": "Error code."
        },
        "message": {
          "type": "string",
          "description": "Warning message."
        },
        "targetRef": {
          "type": "string",
          "description": "A JSON pointer reference indicating the target object."
        }
      }
    }
  }
}