API Documentation

Translate text with Nuenki's API.

Do you need the API?

If you're just looking to translate text manually, consider using the translation utility.

Authentication

All API requests must be authenticated by including your unique API key in the JSON body of your POST request. You can find and manage your API key on your Account Dashboard. If you suspect your key has been compromised, you can regenerate it there at any time.

Security Note: Your API key is secret. Do not share it, commit it to version control, or expose it in client-side code. Treat it like a password. If it is ever exposed, regenerate it in the Account Dashboard immediately.

Pricing

Fast Translate costs 0.0005 USD per translation, plus 0.00003 USD per character. Deep Translate costs 0.01 USD per translation, plus 0.0003 USD per character. Deep Translate bills context at 25% of the full cost; Fast Translate bills it at 50%.

The amount of characters used to calculate the cost is based on max(input_characters, output_characters), where input/output characters are actual Unicode characters, not bytes.

Handling Timeouts

Our endpoints have different performance characteristics. To ensure a robust integration, it's important to set appropriate client-side timeouts for your HTTP requests.

The Deep Translate endpoint is designed for maximum quality, which can require significant processing time, especially for complex or stylistic text. To simplify integration, our API uses a standard synchronous model where your application waits for the translation in the same connection. Because this can take several minutes, we strongly recommend a timeout of 300 seconds (5 minutes) for all /deep_translate requests.

In contrast, the Fast Translate endpoint is optimized for speed and should respond within a few seconds. For /fast_translate requests, a much shorter timeout of 10 seconds is more than sufficient and is a good practice for failing fast in latency-sensitive applications.

Endpoints

POST/deep_translateWorld-Class Quality

Deep Translate produces natural-sounding translations that read like original text rather than converted content. Use it when you’re representing your brand.

Request Body

  • textstringRequired

    The text you want to translate. Maximum length of 3600 characters. For longer documents, we recommend splitting the text by paragraph.

  • api_keystringRequired

    Your unique API key.

  • target_languagestringRequired

    The language to translate into. See the full list of Supported Languages.

  • source_languagestringOptional

    The source language. If omitted, the API will automatically detect the language (value: "Auto").

  • stylestring[]Optional

    Guides the stylistic tone. Defaults to AutoDetect. See all Style Options.

  • faithfulnessstringOptional

    Controls the translation's creative latitude. Defaults to Standard.
    VeryLiteral / Literal: Produces a conservative, "safe" translation that prioritizes preserving the exact meaning, even if less natural.
    Standard / Natural: Aims to express the same sentiment in an organic, natural way that sounds native to the target language, which may involve more divergence from the original sentence structure.

  • contextstringOptional

    Provides additional context to improve translation quality, such as a description of the situation, a glossary of domain-specific terminology, or surrounding text. Max 3000 characters. If the context exceeds 3000 characters, the first 3000 characters will be used, and you will not be billed for unused characters. This is billed at 25% of the cost of standard text input.

Response Body

  • textstring

    The translated text.

  • cost_nanodollarsnumber

    The cost of the API call in nanodollars.

  • remaining_credit_nanodollarsnumber

    Your remaining account credit in nanodollars.

  • time_takennumber

    The time taken for the API call to complete, in seconds.

  • stylestring[]

    The style categories that were ultimately used for the translation. This is especially useful when using AutoDetect.

Example Request

cURL
TypeScript
Python
Go
Rust
curl --request POST \
  --url https://translate.platform.nuenki.app/deep_translate \
  --max-time 300 \
  --header 'Content-Type: application/json' \
  --data '{
    "text": "Oh what a piece of work is Man: how noble in reason; how infinite in faculty, in form, in moving, how express and admirable! In action, how like an angel! In apprehension, how like a God!",
    "api_key": "YOUR_API_KEY_HERE",
    "target_language": "German",
    "context": "A variant upon \"what a piece of work is man\", focused on humanity as a whole, with a triumphant, unironic tone."
  }'

Example Response

{
  "text": "O welch ein Meisterwerk ist der Mensch: wie edel in der Vernunft; wie unendlich in den Fähigkeiten...",
  "cost_nanodollars": 44800000,
  "remaining_credit_nanodollars": 999955200000,
  "style": ["GrandStyleEpicProse", "Historical"],
  "time_taken": 9.4
}
POST/fast_translateFast & Balanced

The Fast Translate API offers a balance of quality, speed, and cost. It’s designed for high-volume or latency sensitive applications where you need a solid, accurate translation quickly and inexpensively, without the eloquence of Deep Translate. It reads like a competent translation, not native text.

Request Body

  • textstringRequired

    The text you want to translate. Maximum length of 3000 characters. For longer text, we recommend splitting it into smaller chunks, such as by paragraph.

  • api_keystringRequired

    Your unique API key.

  • target_languagestringRequired

    The language to translate into. See the full list of Supported Languages.

  • source_languagestringOptional

    The source language. If omitted, the API will automatically detect the language (value: "Auto").

  • formalitystringOptional

    Sets the formality level. Defaults to Standard. Values: Informal, Standard, Formal.

  • contextstringOptional

    Provides additional context to improve translation quality, such as a description of the situation, a glossary of terms, or surrounding text. Max 400 characters. This is billed at 50% of the cost of standard input.

Response Body

  • textstring

    The translated text.

  • cost_nanodollarsnumber

    The cost of the API call in nanodollars.

  • remaining_credit_nanodollarsnumber

    Your remaining account credit in nanodollars.

  • time_takennumber

    The time taken for the API call to complete, in seconds.

Example Request

cURL
TypeScript
Python
Go
Rust
curl --request POST \
  --url https://translate.platform.nuenki.app/fast_translate \
  --max-time 10 \
  --header 'Content-Type: application/json' \
  --data '{
    "text": "Can we grab a coffee tomorrow morning?",
    "api_key": "YOUR_API_KEY_HERE",
    "target_language": "French",
    "formality": "Informal",
    "context": "This is a casual conversation between friends making plans."
  }'

Example Response

{
  "text": "On peut prendre un café demain matin ?",
  "cost_nanodollars": 10800000,
  "remaining_credit_nanodollars": 999944400000,
  "time_taken": 0.3
}
POST/crowdin_batchCrowdin Integration

This specialized endpoint is for integrating with Crowdin's "Custom MT" app. It's designed to be highly efficient, translating batches of strings in a single request. The endpoint automatically uses any context you've added to your strings in Crowdin and intelligently groups related, contiguous strings to improve translation consistency and quality.

Request Body

  • api_keystringRequired

    Your unique Nuenki API key.

  • source_languagestringRequired

    The source language code from Crowdin (e.g., "en", "de", "fr").

  • target_languagestringRequired

    The target language code from Crowdin.

  • fast_belownumberRequired

    A character count threshold. Strings with fewer characters than this number will be sent to Fast Translate. Strings with this many characters or more will be sent to Deep Translate. A value of 20 is a good starting point.

  • stringsobject[]Required

    An array of string objects. Each object must contain a text key and can optionally contain a context key. Example: [{"text": "Save", "context": "Button label"}, {"text": "File not found."}].

  • contextstringOptional

    A global context string that applies to all strings in the batch. This is passed through to both the Fast and Deep Translate engines.

  • do_groupingbooleanOptional

    Defaults to true. If true, the API will attempt to group contiguous strings to improve translation quality. Set to false in your request script to translate every string individually.

Success Response (200 OK)

  • translationsobject[]

    An array of translation objects, in the same order as the input strings. Each object has a text key. Example: [{"text": "Hallo Welt"}, {"text": "Auf Wiedersehen Welt"}].

Error Response (e.g., 400 Bad Request)

A plain text response (Content-Type: text/plain) with a user-safe message explaining why the batch failed.

Example Error Response

Batch failed: The translation for "An example of a failing string" could not be processed after all attempts.

Reliability and Failure Model

The endpoint is atomic: it either succeeds and returns a complete set of translations, or it fails and returns none. The system includes internal retries and fallbacks for reliability. However, if a string cannot be translated after all attempts, the entire batch will fail. This all-or-nothing approach prevents partial, inconsistent translations from being saved to your project, which could be more damaging than a clear failure.

Note on Billing: API calls are billed based on processing attempts. A batch that ultimately fails after multiple retries will still incur costs for the work performed. This is to prevent abuse of the system based on incurring costs without paying for them. The internal retry system aggressively reduces the chance of this happening.

Crowdin Configuration

In your Crowdin project, navigate to Settings → Machine Translation → Custom MT. Use the following JavaScript snippets for the Request and Response configuration.

Request Code:

Crowdin Custom MT - Request

config = {
  url: "https://translate.platform.nuenki.app/crowdin_batch",
  method: "POST",
  headers: { "Content-Type": "application/json" },
  data: {
    api_key: "YOUR_NUENKI_API_KEY_HERE",
    source_language: sourceLanguage,
    target_language: targetLanguage,
    strings: strings.map(s => ({ text: s.text, context: s.context })),
    fast_below: 20,
    
    // To disable the default behavior of grouping related strings,
    // uncomment the following line:
    // do_grouping: false,

    // To provide a global context for all strings in the file,
    // uncomment the following line:
    // context: `Translating the main UI for a financial services app.`,
  }
};

Response Code:

Crowdin Custom MT - Response

translations = translations.translations.map(t => t.text);

Supported Languages

The following language names are accepted in the target_language and source_language fields of the main translation endpoints. The /crowdin_batch endpoint uses standard language codes (e.g., 'en', 'de-DE').

  • Arabic
  • Bulgarian
  • Cantonese
  • ChineseSimplified
  • ChineseTraditional
  • Croatian
  • Czech
  • Danish
  • Dutch
  • English
  • Esperanto
  • Estonian
  • Finnish
  • French
  • German
  • Greek
  • Hebrew
  • Hindi
  • Hungarian
  • Indonesian
  • Italian
  • Japanese
  • Klingon
  • Korean
  • Latin
  • Latvian
  • Lithuanian
  • Norwegian
  • Persian
  • Polish
  • PortugueseBrazil
  • PortuguesePortugal
  • Romanian
  • Russian
  • Slovak
  • Slovenian
  • SpanishSpain
  • SpanishMexico
  • Swedish
  • Thai
  • Turkish
  • Ukrainian
  • Vietnamese
  • Welsh

Deep Translate Styles

You can pass the following values in the style parameter array of a Deep Translate request. If you use AutoDetect (or omit the style parameter), the API will analyze your text and choose the most appropriate styles, then return their names in the response.

Foundational Styles

  • AutoDetect: This is the default. The API analyzes your text to automatically select the most appropriate style.
  • NeutralDefault: This produces clear, standard prose with no strong stylistic markers. It's the universal baseline and fallback.
  • Formal: This is for official, academic, or serious occasions. It uses full sentences, precise grammar, and maintains an objective tone.
  • Conversational: This captures the language of peer-to-peer communication. The output is relaxed, sometimes fragmented, and uses idioms and contractions.
  • SimplePlainLanguage: This creates maximally accessible text for broad public comprehension.

Professional & Commercial

  • Corporate: This is the official, polished voice of an organization, like what you'd see in press releases.
  • BusinessCasual: This captures the day-to-day language of the workplace, such as internal emails.
  • MarketingCopy: This produces energetic, benefit-oriented, and persuasive language designed to sell.
  • Legal: This handles the language of contracts and statutes. It requires absolute terminological and logical precision.
  • Bureaucratic: This provides a precise translation of bureaucratic language, avoiding over-interpretation.
  • FinancialEconomic: This handles the data-dense, jargon-heavy language of markets and finance.
  • UiUxCopy: This creates highly concise, functional microcopy for user interfaces.
  • Diplomatic: This produces extremely polite, careful, and often non-committal language for sensitive topics.

Technical & Instructional

  • Academic: This creates structured, evidence-based writing for scholarly audiences.
  • TechnicalScientific: This produces precise, objective language for describing complex systems or scientific findings.
  • InstructionalProcedural: This generates action-oriented "how-to" guides using clear, sequential commands.
  • SafetyNotice: This handles critical warnings where the primary goal is to prevent harm.
  • MedicalForProfessionals: This produces clinical, jargon-heavy language for doctors and researchers.
  • MedicalForPatients: This translates medical information into clear, empathetic, and accessible language.

Media & Persuasive

  • JournalisticNewsReport: This produces objective, fact-based reporting.
  • EditorialOpEd: This creates a subjective, structured argument intended to persuade a public audience.
  • OratoricalSpeech: This generates language crafted to be spoken and heard, using cadence and emotional appeals.
  • Political: This handles the specific, often calculated, language used by politicians and governments.
  • Propaganda: This produces language with a strong ideological agenda designed to manipulate opinion.

Literary & Creative

  • GrandStyleEpicProse: This creates masterful prose or verse that synthesizes rhetoric, poetry, and philosophical depth, like Shakespeare.
  • LiteraryHighArt: This produces artist-driven prose focused on stylistic experimentation, like Woolf or Faulkner.
  • NarrativeProse: This generates well-crafted, story-driven writing that is highly readable, like a modern bestseller.
  • GenreFiction: This creates narrative prose that adheres to the conventions of a specific genre, such as Sci-Fi or Fantasy.
  • Poetic: This produces language that prioritizes rhythm, sound, compression, and figurative language.
  • ScreenplayScript: This generates the functional, highly structured format for visual media.

Social & Niche

  • ChildrensProse: This creates language for young readers, with controlled vocabulary and often a whimsical or didactic tone.
  • HumorousSatirical: This produces writing where the primary goal is to entertain through wit, irony, or absurdity.
  • ReligiousTheological: This handles text from or about sacred works, sermons, or spirituality.
  • OnlineForumDiscourse: This captures user-generated language from digital communities, with jargon, memes, and abbreviations.

Billing and Costs

Our system uses nanodollars (one billionth of a US dollar) for internal accounting to ensure the highest precision in billing. The API response includes cost fields in this unit.

When handling these values in your code, we strongly recommend using a 64-bit integer type (like long in C# or Java, i64 in Rust, or JavaScript's BigInt) to avoid floating-point inaccuracies or integer overflow. You can then convert them to a more human-readable unit like dollars or cents for display.

Support

Have questions or need help with an integration? Just send an email to [email protected] and we'll get back to you promptly.