Introduction
The Intlfy API translates your JSON locale files using AI — preserving structure, key names, and interpolation variables. Repeated content in translation requests costs only 0.2%, while direct cache lookups by hash cost just 0.1%.
The base URL for all requests is https://api.intlfy.com. All endpoints accept and return JSON.
Authentication
All API requests must include your API key in the x-api-key header. Generate and manage your keys in the Panel.
-H "Content-Type: application/json" \
-H "x-api-key: sk_live_your_key_here" \
-d {'"content"': {'"hello"': '"world"'}, '"targetLanguages"': ["pt-BR"]}'
Keys are prefixed with sk_live_. Only active keys will be accepted.
Translate Endpoint
/translationsTranslates a JSON content object into one or more target languages in a single request.
content and context must not exceed 440 KB per request.Cache Lookup
/translations?hash=...&targetLanguage=...Check if a translation already exists in our cache using its unique hash. This allows you to retrieve translations without sending the full source content again.
"https://api.intlfy.com/translations?hash=db72...fc10&targetLanguage=pt-BR"
Request Schema
{
// Required
"content": object, // JSON object to translate
"targetLanguages": string[], // e.g. ["pt-BR", "es", "fr"]
// Optional
"sourceLanguage": string, // default: "auto"
"context": string, // Optional global context
"protectedPatterns": [
{ "begin": string, "end": string }
]
}contentobjectrequiredThe JSON locale object to translate. Nested objects are fully supported. Only string values are translated — keys are preserved. Combined with context, size is limited to 480 KB.
targetLanguagesstring[]requiredArray of BCP-47 language tags to translate into. e.g. "pt-BR", "es", "zh-Hans", "ja".
sourceLanguagestringoptionalBCP-47 tag of the source language. Defaults to "auto" (automatic detection).
contextstringoptionalGlobal context, instructions or description for the translation (e.g. "Formal tone", "Technical documentation", "E-commerce platform").
protectedPatternsarrayoptionalArray of { begin, end } objects defining token boundaries to protect from translation. Note: HTML tags and content in single `{}` or double `{{}}` curly braces are automatically ignored and don't need to be specified here.
Example Request
curl -X POST https://api.intlfy.com/translations \
-H "x-api-key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"content": {
"welcome": "Hello, {name}!",
"logout": "Sign out",
"errors": {
"required": "This field is required"
}
},
"targetLanguages": ["pt-BR", "es"],
"sourceLanguage": "en"
}'Response Schema
{
"translations": {
"[lang]": object // translated JSON matching input structure
},
"cached": string[], // languages served from cache
"contentHash": string
}Example Response
{
"translations": {
"pt-BR": {
"welcome": "Olá, {{name}}!",
"logout": "Sair",
"errors": {
"required": "Este campo é obrigatório"
}
},
"es": {
"welcome": "¡Hola, {{name}}!",
"logout": "Cerrar sesión",
"errors": {
"required": "Este campo es obligatorio"
}
}
},
"cached": [],
"contentHash": "a3f8bc..."
}Caching
Translations are cached by contentHash — a deterministic hash of the source content and target language. The cache TTL is 30 days, reset on every access.
Full AI processing cost.
Repeated content in translation.
Direct lookup by hash.
The cached array in the response lists which languages were served from cache. Each cache hit resets the 30-day expiry.
Error Codes
Missing required fields or malformed JSON body.
Missing or invalid x-api-key header.
The API key is inactive or the application has been deleted.
The combined size of content and context exceeds the 480 KB limit.
An unexpected error occurred during translation. Retrying usually resolves it.