Iniciar sesión

API

API REST para la traducción de texto y documentos. Crea una clave en tu panel.

Autenticación

Envía tu clave como token bearer (o mediante la cabecera x-api-key).

headers.http
HTTP
Authorization: Bearer wsk_xxx# …or, equivalently:x-api-key: wsk_xxx

Traducir texto

POST/api/v1/translate
curl -X POST https://translate.baobabtech.app/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"  }'
response.json
JSON
{  "translation": "...",  "source": "en",  "target": "fr",  "domain": "wash",  "model": "...",  "ragApplied": true,  "characters": 24}

domain es wash por defecto. Máximo 50 000 caracteres por solicitud. reasoning_effort (opcional: off · low · medium · high) es off por defecto — la traducción no necesita razonamiento.

Traducción por lotes

Envíe un array en text para traducir hasta 100 cadenas en una sola llamada. Las traducciones vuelven en translations, en el orden de entrada. Un lote cuenta como UNA petición frente al límite de velocidad, así que un trabajo de cientos de cadenas cortas cuesta unas pocas peticiones en lugar de cientos. Las cadenas idénticas se traducen una vez y se facturan una vez.

curl -X POST https://translate.baobabtech.app/api/v1/translate \  -H "Authorization: Bearer wsk_xxx" \  -H "Content-Type: application/json" \  -d '{    "source": "en",    "target": "fr",    "domain": "wash",    "text": [      "Clean water saves lives.",      "Hygiene promotion",      "Household water treatment and safe storage"    ]  }'# → { "translations": ["...", "...", "..."], "items": 3, "characters": 74, ... }
response.json
JSON
{  "translations": ["...", "...", "..."],  "items": 3,  "source": "en",  "target": "fr",  "domain": "wash",  "format": "text",  "model": "...",  "characters": 74}

Traducir HTML

Ponga format en html para valores de campos de un CMS. El marcado nunca se envía al modelo: solo se traducen los nodos de texto y se reescriben en el documento original, de modo que tablas, imágenes, iframes, enlaces, clases y atributos data- vuelven intactos. script y style se devuelven literalmente y nunca se traducen. Solo se factura el texto visible.

Traducir un documento (.docx, .pptx, .xlsx, .pdf)

Tres pasos: solicitar una URL de subida, subir el archivo, iniciar el trabajo y luego consultar el estado.

# 1. Create the job → returns a presigned upload URLcurl -X POST https://translate.baobabtech.app/api/v1/documents \  -H "Authorization: Bearer wsk_xxx" \  -H "Content-Type: application/json" \  -d '{ "filename": "report.docx", "source": "en", "target": "fr", "domain": "wash" }'# → { "jobId": "...", "uploadUrl": "https://...", "method": "PUT", "contentType": "..." }
# 2. Upload the file straight to the presigned URLcurl -X PUT "<uploadUrl>" \  -H "Content-Type: <contentType>" \  --data-binary @report.docx
# 3. Start processingcurl -X POST https://translate.baobabtech.app/api/v1/documents/<jobId>/start \  -H "Authorization: Bearer wsk_xxx"# → { "jobId": "...", "status": "processing" }
# 4. Poll until done, then downloadcurl https://translate.baobabtech.app/api/v1/documents/<jobId> \  -H "Authorization: Bearer wsk_xxx"# → { "status": "done", "downloadUrl": "https://...", "segmentCount": 120 }

Descubrimiento

GET /api/v1/help devuelve en JSON los endpoints, los límites y las capacidades. Es público, así que una integración puede autoconfigurarse y comprobar la conectividad antes de fijar una clave.

# All three endpoints are public — no API key required.curl https://translate.baobabtech.app/api/v1/languages# → { "languages": [ { "code": "fr", "name": "French", "script": "Latn", "rtl": false } ] }
curl https://translate.baobabtech.app/api/v1/domains# → { "domains": [ { "slug": "wash", "name": "WASH", "description": "..." } ] }
# Endpoints, limits and capabilities, for integrations that self-configure.curl https://translate.baobabtech.app/api/v1/help# → { "endpoints": { ... }, "formats": ["text", "html"], "languages": ["en", "fr", ...] }

Límites de tasa y cuota

Cada clave tiene un límite de solicitudes por minuto y una cuota mensual de caracteres (según el nivel). Cuando se superan:

  • 429 con Retry-After — límite de tasa
  • 402 quota_exceeded — cuota mensual de caracteres alcanzada
  • 401 — clave ausente o no válida
error.json
JSON
{ "error": { "code": "rate_limited", "message": "..." } }