Translate text with Nuenki's API.
If you're just looking to translate text manually, consider using the translation utility.
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.
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.
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.
Deep Translate produces natural-sounding translations that read like original text rather than converted content. Use it when you’re representing your brand.
text
stringRequiredThe text you want to translate. Maximum length of 3600 characters. For longer documents, we recommend splitting the text by paragraph.
api_key
stringRequiredYour unique API key.
target_language
stringRequiredThe language to translate into. See the full list of Supported Languages.
source_language
stringOptionalThe source language. If omitted, the API will automatically detect the language (value: "Auto"
).
style
string[]OptionalGuides the stylistic tone. Defaults to AutoDetect
. See all Style Options.
faithfulness
stringOptionalControls 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.
context
stringOptionalProvides 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.
text
stringThe translated text.
cost_nanodollars
numberThe cost of the API call in nanodollars.
remaining_credit_nanodollars
numberYour remaining account credit in nanodollars.
time_taken
numberThe time taken for the API call to complete, in seconds.
style
string[]The style categories that were ultimately used for the translation. This is especially useful when using AutoDetect
.
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."
}'
{
"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
}
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.
text
stringRequiredThe 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_key
stringRequiredYour unique API key.
target_language
stringRequiredThe language to translate into. See the full list of Supported Languages.
source_language
stringOptionalThe source language. If omitted, the API will automatically detect the language (value: "Auto"
).
formality
stringOptionalSets the formality level. Defaults to Standard
. Values: Informal
, Standard
, Formal
.
context
stringOptionalProvides 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.
text
stringThe translated text.
cost_nanodollars
numberThe cost of the API call in nanodollars.
remaining_credit_nanodollars
numberYour remaining account credit in nanodollars.
time_taken
numberThe time taken for the API call to complete, in seconds.
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."
}'
{
"text": "On peut prendre un café demain matin ?",
"cost_nanodollars": 10800000,
"remaining_credit_nanodollars": 999944400000,
"time_taken": 0.3
}
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.
api_key
stringRequiredYour unique Nuenki API key.
source_language
stringRequiredThe source language code from Crowdin (e.g., "en"
, "de"
, "fr"
).
target_language
stringRequiredThe target language code from Crowdin.
fast_below
numberRequiredA 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.
strings
object[]RequiredAn 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."}]
.
context
stringOptionalA global context string that applies to all strings in the batch. This is passed through to both the Fast and Deep Translate engines.
do_grouping
booleanOptionalDefaults 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.
translations
object[]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"}]
.
A plain text response (Content-Type: text/plain) with a user-safe message explaining why the batch failed.
Batch failed: The translation for "An example of a failing string" could not be processed after all attempts.
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.
In your Crowdin project, navigate to Settings → Machine Translation → Custom MT. Use the following JavaScript snippets for the Request and Response configuration.
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.`,
}
};
translations = translations.translations.map(t => t.text);
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').
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.
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.
Have questions or need help with an integration? Just send an email to [email protected] and we'll get back to you promptly.