Перейти до вмісту
AstroWay/api v2.95.1 · docs
усі системи в нормі

Translate batch

POST
/translate/batch
request.sh
curl -X POST https://api.astroway.info/v1/translate/batch \
-H "X-Api-Key: aw_live_..." \
-H "Content-Type: application/json" \
-d '{ "items": [ "Mercury retrograde", "Full Moon in Leo" ], "target_lang": "ru", "domain": "western" }'

Translate up to 25 strings (≤2000 chars each, ≤20000 total) sharing one target language + domain. Credits: 15 + ceil(total_chars/40).

Media type application/json
object
Example
{
"items": [
"Mercury retrograde",
"Full Moon in Leo"
],
"target_lang": "ru",
"domain": "western"
}

Successful calculation

Media type application/json
object
ok
boolean
data
object
items
Array<object>
nullable
object
translated
string
nullable
provider
string
nullable
source_lang
string
nullable
target_lang
string
nullable
domain
string
nullable
count
number
nullable
chars
number
nullable
credits
number
nullable
Example
{
"ok": true
}

Validation error

Media type application/json
Example
{
"ok": false,
"error": {
"code": "INVALID_INPUT",
"message": "Validation failed: date: Date must be YYYY-MM-DD",
"details": [
{
"path": "date",
"message": "Date must be YYYY-MM-DD"
}
]
}
}

Missing or invalid API key

Media type application/json
Example
{
"ok": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key"
}
}
Корисно?