{
  "openapi": "3.0.0",
  "info": {
    "contact": {
      "email": "mlapi@microsoft.com",
      "name": "Microsoft Cognitive Services",
      "url": "https://azure.microsoft.com/en-us/services/cognitive-services/text-analytics/"
    },
    "description": "The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview",
    "title": "Text Analytics Client",
    "version": "v2.1",
    "x-jentic-source-url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/TextAnalytics/stable/v2.1/TextAnalytics.json"
  },
  "servers": [
    {
      "url": "{Endpoint}/text/analytics/v2.1",
      "variables": {
        "Endpoint": {
          "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).",
          "x-ms-parameter-location": "client",
          "x-ms-skip-url-encoding": true
        }
      }
    }
  ],
  "paths": {
    "/entities": {
      "post": {
        "parameters": [
          {
            "description": "(optional) if set to true, response will contain input and document level statistics.",
            "in": "query",
            "name": "showStats",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitiesBatchResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitiesBatchResult"
                }
              }
            },
            "description": "A successful call results in a list of recognized entities returned for each valid document"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error Response"
          }
        },
        "tags": [
          "Entities"
        ],
        "deprecated": false,
        "description": "To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href=\"https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages\">Supported languages in Text Analytics API</a> for the list of enabled languages.",
        "operationId": "Entities",
        "requestBody": {
          "$ref": "#/components/requestBodies/MultiLanguageBatchInput"
        },
        "summary": "The API returns a list of recognized entities in a given document.",
        "x-ms-examples": {
          "Successful Detect Language request": {
            "$ref": ".//examples//SuccessfulEntitiesRequest.json"
          }
        }
      }
    },
    "/keyPhrases": {
      "post": {
        "parameters": [
          {
            "description": "(optional) if set to true, response will contain input and document level statistics.",
            "in": "query",
            "name": "showStats",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyPhraseBatchResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyPhraseBatchResult"
                }
              }
            },
            "description": "A successful response results in 0 or more key phrases identified in each valid document"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error Response"
          }
        },
        "tags": [
          "Key Phrases"
        ],
        "deprecated": false,
        "description": "See the <a href=\"https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages\">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction.",
        "operationId": "Key Phrases",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MultiLanguageBatchInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MultiLanguageBatchInput"
              }
            }
          },
          "description": "Collection of documents to analyze. Documents can now contain a language field to indicate the text language"
        },
        "summary": "The API returns a list of strings denoting the key talking points in the input text.",
        "x-ms-examples": {
          "Successful Detect Language request": {
            "$ref": ".//examples//SuccessfulKeyPhrasesRequest.json"
          }
        }
      }
    },
    "/languages": {
      "post": {
        "parameters": [
          {
            "description": "(optional) if set to true, response will contain input and document level statistics.",
            "in": "query",
            "name": "showStats",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LanguageBatchResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LanguageBatchResult"
                }
              }
            },
            "description": "A successful call results in the detected language with the highest probability for each valid document"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error Response"
          }
        },
        "tags": [
          "Detect Language"
        ],
        "deprecated": false,
        "description": "Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported.",
        "operationId": "Detect Language",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LanguageBatchInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LanguageBatchInput"
              }
            }
          },
          "description": "Collection of documents to analyze."
        },
        "summary": "The API returns the detected language and a numeric score between 0 and 1.",
        "x-ms-examples": {
          "Successful Detect Language request": {
            "$ref": ".//examples//SuccessfulLanguagesRequest.json"
          }
        }
      }
    },
    "/sentiment": {
      "post": {
        "parameters": [
          {
            "description": "(optional) if set to true, response will contain input and document level statistics.",
            "in": "query",
            "name": "showStats",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SentimentBatchResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SentimentBatchResult"
                }
              }
            },
            "description": "A successful call results in each valid document getting a sentiment score between 0 and 1"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error Response"
          }
        },
        "tags": [
          "Sentiment"
        ],
        "deprecated": false,
        "description": "Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href=\"https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages\">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis.",
        "operationId": "Sentiment",
        "requestBody": {
          "$ref": "#/components/requestBodies/MultiLanguageBatchInput"
        },
        "summary": "The API returns a numeric score between 0 and 1.",
        "x-ms-examples": {
          "Successful Detect Language request": {
            "$ref": ".//examples//SuccessfulSentimentRequest.json"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Endpoint": {
        "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).",
        "x-ms-parameter-location": "client",
        "x-ms-skip-url-encoding": true
      }
    },
    "requestBodies": {
      "MultiLanguageBatchInput": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MultiLanguageBatchInput"
            }
          },
          "text/json": {
            "schema": {
              "$ref": "#/components/schemas/MultiLanguageBatchInput"
            }
          }
        },
        "description": "Collection of documents to analyze."
      }
    },
    "schemas": {
      "DetectedLanguage": {
        "properties": {
          "iso6391Name": {
            "description": "A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr).",
            "type": "string"
          },
          "name": {
            "description": "Long name of a detected language (e.g. English, French).",
            "type": "string"
          },
          "score": {
            "description": "A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true.",
            "format": "double",
            "type": "number"
          }
        },
        "type": "object"
      },
      "DocumentStatistics": {
        "properties": {
          "charactersCount": {
            "description": "Number of text elements recognized in the document.",
            "format": "int32",
            "type": "integer"
          },
          "transactionsCount": {
            "description": "Number of transactions for the document.",
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "EntitiesBatchResult": {
        "properties": {
          "documents": {
            "description": "Response by document",
            "items": {
              "$ref": "#/components/schemas/EntitiesBatchResultItem"
            },
            "readOnly": true,
            "type": "array"
          },
          "errors": {
            "description": "Errors and Warnings by document",
            "items": {
              "$ref": "#/components/schemas/ErrorRecord"
            },
            "readOnly": true,
            "type": "array"
          },
          "statistics": {
            "$ref": "#/components/schemas/RequestStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the request payload.",
            "readOnly": true
          }
        },
        "type": "object"
      },
      "EntitiesBatchResultItem": {
        "properties": {
          "entities": {
            "description": "Recognized entities in the document.",
            "items": {
              "$ref": "#/components/schemas/EntityRecord"
            },
            "readOnly": true,
            "type": "array"
          },
          "id": {
            "description": "Unique, non-empty document identifier.",
            "type": "string"
          },
          "statistics": {
            "$ref": "#/components/schemas/DocumentStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the document payload."
          }
        },
        "type": "object"
      },
      "EntityRecord": {
        "properties": {
          "bingId": {
            "description": "Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information.",
            "type": "string"
          },
          "matches": {
            "description": "List of instances this entity appears in the text.",
            "items": {
              "$ref": "#/components/schemas/MatchRecord"
            },
            "type": "array"
          },
          "name": {
            "description": "Entity formal name.",
            "type": "string"
          },
          "subType": {
            "description": "Entity sub type from Named Entity Recognition model",
            "type": "string"
          },
          "type": {
            "description": "Entity type from Named Entity Recognition model",
            "type": "string"
          },
          "wikipediaId": {
            "description": "Wikipedia unique identifier of the recognized entity.",
            "type": "string"
          },
          "wikipediaLanguage": {
            "description": "Wikipedia language for which the WikipediaId and WikipediaUrl refers to.",
            "type": "string"
          },
          "wikipediaUrl": {
            "description": "URL for the entity's Wikipedia page.",
            "readOnly": true,
            "type": "string"
          }
        },
        "type": "object"
      },
      "ErrorRecord": {
        "properties": {
          "id": {
            "description": "Input document unique identifier the error refers to.",
            "type": "string"
          },
          "message": {
            "description": "Error message.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ErrorResponse": {
        "properties": {
          "code": {
            "type": "string"
          },
          "innerError": {
            "$ref": "#/components/schemas/InternalError"
          },
          "message": {
            "type": "string"
          },
          "target": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "InternalError": {
        "properties": {
          "code": {
            "type": "string"
          },
          "innerError": {
            "$ref": "#/components/schemas/InternalError"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "KeyPhraseBatchResult": {
        "properties": {
          "documents": {
            "description": "Response by document",
            "items": {
              "$ref": "#/components/schemas/KeyPhraseBatchResultItem"
            },
            "readOnly": true,
            "type": "array"
          },
          "errors": {
            "description": "Errors and Warnings by document",
            "items": {
              "$ref": "#/components/schemas/ErrorRecord"
            },
            "readOnly": true,
            "type": "array"
          },
          "statistics": {
            "$ref": "#/components/schemas/RequestStatistics",
            "description": "=(Optional) if showStats=true was specified in the request this field will contain information about the request payload.",
            "readOnly": true
          }
        },
        "type": "object"
      },
      "KeyPhraseBatchResultItem": {
        "properties": {
          "id": {
            "description": "Unique, non-empty document identifier.",
            "type": "string"
          },
          "keyPhrases": {
            "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"
            },
            "readOnly": true,
            "type": "array"
          },
          "statistics": {
            "$ref": "#/components/schemas/DocumentStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the document payload."
          }
        },
        "type": "object"
      },
      "LanguageBatchInput": {
        "properties": {
          "documents": {
            "items": {
              "$ref": "#/components/schemas/LanguageInput"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "LanguageBatchResult": {
        "properties": {
          "documents": {
            "description": "Response by document",
            "items": {
              "$ref": "#/components/schemas/LanguageBatchResultItem"
            },
            "readOnly": true,
            "type": "array"
          },
          "errors": {
            "description": "Errors and Warnings by document",
            "items": {
              "$ref": "#/components/schemas/ErrorRecord"
            },
            "readOnly": true,
            "type": "array"
          },
          "statistics": {
            "$ref": "#/components/schemas/RequestStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the request payload.",
            "readOnly": true
          }
        },
        "type": "object"
      },
      "LanguageBatchResultItem": {
        "properties": {
          "detectedLanguages": {
            "description": "A list of extracted languages.",
            "items": {
              "$ref": "#/components/schemas/DetectedLanguage"
            },
            "type": "array"
          },
          "id": {
            "description": "Unique, non-empty document identifier.",
            "type": "string"
          },
          "statistics": {
            "$ref": "#/components/schemas/DocumentStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the document payload."
          }
        },
        "type": "object"
      },
      "LanguageInput": {
        "properties": {
          "countryHint": {
            "type": "string"
          },
          "id": {
            "description": "Unique, non-empty document identifier.",
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "MatchRecord": {
        "properties": {
          "entityTypeScore": {
            "description": "(optional) If an entity type is recognized, a decimal number denoting the confidence level of the entity type will be returned.",
            "format": "double",
            "type": "number"
          },
          "length": {
            "description": "Length (in Unicode characters) for the entity match text.",
            "format": "int32",
            "type": "integer"
          },
          "offset": {
            "description": "Start position (in Unicode characters) for the entity match text.",
            "format": "int32",
            "type": "integer"
          },
          "text": {
            "description": "Entity text as appears in the request.",
            "type": "string"
          },
          "wikipediaScore": {
            "description": "(optional) If a well-known item with Wikipedia link is recognized, a decimal number denoting the confidence level of the Wikipedia info will be returned.",
            "format": "double",
            "type": "number"
          }
        },
        "type": "object"
      },
      "MultiLanguageBatchInput": {
        "properties": {
          "documents": {
            "items": {
              "$ref": "#/components/schemas/MultiLanguageInput"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "MultiLanguageInput": {
        "properties": {
          "id": {
            "description": "Unique, non-empty document identifier.",
            "type": "string"
          },
          "language": {
            "description": "This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc.,",
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Object": {
        "properties": {},
        "type": "object"
      },
      "RequestStatistics": {
        "properties": {
          "documentsCount": {
            "description": "Number of documents submitted in the request.",
            "format": "int32",
            "type": "integer"
          },
          "erroneousDocumentsCount": {
            "description": "Number of invalid documents. This includes empty, over-size limit or non-supported languages documents.",
            "format": "int32",
            "type": "integer"
          },
          "transactionsCount": {
            "description": "Number of transactions for the request.",
            "format": "int64",
            "type": "integer"
          },
          "validDocumentsCount": {
            "description": "Number of valid documents. This excludes empty, over-size limit or non-supported languages documents.",
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "SentimentBatchResult": {
        "properties": {
          "documents": {
            "description": "Response by document",
            "items": {
              "$ref": "#/components/schemas/SentimentBatchResultItem"
            },
            "readOnly": true,
            "type": "array"
          },
          "errors": {
            "description": "Errors and Warnings by document",
            "items": {
              "$ref": "#/components/schemas/ErrorRecord"
            },
            "readOnly": true,
            "type": "array"
          },
          "statistics": {
            "$ref": "#/components/schemas/RequestStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the request payload.",
            "readOnly": true
          }
        },
        "type": "object"
      },
      "SentimentBatchResultItem": {
        "properties": {
          "id": {
            "description": "Unique, non-empty document identifier.",
            "type": "string"
          },
          "score": {
            "description": "A decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text.",
            "format": "double",
            "type": "number"
          },
          "statistics": {
            "$ref": "#/components/schemas/DocumentStatistics",
            "description": "(Optional) if showStats=true was specified in the request this field will contain information about the document payload."
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "apim_key": {
        "in": "header",
        "name": "Ocp-Apim-Subscription-Key",
        "type": "apiKey"
      }
    }
  },
  "security": [
    {
      "apim_key": []
    }
  ]
}