Documentation Index
Fetch the complete documentation index at: https://docs.camb.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Translate an array of text segments from one language into another with fine-grained control over tone (formality), grammatical gender, audience age, and domain-specific terminology (chosen_dictionaries). Translation is ideal for localizing user content, documents, support replies, marketing copy, or any batch of strings that needs to read naturally in another language.
The translation pipeline is asynchronous: you submit a job with one or more texts, poll until it completes, then retrieve the translations in the same order as the inputs.
Prerequisites
Create an account
Sign up at CAMB.AI Studio if you havenβt already.
Get your API key
Go to Settings β API Keys in Studio and copy your key. See Authentication for details.
Install the SDK
Code
Customization options
Formality
Adjust the formality level to fit the context. This affects pronoun choice (e.g.tΓΊ vs usted in Spanish, du vs Sie in German) and overall register.
| Value | Meaning | Best for |
|---|---|---|
1 | Formal | Business communications, official documents, customer support |
2 | Informal | Casual chat, social posts, friendly marketing |
Gender
In many target languages, adjectives, articles, and past participles agree with gender. Use thegender parameter to tell the engine which grammatical forms to prefer.
| Value | Meaning |
|---|---|
0 | Unspecified / neutral |
1 | Masculine forms |
2 | Feminine forms |
9 | Other |
Age
Pass an integer (e.g.12, 30, 65) to bias vocabulary and idioms toward an audience age range. Useful when translating content meant for kids or for very formal/elder audiences.
Chosen dictionaries
Pass an array of dictionary IDs viachosen_dictionaries to apply specialized vocabulary (medical, legal, technical, etc.). Manage your dictionaries with the Dictionaries API.
Parameters
Required
| Parameter | Type | Description |
|---|---|---|
texts | string[] | Array of text segments to translate. Each item is translated independently and returned in the same order. |
source_language | integer | Source-language ID for the input texts (e.g. 1 for English). |
target_language | integer | Target-language ID for the output texts (e.g. 54 for Spanish). |
Optional
| Parameter | Type | Description |
|---|---|---|
formality | integer | 1 for formal, 2 for informal |
gender | integer | Grammatical gender hint: 0, 1, 2, or 9 (see table above) |
age | integer | Target audience age, used to adapt vocabulary |
chosen_dictionaries | integer[] | Dictionary IDs to apply specialized vocabulary |
project_name | string | Label for the job in your dashboard |
project_description | string | Additional notes for the job |
folder_id | integer | Place the run inside a specific folder |
Result shape
get_translation_result returns a TranslationResult with a single field:
| Field | Type | Description |
|---|---|---|
texts | string[] | Translated outputs, in the same order as the input texts. Pair index-by-index with the original array. |
Language IDs
Translation requires both asource_language and a target_language ID. Some commonly used values:
| Language | ID |
|---|---|
| English | 1 |
| Spanish | 54 |
| French | 76 |
| German | 31 |
| Mandarin Chinese | 139 |
| Japanese | 88 |
| Arabic | 4 |
Full list of supported source-language IDs.
Full list of supported target-language IDs.
Tips
- Batch in one call: Pass multiple strings in a single
textsarray instead of submitting one task per string β it is faster and uses fewer credits. - Preserve order:
result.texts[i]always corresponds totexts[i]from the input. Pair them withzip(Python) or index-by-index access (TypeScript). - Polling cadence: Translation is usually quick; a 1-2 second polling interval works well. Cap the total wait time (for example, 5 minutes) so your code never hangs forever.
- Pick the right register: Setting
formalityandgenderon customer-facing translations dramatically improves how natural the output reads in languages like Spanish, French, German, and Italian. - Domain accuracy: For medical, legal, or technical content, define a dictionary first and pass its ID in
chosen_dictionariesso jargon is translated consistently across runs.
Next Steps
Create Translation API
Full API reference for the translation endpoint.
Poll Translation Status
Status polling endpoint reference.
Get Translation Result
Retrieve the translated texts for a completed run.
Fetch Multiple Runs
Batch-fetch results for several translation run IDs in one call.