{ "swagger": "2.0", "info": { "title": "Text Translation", "version": "2026-06-06", "description": "Azure Translator is a cloud-based, multilingual, neural machine translation service. The Text Translation API enables robust and scalable translation capabilities suitable for diverse applications.", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" } ] }, "schemes": [ "https" ], "x-ms-parameterized-host": { "hostTemplate": "{Endpoint}", "useSchemePrefix": false, "parameters": [ { "name": "Endpoint", "in": "path", "description": "Supported Text Translation endpoints (protocol and hostname, for example:\n https://api.cognitive.microsofttranslator.com).", "required": true, "type": "string", "format": "uri", "x-ms-skip-url-encoding": true } ] }, "produces": [ "application/json" ], "consumes": [ "application/json" ], "security": [ { "ApiKeyAuth": [] }, { "OAuth2Auth": [ "https://cognitiveservices.azure.com/.default" ] } ], "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "Ocp-Apim-Subscription-Key", "in": "header" }, "OAuth2Auth": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "https://cognitiveservices.azure.com/.default": "" }, "tokenUrl": "https://login.microsoftonline.com/common/oauth2/token" } }, "tags": [], "paths": { "/languages": { "get": { "operationId": "GetSupportedLanguages", "summary": "Gets the set of languages currently supported by other operations of the Translator.", "description": "Gets the set of languages currently supported by other operations of the Translator.", "parameters": [ { "name": "X-ClientTraceId", "in": "header", "description": "A client-generated GUID to uniquely identify the request.", "required": false, "type": "string", "x-ms-client-name": "clientTraceId" }, { "$ref": "#/parameters/GetSupportedLanguagesParameters.scope" }, { "$ref": "#/parameters/GetSupportedLanguagesParameters.acceptLanguage" }, { "$ref": "#/parameters/GetSupportedLanguagesParameters.ifNoneMatch" }, { "name": "api-version", "in": "query", "description": "Mandatory API version parameter", "required": true, "type": "string", "x-ms-client-name": "apiVersion" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/GetSupportedLanguagesResult" }, "headers": { "ETag": { "type": "string", "description": "Current value of the entity tag for the requested groups of supported languages. \nTo make subsequent requests more efficient, the client may send the `ETag` value in an \n`If-None-Match` header field." }, "X-RequestId": { "type": "string", "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes." } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/ErrorResponse" }, "headers": { "X-RequestId": { "type": "string", "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes." } } } }, "x-ms-examples": { "Gets the set of languages currently supported by other operations of the Translator with minimum properties.": { "$ref": "./examples/GetSupportedLanguages_MinimumSet_Gen.json" }, "Gets the set of languages currently supported by other operations of the Translator.": { "$ref": "./examples/GetSupportedLanguages_MaximumSet_Gen.json" } } } }, "/translate": { "post": { "operationId": "Translate", "summary": "Translate Text", "description": "Translate Text", "parameters": [ { "name": "X-ClientTraceId", "in": "header", "description": "A client-generated GUID to uniquely identify the request.", "required": false, "type": "string", "x-ms-client-name": "clientTraceId" }, { "name": "api-version", "in": "query", "description": "Mandatory API version parameter", "required": true, "type": "string", "x-ms-client-name": "apiVersion" }, { "name": "body", "in": "body", "description": "Defines the content of the request", "required": true, "schema": { "$ref": "#/definitions/TranslateBody" } } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/TranslationResult" }, "headers": { "X-RequestId": { "type": "string", "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes." }, "x-metered-usage": { "type": "integer", "format": "int32", "description": "Specifies consumption (the number of characters for which the user will be charged) for the translation \njob request. For example, if the word \"Hello\" is translated from English (en) to French (fr), \nthis field will return the value '5'." }, "x-mt-system": { "type": "string", "description": "Specifies the system type that was used for translation for each 'to' language requested for translation. \nThe value is a comma-separated list of strings. Each string indicates a type:\n\n* Custom - Request includes a custom system and at least one custom system was used during translation.\n* Team - All other requests" } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/ErrorResponse" }, "headers": { "X-RequestId": { "type": "string", "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes." } } } }, "x-ms-examples": { "Translate Text": { "$ref": "./examples/Translate_MaximumSet_Gen.json" }, "Translate Text with minimum properties": { "$ref": "./examples/Translate_MinimumSet_Gen.json" } } } }, "/transliterate": { "post": { "operationId": "Transliterate", "summary": "Transliterate Text", "description": "Transliterate Text", "parameters": [ { "name": "X-ClientTraceId", "in": "header", "description": "A client-generated GUID to uniquely identify the request.", "required": false, "type": "string", "x-ms-client-name": "clientTraceId" }, { "$ref": "#/parameters/TransliterateParameters.language" }, { "$ref": "#/parameters/TransliterateParameters.fromScript" }, { "$ref": "#/parameters/TransliterateParameters.toScript" }, { "name": "api-version", "in": "query", "description": "Mandatory API version parameter", "required": true, "type": "string", "x-ms-client-name": "apiVersion" }, { "name": "body", "in": "body", "description": "Defines the content of the request", "required": true, "schema": { "$ref": "#/definitions/TransliterateBody" } } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/TransliterateResult" }, "headers": { "X-RequestId": { "type": "string", "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes." } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/ErrorResponse" }, "headers": { "X-RequestId": { "type": "string", "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes." } } } }, "x-ms-examples": { "Transliterate Text": { "$ref": "./examples/Transliterate_MaximumSet_Gen.json" }, "Transliterate Text with minimum properties": { "$ref": "./examples/Transliterate_MinimumSet_Gen.json" } } } } }, "definitions": { "DetectedLanguage": { "type": "object", "description": "An object describing the detected language.", "properties": { "language": { "type": "string", "description": "A string representing the code of the detected language." }, "score": { "type": "number", "format": "float", "description": "A float value indicating the confidence in the result.\nThe score is between zero and one and a low score indicates a low confidence." } }, "required": [ "language", "score" ] }, "ErrorDetails": { "type": "object", "description": "Error details as returned by Translator Service.", "properties": { "code": { "type": "string", "description": "String identifier of the error." }, "message": { "type": "string", "description": "Human readable error description." } }, "required": [ "code", "message" ] }, "ErrorResponse": { "type": "object", "description": "Representation of the Error Response from Translator Service.", "properties": { "error": { "$ref": "#/definitions/ErrorDetails", "description": "Error details." } }, "required": [ "error" ] }, "GetSupportedLanguagesResult": { "type": "object", "description": "Response for the languages API.", "properties": { "translation": { "type": "object", "description": "Languages that support translate API.", "additionalProperties": { "$ref": "#/definitions/TranslationLanguage" }, "readOnly": true }, "transliteration": { "type": "object", "description": "Languages that support transliteration API.", "additionalProperties": { "$ref": "#/definitions/TransliterationLanguage" }, "readOnly": true }, "models": { "type": "array", "description": "LLM models supported.", "items": { "type": "string" }, "readOnly": true } } }, "InputTextItem": { "type": "object", "description": "Element containing the text for translation.", "properties": { "text": { "type": "string", "description": "Text to translate." } }, "required": [ "text" ] }, "LanguageDirectionality": { "type": "string", "description": "Language Directionality", "enum": [ "ltr", "rtl" ], "x-ms-enum": { "name": "LanguageDirectionality", "modelAsString": false, "values": [ { "name": "LeftToRight", "value": "ltr", "description": "Language is written left to right." }, { "name": "RightToLeft", "value": "rtl", "description": "Language is written right to left." } ] } }, "LanguageScript": { "type": "object", "description": "Common properties of language script", "properties": { "code": { "type": "string", "description": "Code identifying the script." }, "name": { "type": "string", "description": "Display name of the script in the locale requested via Accept-Language header." }, "nativeName": { "type": "string", "description": "Display name of the language in the locale native for the language." }, "dir": { "$ref": "#/definitions/LanguageDirectionality", "description": "Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages." } }, "required": [ "code", "name", "nativeName", "dir" ] }, "ProfanityAction": { "type": "string", "description": "Translator profanity actions", "enum": [ "NoAction", "Marked", "Deleted" ], "x-ms-enum": { "name": "ProfanityAction", "modelAsString": false, "values": [ { "name": "NoAction", "value": "NoAction", "description": "No Action is taken on profanity" }, { "name": "Marked", "value": "Marked", "description": "Profanity is marked." }, { "name": "Deleted", "value": "Deleted", "description": "Profanity is deleted from the translated text." } ] } }, "ProfanityMarker": { "type": "string", "description": "Translator profanity markers", "enum": [ "Asterisk", "Tag" ], "x-ms-enum": { "name": "ProfanityMarker", "modelAsString": false, "values": [ { "name": "Asterisk", "value": "Asterisk", "description": "Profanity is marked with asterisk." }, { "name": "Tag", "value": "Tag", "description": "Profanity is marked with the tags." } ] } }, "ReferenceTextPair": { "type": "object", "description": "Reference text pair to generate adaptive customized translation.", "properties": { "source": { "type": "string", "description": "Source reference sentence." }, "target": { "type": "string", "description": "Target reference sentence." } }, "required": [ "source", "target" ] }, "TextType": { "type": "string", "description": "Translation text type", "enum": [ "Plain", "Html" ], "x-ms-enum": { "name": "TextType", "modelAsString": true, "values": [ { "name": "Plain", "value": "Plain", "description": "Plain text." }, { "name": "Html", "value": "Html", "description": "HTML-encoded text." } ] } }, "TranslateBody": { "type": "object", "description": "Request data for translate.", "properties": { "inputs": { "type": "array", "description": "Array of the input text elements to translate.", "items": { "$ref": "#/definitions/TranslateInputItem" } } }, "required": [ "inputs" ] }, "TranslateInputItem": { "type": "object", "description": "Element containing the text for translation.", "properties": { "text": { "type": "string", "description": "Text to translate." }, "script": { "type": "string", "description": "Specifies the script of the input text." }, "language": { "type": "string", "description": "Specifies the language of the input text. Find which languages are available to translate by \nlooking up supported languages using the translation scope. If the language parameter isn't \nspecified, automatic language detection is applied to determine the source language.\n\nYou must use the language parameter rather than autodetection when using the dynamic dictionary feature. \nNote: the dynamic dictionary feature is case-sensitive." }, "textType": { "type": "string", "description": "Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, \ncomplete element. Possible values are: plain (default) or html.", "default": "Plain", "enum": [ "Plain", "Html" ], "x-ms-enum": { "name": "TextType", "modelAsString": true, "values": [ { "name": "Plain", "value": "Plain", "description": "Plain text." }, { "name": "Html", "value": "Html", "description": "HTML-encoded text." } ] } }, "targets": { "type": "array", "description": "Translation target parameters.", "items": { "$ref": "#/definitions/TranslationTarget" } } }, "required": [ "text", "targets" ] }, "TranslateParameters": { "type": "object", "description": "Request parameters for the translate API." }, "TranslatedTextItem": { "type": "object", "description": "Element containing the translated text", "properties": { "detectedLanguage": { "$ref": "#/definitions/DetectedLanguage", "description": "The detectedLanguage property is only present in the result object when language auto-detection is requested." }, "translations": { "type": "array", "description": "An array of translation results. The size of the array matches the number of target \nlanguages specified through the to query parameter.", "items": { "$ref": "#/definitions/TranslationText" }, "readOnly": true } }, "required": [ "translations" ] }, "TranslationGender": { "type": "string", "description": "Desired gender for the translated text.", "enum": [ "neutral", "male", "female" ], "x-ms-enum": { "name": "TranslationGender", "modelAsString": true, "values": [ { "name": "Neutral", "value": "neutral", "description": "Neutral gender." }, { "name": "Male", "value": "male", "description": "Male gender." }, { "name": "Female", "value": "female", "description": "Female gender." } ] } }, "TranslationLanguage": { "type": "object", "description": "The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag.\nA key identifies a language for which text can be translated to or translated from.", "properties": { "name": { "type": "string", "description": "Display name of the language in the locale requested via Accept-Language header." }, "nativeName": { "type": "string", "description": "Display name of the language in the locale native for this language." }, "dir": { "$ref": "#/definitions/LanguageDirectionality", "description": "Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages." }, "models": { "type": "array", "description": "LLM models supported for translation.", "items": { "type": "string" }, "readOnly": true } }, "required": [ "name", "nativeName", "dir", "models" ] }, "TranslationResult": { "type": "object", "description": "Response for the translation API.", "properties": { "value": { "type": "array", "description": "Array of the translated text elements.", "items": { "$ref": "#/definitions/TranslatedTextItem" }, "readOnly": true } }, "required": [ "value" ] }, "TranslationTarget": { "type": "object", "description": "Target language and translation configuration parameters.", "properties": { "language": { "type": "string", "description": "Specifies the language of the output text. The target language must be one of the supported languages included \nin the translation scope. It's possible to translate to multiple languages simultaneously by including \nmultiple string values in the targetsLanguage array." }, "script": { "type": "string", "description": "Specifies the script of the translated text." }, "profanityAction": { "type": "string", "description": "Specifies how profanities should be treated in translations.\nPossible values are: NoAction (default), Marked or Deleted.", "default": "NoAction", "enum": [ "NoAction", "Marked", "Deleted" ], "x-ms-enum": { "name": "ProfanityAction", "modelAsString": false, "values": [ { "name": "NoAction", "value": "NoAction", "description": "No Action is taken on profanity" }, { "name": "Marked", "value": "Marked", "description": "Profanity is marked." }, { "name": "Deleted", "value": "Deleted", "description": "Profanity is deleted from the translated text." } ] } }, "profanityMarker": { "type": "string", "description": "Specifies how profanities should be marked in translations.\nPossible values are: Asterisk (default) or Tag. ", "default": "Asterisk", "enum": [ "Asterisk", "Tag" ], "x-ms-enum": { "name": "ProfanityMarker", "modelAsString": false, "values": [ { "name": "Asterisk", "value": "Asterisk", "description": "Profanity is marked with asterisk." }, { "name": "Tag", "value": "Tag", "description": "Profanity is marked with the tags." } ] } }, "deploymentName": { "type": "string", "description": "Default is 'general', which uses NMT system.\n'abc-inc-gpt-4o', and 'abc-inc-gpt-4o-mini' are examples of deployment names which use GPT-4o uses or\nGPT-4o-mini model. 'gpt-4o' uses GPT-4o model.\n\n'' uses the custom NMT model tuned by customer.\n'best' system determines which is the best model to use for the request. This intelligence could be introduced\nin future. Customer should have deployed it in their resource.\n", "default": "general" }, "allowFallback": { "type": "boolean", "description": "In the case where a custom system is being used, specifies that the service is allowed to fall back to a\ngeneral system when a custom system doesn't exist. \nIn the case where a Large Language Model is being used, specifies that the service is allowed to fall\nback to a Small Language Model if an error occurs.\nPossible values are: true (default) or false.\n\nallowFallback=false specifies that the translation should only use systems trained for the category specified \nby the request. If a translation for language X to language Y requires chaining through a pivot language E, \nthen all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. \nIf no system is found with the specific category, the request will return a 400 status code. allowFallback=true \nspecifies that the service is allowed to fall back to a general system when a custom system doesn't exist.", "default": true }, "tone": { "$ref": "#/definitions/TranslationTone", "description": "Desired tone of target translation. Accepted values are formal, informal, or neutral." }, "gender": { "$ref": "#/definitions/TranslationGender", "description": "Desired gender of target translation. Accepted values are female, male, or neutral." }, "adaptiveDatasetId": { "type": "string", "description": "Reference dataset ID having sentence pair to generate adaptive customized translation." }, "referenceTextPairs": { "type": "array", "description": "Reference text pairs to generate adaptive customized translation.", "maxItems": 5, "items": { "$ref": "#/definitions/ReferenceTextPair" } } }, "required": [ "language" ] }, "TranslationText": { "type": "object", "description": "Translation result", "properties": { "language": { "type": "string", "description": "A string representing the language code of the target language." }, "sourceCharacters": { "type": "integer", "format": "int32", "description": "An integer indicating the number of characters in the source text string" }, "instructionTokens": { "type": "integer", "format": "int32", "description": "An integer indicating the number of tokens used in generating the translated text" }, "sourceTokens": { "type": "integer", "format": "int32", "description": "An integer indicating the number of tokens used in the source sentence" }, "responseTokens": { "type": "integer", "format": "int32", "description": "An integer indicating the number of tokens used in the translation response" }, "targetTokens": { "type": "integer", "format": "int32", "description": "An integer indicating the number of tokens used in the target sentence" }, "text": { "type": "string", "description": "A string giving the translated text." } }, "required": [ "language", "text" ] }, "TranslationTone": { "type": "string", "description": "Desired tone for the translated text.", "enum": [ "neutral", "formal", "informal" ], "x-ms-enum": { "name": "TranslationTone", "modelAsString": true, "values": [ { "name": "Neutral", "value": "neutral", "description": "Neutral tone." }, { "name": "Formal", "value": "formal", "description": "Formal tone." }, { "name": "Informal", "value": "informal", "description": "Informal tone." } ] } }, "TransliterableScript": { "type": "object", "description": "Script definition with list of script into which given script can be translitered.", "properties": { "toScripts": { "type": "array", "description": "List of scripts available to convert text to.", "items": { "$ref": "#/definitions/LanguageScript" } } }, "required": [ "toScripts" ], "allOf": [ { "$ref": "#/definitions/LanguageScript" } ] }, "TransliterateBody": { "type": "object", "description": "Request data for transliterate.", "properties": { "inputs": { "type": "array", "description": "Array of the input text elements to transliterate.", "items": { "$ref": "#/definitions/InputTextItem" } } }, "required": [ "inputs" ] }, "TransliterateResult": { "type": "object", "description": "Response for the transliteration API.", "properties": { "value": { "type": "array", "description": "Array of transliterated texts", "items": { "$ref": "#/definitions/TransliteratedText" }, "readOnly": true } }, "required": [ "value" ] }, "TransliteratedText": { "type": "object", "description": "Transliterated text element.", "properties": { "text": { "type": "string", "description": "A string which is the result of converting the input string to the output script." }, "script": { "type": "string", "description": "A string specifying the script used in the output." } }, "required": [ "text", "script" ] }, "TransliterationLanguage": { "type": "object", "description": "The value of the transliteration property is a dictionary of (key, value) pairs. \nEach key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script \nto another script.", "properties": { "name": { "type": "string", "description": "Display name of the language in the locale requested via Accept-Language header." }, "nativeName": { "type": "string", "description": "Display name of the language in the locale native for this language." }, "scripts": { "type": "array", "description": "List of scripts to convert from.", "items": { "$ref": "#/definitions/TransliterableScript" }, "readOnly": true } }, "required": [ "name", "nativeName", "scripts" ] } }, "parameters": { "GetSupportedLanguagesParameters.acceptLanguage": { "name": "Accept-Language", "in": "header", "description": "The language to use for user interface strings. Some of the fields in the response are names of languages or \nnames of regions. Use this parameter to define the language in which these names are returned. \nThe language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` \nto request names in French or use the value `zh-Hant` to request names in Chinese Traditional.\nNames are provided in the English language when a target language is not specified or when localization \nis not available.", "required": false, "type": "string", "default": "en", "x-ms-parameter-location": "method", "x-ms-client-name": "acceptLanguage" }, "GetSupportedLanguagesParameters.ifNoneMatch": { "name": "If-None-Match", "in": "header", "description": "Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. \nIf the resource has not been modified, the service will return status code 304 and an empty response body.", "required": false, "type": "string", "x-ms-parameter-location": "method", "x-ms-client-name": "ifNoneMatch" }, "GetSupportedLanguagesParameters.scope": { "name": "scope", "in": "query", "description": "A comma-separated list of names defining the group of languages to return.\nAllowed group names are: `translation`, `transliteration` and `dictionary`.\nIf no scope is given, then all groups are returned, which is equivalent to passing \n`scope=translation,transliteration,dictionary`. To decide which set of supported languages \nis appropriate for your scenario, see the description of the [response object](#response-body).", "required": false, "type": "string", "x-ms-parameter-location": "method" }, "TransliterateParameters.fromScript": { "name": "fromScript", "in": "query", "description": "Specifies the script used by the input text. Look up supported languages using the transliteration scope,\nto find input scripts available for the selected language.", "required": true, "type": "string", "x-ms-parameter-location": "method" }, "TransliterateParameters.language": { "name": "language", "in": "query", "description": "Specifies the language of the text to convert from one script to another. \nPossible languages are listed in the transliteration scope obtained by querying the service \nfor its supported languages.", "required": true, "type": "string", "x-ms-parameter-location": "method" }, "TransliterateParameters.toScript": { "name": "toScript", "in": "query", "description": "Specifies the output script. Look up supported languages using the transliteration scope, to find output \nscripts available for the selected combination of input language and input script.", "required": true, "type": "string", "x-ms-parameter-location": "method" } } }