Sending texts for translation

To translate plain text, send a POST request to the https://api.groupdocs.cloud/v2.0/translation/text GroupDocs.Translation Cloud REST API endpoint. To authorize the request, pass the access token in Authorization header (Bearer authentication).

The text and translation parameters are provided in JSON format in the request body.

{
	"sourceLanguage": "en",
	"targetLanguages": [
		"de"
	],
	"containsMarkdown": false,
	"texts": [
		"Hello, world! I can read this text in my language."
	],
}
Note
If the translated text is very long, you may encounter an error when calling translation via cURL in a shell command. Use the getconf ARG_MAX command to check the maximum length of the command arguments (in bytes).

Evaluation mode

To use GroupDocs.Translation Cloud REST API in evaluation mode, send a POST request to the endpoint https://api.groupdocs.cloud/v2.0/translation/text/trial.

This endpoint does not use the Authorization header, so there is no need to generate an access token. All other parameters remain the same as in regular text translation requests.

Translation settings

PropertyTypeDefault valueDescription
sourceLanguageStringen (English)Language code of the source text.
targetLanguagesArray of stringsn/aLanguage codes into which the text should be translated.
containsMarkdownBooleanfalseSet to true to respect basic markdown syntax in source text and keep it in the translations (if possible). Otherwise, these symbols will be translated as part of the content.
textsArray of stringsn/aTexts to be translated.

Return value

If successful, this method returns JSON with a unique identifier (value of the id property) of the translation request in the queue:

{
	"status": 202,
	"message": "Starting translation",
	"id": "a4fc6c6e-81b0-43c8-b62b-b8bb99520ce9"
}

Otherwise, it returns a HTTP status code corresponding to the error.

What’s next

Translation will take a few seconds, depending on the size of the text and the current GroupDocs.Translation Cloud load. See the article Fetching translations for information on how to get translations from the server.

cURL example

curl --location --request POST 'https://api.groupdocs.cloud/v2.0/translation/text' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...UV1hLfgNCSQ4VKGCOA' \
--data '{
	"sourceLanguage": "en",
	"targetLanguages": [
		"de"
	],
	"texts": [
		"Hello, world! I can read this text in my language."
	]
}'
curl --location --request POST 'https://api.groupdocs.cloud/v2.0/translation/text/trial' \
--header 'Content-Type: application/json' \
--data '{
	"sourceLanguage": "en",
	"targetLanguages": [
		"de"
	],
	"texts": [
		"Hello, world! I can read this text in my language."
	]
}'
{
	"status": 202,
	"message": "Starting translation",
	"id": "a4fc6c6e-81b0-43c8-b62b-b8bb99520ce9"
}