Translate
Sign in

API

REST API for text and document translation. Create a key in your dashboard.

Authentication

Pass your key as a bearer token (or x-api-key header).

Authorization: Bearer wsk_xxx

Translate text

POST /api/v1/translate

curl -X POST https://<host>/api/v1/translate \
  -H "Authorization: Bearer wsk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "en",
    "target": "fr",
    "text": "Clean water saves lives.",
    "domain": "wash"
  }'

# → { "translation": "...", "source": "en", "target": "fr",
#     "domain": "wash", "model": "...", "ragApplied": true, "characters": 24 }

domain defaults to wash. Max 50,000 characters per request.

Translate a document (.docx)

Three steps: request an upload URL, upload the file, start the job, then poll.

# 1. create the job → get a presigned upload URL
POST /api/v1/documents
  { "filename": "report.docx", "source": "en", "target": "fr", "domain": "wash" }
  → { "jobId": "...", "uploadUrl": "https://...", "method": "PUT", "contentType": "..." }

# 2. upload the file directly
PUT <uploadUrl>   (body = the .docx bytes, Content-Type = the returned contentType)

# 3. start processing
POST /api/v1/documents/{jobId}/start   → { "status": "processing" }

# 4. poll until done, then download
GET /api/v1/documents/{jobId}
  → { "status": "done", "downloadUrl": "https://...", "segmentCount": 120 }

Discovery

GET /api/v1/languages   → { "languages": [ { "code": "fr", "name": "French", ... } ] }
GET /api/v1/domains     → { "domains": [ { "slug": "wash", "name": "WASH", ... } ] }

Rate limits & quota

Each key has a per-minute request limit and a monthly character quota (by tier). When exceeded:

{ "error": { "code": "rate_limited", "message": "..." } }