Chinese · English · Arabic, English-pivot, terminology-consistent. This is an internal service: every endpoint requires an API key issued per partner system (portal, SFDA registration, product catalogs, suppliers).
X-API-Key.
All calls carry your issued key in the X-API-Key header:
curl -X POST https://translate.peterzou.com/v1/translate/batch \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sourceLang":"en","targetLang":"ar","mode":"product","items":[{"id":"p1","text":"White gold-bead midi dress with embroidery"}]}'
portal, sfda, supplier-x) gets its own key, so usage is attributable and revocable independently.active=false); other keys are unaffected.| Endpoint | Auth | Purpose |
|---|---|---|
GET /healthz | none | Service health check |
POST /v1/translate/batch | X-API-Key | Batch translation ≤50 items — production use |
POST /v1/chat/completions | X-API-Key | OpenAI-compatible chat endpoint (model=translate-v1) |
POST /api/translate | X-API-Key | Single-text endpoint (≤6000 chars) — also powers the website preview tool |
ok/error results; the overall call returns HTTP 200 even when some items fail.{
"sourceLang": "en", // en | zh | ar | auto
"targetLang": "ar", // en | zh | ar
"mode": "product", // product | contract | marketing | general | medical
"items": [
{ "id": "p1", "text": "Embroidered chiffon wedding dress" },
{ "id": "p2", "text": "White satin midi dress with gold beads" }
]
}
Response:
{
"results": [
{ "id": "p1", "ok": true, "translation": "فستان زفاف شيفون مطرز" },
{ "id": "p2", "ok": false, "error": { "code": "empty_text", "message": "text is empty" } }
],
"meta": { "latencyMs": 1345 }
}
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_request | Missing/invalid fields, unsupported targetLang, invalid JSON, >50 items |
| 400 | empty_text | An item has empty text |
| 401 | unauthorized | Missing or invalid X-API-Key — request a key from [email protected] |
| 413 | text_too_long | Text exceeds the length limit (preview 6000) |
| 503 | upstream_unavailable | Translation engine temporarily unavailable (auto-failover already tried; retry shortly) |
| Direction | Route | Notes |
|---|---|---|
| EN → AR | direct | Native Saudi copywriting register, Arabic-Indic numerals (٢٢٠) |
| EN → ZH | direct | Simplified Chinese |
| ZH → AR | via EN pivot | English middle state returned as en_middle for verification |
| AR → EN / AR → ZH | direct / pivot | Arabic source supported |
| ZH → EN | direct | For Chinese suppliers exporting to the Gulf |
Modes: product (e-commerce/catalog), contract (legal register), marketing, general, medical (SFDA/PIL/labeling — via preview endpoint, DRAFT until reviewed).