Skip to main content
Translate text to any of 100+ supported languages using neural machine translation.
Endpoint
POST /translate/v1/translate
import Casedev from 'casedev';

const client = new Casedev({ apiKey: 'sk_case_YOUR_API_KEY' });

const result = await client.translate.v1.translate({
  q: 'The plaintiff filed a motion for summary judgment.',
  target: 'es'
});

console.log(result.data.translations[0].translatedText);
// "El demandante presentó una moción de juicio sumario."
Response
{
  "data": {
    "translations": [
      {
        "translatedText": "El demandante presentó una moción de juicio sumario.",
        "detectedSourceLanguage": "en"
      }
    ]
  }
}

Parameters

Required

ParameterTypeDescription
qstring or string[]Text to translate. Can be a single string or array for batch translation.
targetstringTarget language code (ISO 639-1), e.g., es, fr, de, zh

Optional

ParameterTypeDefaultDescription
sourcestringauto-detectSource language code. If omitted, language is automatically detected.
formatstringtextFormat of source text: text or html
modelstringnmtTranslation model: nmt (neural) or base

Batch translation

Translate multiple strings in a single request:
const result = await client.translate.v1.translate({
  q: [
    'Hello',
    'Goodbye',
    'Thank you',
    'Please sign here'
  ],
  target: 'fr',
  source: 'en'
});

result.data.translations.forEach((t, i) => {
  console.log(t.translatedText);
});
// "Bonjour"
// "Au revoir"
// "Merci"
// "Veuillez signer ici"

HTML preservation

Preserve HTML tags during translation with format: 'html':
const result = await client.translate.v1.translate({
  q: '<p>The <strong>defendant</strong> denies all allegations.</p>',
  target: 'de',
  format: 'html'
});

console.log(result.data.translations[0].translatedText);
// "<p>Der <strong>Beklagte</strong> bestreitet alle Anschuldigungen.</p>"

Common language codes

LanguageCode
Englishen
Spanishes
Frenchfr
Germande
Chinese (Simplified)zh
Chinese (Traditional)zh-TW
Japaneseja
Koreanko
Arabicar
Portuguesept
Russianru
Italianit
See the Supported Languages endpoint for a complete list.

Examples

TypeScript
const document = `
NOTICE OF MOTION

PLEASE TAKE NOTICE that the undersigned will move this Court
at the Courthouse located at 100 Centre Street, New York, NY
on the 15th day of January, 2025, at 9:30 a.m., for an order...
`;

const result = await client.translate.v1.translate({
  q: document,
  target: 'es'
});

Auto-detect source language

TypeScript
// Source language is detected automatically
const result = await client.translate.v1.translate({
  q: 'Bonjour, comment puis-je vous aider?',
  target: 'en'
});

console.log(result.data.translations[0].detectedSourceLanguage); // "fr"
console.log(result.data.translations[0].translatedText); // "Hello, how can I help you?"
Pricing: 0.03per1,000characters.A50,000characterdocumentcosts0.03 per 1,000 characters. A 50,000 character document costs 1.50.