Translate Text

POST
Translate text from one language to another.

Request

This endpoint expects an object.
text
stringRequired
The text to be translated.
source_lang
stringRequired
The source language of the text.
target_lang
stringRequired
The target language for translation.

Response

This endpoint returns an object
response
objectOptional
POST
$curl -X POST https://api.predictionguard.com/translate \
> -H "x-api-key: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "text": "text",
> "source_lang": "source_lang",
> "target_lang": "target_lang"
>}'
Response
1{
2 "response": {
3 "Best translation": "Le ciel est bleu",
4 "Score": 0.8694148659706116
5 }
6}