# FluentC API: full documentation and articles > FluentC is a translation API built for agents and workflows. Translate text, HTML and JSON through a REST API, an MCP server, LangChain tools or an n8n node, in real-time or batch mode, with translation memory and a glossary included. - Base URL: https://api.fluentc.ai - Authentication: send the API key in the Authorization header exactly as shown in the dashboard. Do not add a Bearer prefix. - Requests and responses are JSON. Language codes are lowercase two- or three-letter codes such as es, fr, ja. - Modes: real-time returns the translation in the response; batch returns a job_id that you poll. - Consistency: the same text and target language return the same stored translation, whichever agent or model asks. Matches are exact, not fuzzy. - Glossary and editing: add your own terms to the glossary, and search and edit every translation, in the dashboard. Glossary entries belong to your account. See /docs/glossary/. --- # FluentC API documentation > Translate text, HTML and JSON from agents and workflows. Use the REST API, the MCP server, LangChain tools or the n8n node, in real-time or batch mode, with translation memory and a glossary included. Source: https://www.fluentc.ai/docs/ FluentC is a translation API built for agents and automations: software that calls translation thousands of times an hour, in the middle of a workflow, and needs the answer before a user notices. You send text, HTML or JSON and a target language. You get the translation back. Content you have translated before comes from translation memory instead of being translated again, and your own terms come from your glossary, which you manage in the dashboard along with every translation. ## Ways to integrate Every integration uses the same engine, the same API key and the same plan. | Integration | Use it when | Documentation | | --- | --- | --- | | REST API | You are writing code, or calling from any HTTP client | [Translate](https://www.fluentc.ai/docs/api/translate.md) | | MCP server | An AI agent or MCP client should translate on its own | [MCP server](https://www.fluentc.ai/docs/integrations/mcp.md) | | LangChain tools | You are building LangChain agents or chains in Python | [LangChain](https://www.fluentc.ai/docs/integrations/langchain.md) | | n8n node | You are building workflows in n8n | [n8n](https://www.fluentc.ai/docs/integrations/n8n.md) | | Make and Zapier | You are using HTTP steps in a no-code tool | [Make and Zapier](https://www.fluentc.ai/docs/integrations/make-zapier.md) | | Function calling | You want a model to call FluentC as a tool | [Function calling](https://www.fluentc.ai/docs/integrations/function-calling.md) | Not sure which to pick? See [Choose an integration](https://www.fluentc.ai/docs/integrations/overview.md). ## The basics - **Base URL:** `https://api.fluentc.ai` - **Authentication:** send your API key in the `Authorization` header exactly as the dashboard shows it. Do not add `Bearer`. See [Authentication](https://www.fluentc.ai/docs/authentication.md). - **Format:** JSON requests and responses, UTF-8. Send `Content-Type: application/json`. - **Modes:** `real-time` returns the translation in the response. `batch` returns a `job_id` that you poll. See [Concepts](https://www.fluentc.ai/docs/concepts.md). - **Consistency:** the same text and target language always return the same stored translation, whichever agent or model asks. See [Consistency across agents](https://www.fluentc.ai/docs/concepts.md#consistency-across-agents). - **Glossary and editing:** add your own terms to the glossary, and search and edit every translation, in the dashboard. See [Glossary and translation memory](https://www.fluentc.ai/docs/glossary.md). - **Languages:** 128+ languages, addressed by lowercase two- or three-letter codes such as `es`, `fr` and `ja`. The languages you can use are enabled per API key. - **API key:** [create one in the dashboard](https://dashboard.fluentc.io/users/sign_up). ## Your first request ```bash curl https://api.fluentc.ai/ai_agent/translate \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "Your order has shipped.", "input_format": "text", "target_language": "es", "mode": "real-time" }' ``` ```json { "status": "complete", "translation": "Tu pedido ha sido enviado.", "token_count": 9, "source_language_detected": "en" } ``` The [Quickstart](https://www.fluentc.ai/docs/quickstart.md) walks through this step by step, including batch mode. ## Reference - [Translate](https://www.fluentc.ai/docs/api/translate.md): `POST /ai_agent/translate` - [Batch results](https://www.fluentc.ai/docs/api/batch-results.md): `POST /ai_agent/results` - [Detect language](https://www.fluentc.ai/docs/api/detect-language.md): `POST /ai_agent/checklanguage` - [Languages](https://www.fluentc.ai/docs/api/languages.md): `GET /ai_agent/languages` - [Errors](https://www.fluentc.ai/docs/api/errors.md): status codes and every error message - [OpenAPI specification](https://www.fluentc.ai/docs/openapi.yaml) ## For AI tools and agents These docs are written to be read by software as well as people. - **Markdown for every page.** Replace the trailing slash of any docs URL with `.md`: `https://www.fluentc.ai/docs/api/translate.md`. The docs home is `https://www.fluentc.ai/docs/index.md`. - **[llms.txt](https://www.fluentc.ai/llms.txt)** is an index of every page with a one-line description. **[llms-full.txt](https://www.fluentc.ai/llms-full.txt)** is the whole documentation in one file. - **[OpenAPI specification](https://www.fluentc.ai/docs/openapi.yaml)** describes the REST API in a machine-readable form. - **Conventions.** Examples run as written once `FLUENTC_KEY` is set. Placeholders are written in capitals, such as `YOUR_FLUENTC_KEY`. Error messages are quoted exactly as the API returns them, so you can match on them. --- # Quickstart > Make your first real-time translation and your first batch translation in a few minutes, with cURL, Python or Node. Source: https://www.fluentc.ai/docs/quickstart/ By the end of this page you will have listed your languages, translated a sentence in real time, and translated an HTML page in batch mode. ## Before you start You need an API key. [Create one in the dashboard](https://dashboard.fluentc.io/users/sign_up). Export it so the examples run as written: ```bash export FLUENTC_KEY="YOUR_FLUENTC_KEY" ``` Never put the key in client-side code. Call FluentC from a server, a workflow or an agent runtime. See [Authentication](https://www.fluentc.ai/docs/authentication.md). ## 1. Check which languages you can use A target language must be enabled for your key. List them: ```bash curl https://api.fluentc.ai/ai_agent/languages \ -H "Authorization: $FLUENTC_KEY" ``` ```json { "supported_languages": [ { "code": "es", "name": "Spanish" }, { "code": "fr", "name": "French" }, { "code": "de", "name": "German" } ], "source_languages": [ { "code": "en", "name": "English" } ] } ``` Use the `code` values as `target_language` and `source_language`. See [Languages](https://www.fluentc.ai/docs/api/languages.md). ## 2. Translate in real time cURL: ```bash curl https://api.fluentc.ai/ai_agent/translate \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "Your order has shipped.", "input_format": "text", "target_language": "es", "mode": "real-time" }' ``` Python: ```python import os import requests res = requests.post( "https://api.fluentc.ai/ai_agent/translate", headers={"Authorization": os.environ["FLUENTC_KEY"]}, json={ "input": "Your order has shipped.", "input_format": "text", "target_language": "es", "mode": "real-time", }, ) res.raise_for_status() print(res.json()["translation"]) ``` Node: ```js const res = await fetch("https://api.fluentc.ai/ai_agent/translate", { method: "POST", headers: { Authorization: process.env.FLUENTC_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ input: "Your order has shipped.", input_format: "text", target_language: "es", mode: "real-time", }), }); if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error}`); console.log((await res.json()).translation); ``` The response: ```json { "status": "complete", "translation": "Tu pedido ha sido enviado.", "token_count": 9, "source_language_detected": "en" } ``` > **Note:** Real-time mode needs the Real-time plan. With a Batch plan key the API answers `422` with `"Realtime translation is not supported for this agent."` Use batch mode instead, below. See [Concepts](https://www.fluentc.ai/docs/concepts.md#plans-and-modes). ## 3. Translate in batch Batch mode accepts the request, returns a `job_id` straight away, and translates in the background. You poll for the result. Submit the job: ```bash curl https://api.fluentc.ai/ai_agent/translate \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "
This is a sample page.
", "input_format": "html", "target_language": "fr", "mode": "batch" }' ``` ```json { "job_id": "abc123def456" } ``` Poll until `status` is `complete`: ```bash curl https://api.fluentc.ai/ai_agent/results \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "job_id": "abc123def456" }' ``` ```json { "status": "processing", "estimated_wait_seconds": 5, "next_poll_after": "2026-01-15T10:30:00Z" } ``` Here is the whole flow in Python, with a cap on the number of polls: ```python import os import time import requests BASE = "https://api.fluentc.ai" HEADERS = {"Authorization": os.environ["FLUENTC_KEY"]} job_id = requests.post( f"{BASE}/ai_agent/translate", headers=HEADERS, json={ "input": "This is a sample page.
", "input_format": "html", "target_language": "fr", "mode": "batch", }, ).json()["job_id"] for _ in range(60): result = requests.post( f"{BASE}/ai_agent/results", headers=HEADERS, json={"job_id": job_id} ).json() if result["status"] == "complete": print(result["translation"]) break if result["status"] == "failed": raise RuntimeError(result["error"]) time.sleep(max(result.get("estimated_wait_seconds", 5), 5)) else: raise TimeoutError(f"Job {job_id} did not finish") ``` Always cap the number of polls. A `job_id` that doesn't exist is reported as `processing`, not as an error. See [Batch results](https://www.fluentc.ai/docs/api/batch-results.md). ## 4. Handle errors Every error is JSON with an `error` string and an HTTP status you can branch on. Check the status before reading the body. | Status | Meaning | | --- | --- | | `401` | The key is missing or wrong. Check for a stray `Bearer` prefix. | | `403` | The subscription is inactive, translation is disabled, or a usage limit was reached. | | `422` | The request is invalid. The message names the problem. | The full list is on the [Errors](https://www.fluentc.ai/docs/api/errors.md) page. ## Next steps - Read the [Translate](https://www.fluentc.ai/docs/api/translate.md) reference for every field and format. - Learn how [translation memory and modes](https://www.fluentc.ai/docs/concepts.md) affect cost and speed. - Add your own terms and edit translations in the dashboard: [Glossary and translation memory](https://www.fluentc.ai/docs/glossary.md). - Connect FluentC to the tools you already use: [MCP](https://www.fluentc.ai/docs/integrations/mcp.md), [LangChain](https://www.fluentc.ai/docs/integrations/langchain.md), [n8n](https://www.fluentc.ai/docs/integrations/n8n.md), [Make and Zapier](https://www.fluentc.ai/docs/integrations/make-zapier.md) or [function calling](https://www.fluentc.ai/docs/integrations/function-calling.md). --- # Authentication > Authenticate every request with your API key in the Authorization header. No Bearer prefix. How to keep the key safe and what each authentication error means. Source: https://www.fluentc.ai/docs/authentication/ ## How it works Every endpoint requires your API key in the `Authorization` header. Send the key exactly as the dashboard shows it. ```http Authorization: YOUR_FLUENTC_KEY ``` ```bash curl https://api.fluentc.ai/ai_agent/languages \ -H "Authorization: $FLUENTC_KEY" ``` > **Warning:** Do not add a `Bearer` prefix. `Authorization: Bearer YOUR_FLUENTC_KEY` is read as a different, unknown key and fails with `401` and `"Invalid API key: Site not found."` Many HTTP clients and agent frameworks add `Bearer` automatically when you set a token, so set the header by hand. You get a key when you [sign up](https://dashboard.fluentc.io/users/sign_up). The same key works for the REST API, the MCP server, the LangChain tools, the n8n node, and Make or Zapier. ## What a key controls A key belongs to one FluentC site in your account, and the site decides what the key can do: - **Languages.** Only languages enabled for the key can be used as `target_language` or `source_language`. List them with [Languages](https://www.fluentc.ai/docs/api/languages.md). - **Mode.** A Batch plan key can use `batch` mode. A Real-time plan key can use both `real-time` and `batch`. See [Concepts](https://www.fluentc.ai/docs/concepts.md#plans-and-modes). - **Status.** If the subscription is inactive, translation is disabled for the site, or a usage limit is reached, requests fail with `403`. ## Keeping the key safe - Call FluentC from a server, a workflow runner or an agent runtime. Never ship the key in a browser, a mobile app or a public repository. - Store it in an environment variable or a secret manager. The examples use `FLUENTC_KEY`. - Use a separate key per environment when you can, so a leak in one place doesn't affect the others. - If you think a key has been exposed, [contact us](https://www.fluentc.ai/contact/) right away. ## Authentication errors | Status | Message | Cause | | --- | --- | --- | | `401` | `API key (Site UUID) is missing` | The `Authorization` header is absent or empty. | | `401` | `Invalid API key: Site not found.` | The key is wrong, has extra characters, or has a `Bearer` prefix. | | `401` | `Invalid API key: Associated company not found.` | The key's account can't be resolved. [Contact us](https://www.fluentc.ai/contact/). | | `403` | `Access denied: Translations are disabled for this site.` | Translation is switched off for the key's site. | | `403` | `Subscription error: ...` | The subscription isn't active. The message says why. | | `403` | `Usage limit error: ...` | A usage limit was reached. The message says which. | The API calls the key a "Site UUID" in some messages. It is the same thing as the API key in the dashboard. Don't retry a `401` or `403` without changing something. Fix the key or the account first. All error shapes are on the [Errors](https://www.fluentc.ai/docs/api/errors.md) page. --- # Concepts > Real-time and batch modes, translation memory and the glossary, input formats, language codes and how plans decide which mode a key can use. Source: https://www.fluentc.ai/docs/concepts/ ## Real-time and batch Every translation request chooses a `mode`. | | `real-time` | `batch` | | --- | --- | --- | | Response | The translation, in the same response | A `job_id`; you poll for the result | | Best for | Agent tool calls, chat, support, anything a person is waiting on | Content libraries, UI strings, CMS content, product catalogs, newsletters | | Latency | Fast; repeated content is answered from memory | Background; the result is ready when `status` is `complete` | | Plan | Real-time plan | Batch plan and Real-time plan | | Reference | [Translate](https://www.fluentc.ai/docs/api/translate.md) | [Translate](https://www.fluentc.ai/docs/api/translate.md), then [Batch results](https://www.fluentc.ai/docs/api/batch-results.md) | A batch request can carry up to 50,000 rows. JSON input is walked, every string is translated on its own, and the structure is put back together for you. ## Translation memory FluentC remembers what it has translated. The memory key is a SHA-256 hash of the target language plus the exact input text. Four consequences follow: - **Repeats are fast and cheap.** An identical string returns from memory with no model call. A second pass over a catalog or a UI is faster than the first. - **Matches are exact.** There are no fuzzy matches, so a near-miss never stands in for your text. Change one character and it is a new string. - **Batch job IDs are deterministic.** Submitting the same text and target language again produces the same `job_id`, so resubmitting after a timeout is safe. - **It is included.** Translation memory is part of every plan. ## Glossary FluentC also keeps a glossary: your own terms and phrases, each with the translation you want, managed in the dashboard. The memory reuses what has already been translated. The glossary decides how a term is translated in the first place. Entries belong to your account and apply to every key on it, in both modes and through every integration. In the dashboard, the Translation Memory screen is where you manage the glossary. [Glossary and translation memory](https://www.fluentc.ai/docs/glossary.md) has the steps. ## Consistency across agents Because the memory is keyed on the target language and the exact text, the translation of a given string is the same for every caller. Ten agents on ten different models that send the same sentence get the same words back, through any integration. - **The first request translates, later requests return it.** The result is stored the first time and returned from then on. - **It depends on identical input.** If two agents word the English differently, they send different strings and get different translations. Standardise the sentences you care about, such as status messages and policy lines, and send them as written. - **It is a property of the match, not a promise about quality.** Review the phrases that matter once, fix any line in the dashboard, and every agent that sends them sends the reviewed words. Add recurring terms to the [glossary](https://www.fluentc.ai/docs/glossary.md) so new translations use them. For the longer version, read [Ten agents, one translation](https://www.fluentc.ai/articles/ten-agents-one-translation/). ## Input formats `input_format` tells FluentC how to read `input`. | Format | Behaviour | | --- | --- | | `text` | Plain text. Returned as plain text. | | `html` | Markup is preserved and the text inside it is translated. | | `json` | Structure is preserved and string values are translated. `input` can be a JSON object or a string containing JSON. The `translation` in the response is a JSON-encoded string, so parse it. | Language detection accepts only `text` and `html`. ## Language codes Languages are identified by lowercase ISO 639-1 or 639-2 codes of two or three letters: `es`, `fr`, `de`, `ja`, `zh`. - Region subtags are not accepted. `pt-BR` and `zh-CN` fail with `"Invalid or missing target language code."` Use `pt` and `zh`. - Uppercase is accepted and lowercased for you. - A code that is valid but not enabled for your key fails with `"Target language 'xx' is not enabled for this site."` List what you can use with [Languages](https://www.fluentc.ai/docs/api/languages.md). - FluentC supports 128+ languages in total. Which of them your key can use depends on your account. ### Source language `source_language` is optional. Leave it out and FluentC works out the source language from the text. Pass it when you already know it: it removes any ambiguity for short strings such as `"Pasta"` or `"Gift"`. If you pass one, it must be enabled for your key too. ## Plans and modes The plan behind your key decides which modes work. | Plan | `batch` | `real-time` | | --- | --- | --- | | Batch | Yes | No | | Real-time | Yes | Yes | In the dashboard the Batch plan is called **Standard** and the Real-time plan is called **Pro**. A `real-time` request on a Batch plan key fails with `422` and `"Realtime translation is not supported for this agent."` See [Pricing](https://www.fluentc.ai/pricing/) for what each plan includes. ## Polling a batch job After a batch request, call [Batch results](https://www.fluentc.ai/docs/api/batch-results.md) with the `job_id`: - `processing`: wait for `estimated_wait_seconds` (use at least 5), then ask again. - `complete`: read `translation`. - `failed`: read `error`. The content was recognised but couldn't be translated. Cap the number of polls. A `job_id` the API has never seen is reported as `processing`, so a typo would otherwise poll forever. --- # Glossary and translation memory > Add your own terms to the glossary, search and edit every translation, and import or export both as CSV, all in the dashboard. Entries belong to your account. Source: https://www.fluentc.ai/docs/glossary/ Two things sit on top of the API, and you manage both in the [dashboard](https://dashboard.fluentc.io/users/sign_in): - **The glossary** is a list of terms and phrases, each with the translation you want. Brand names, product names, defined terms and the phrases your team always says one way belong here. - **The translations list** holds every translation your keys have made. Search it, edit any line and import or export it as CSV. Both names get used for the same feature in places, so this guide fixes them: *glossary* is the list of entries you write, and *translation memory* is the automatic reuse of finished translations described in [Concepts](https://www.fluentc.ai/docs/concepts.md#translation-memory). In the dashboard, the **Translation Memory** screen is where you manage the glossary. ## Glossary or translation memory | | Translation memory | Glossary | | --- | --- | --- | | What it does | Returns the stored translation for text FluentC has already translated | Tells FluentC how you want a term translated | | How it matches | Exact: a hash of the target language and the exact text | The entry's source text, wherever it appears in the text you send, for the language pair it was added for | | Who fills it | FluentC, automatically | You, in the dashboard | | Plan | Every plan | Every plan | The memory stays exact, never fuzzy. The glossary is how you bend a translation toward your own words. ## Add a term 1. Sign in to the [dashboard](https://dashboard.fluentc.io/users/sign_in), open **Translations**, then choose **Translation Memory** and **Add Entry**. 2. Pick the source language and the target language. An entry belongs to one language pair, so add one per language you translate into. 3. Enter the source text and the translation you want. 4. Add a note if the model needs context, such as "product name, keep in English". Notes are passed to the model with the entry. 5. Save. The entry is **Active**. To add many entries at once, switch on **Bulk Entry Mode** and paste the source texts and the translations as two matching lists, one per line. You can edit an entry, **Deactivate** it to stop using it without deleting it, or delete it. Filter by language pair and status, or search the source and target text. ### Import and export entries **Export current filters to CSV** downloads the entries you are looking at, with the columns `id`, `source_language`, `target_language`, `source_text`, `target_text`, `active` and `notes`. **Import entries from CSV** reads the same columns. A row with an `id` updates that entry, and a row without one creates a new entry. ## How entries are used - **Account-wide.** Entries belong to your account, not to one key, so a term you add is used for every key on the account, through the REST API, the MCP server, LangChain tools, the n8n node, Make, Zapier and function calling. - **Active entries only.** FluentC uses an active entry when the source text appears in what you send and the language pair matches. Inactive entries are ignored. - **Real-time and batch.** Entries apply in both modes. - **New translations.** The glossary shapes the translation FluentC makes. Text that is already stored is returned as it is, so to change a line that exists, edit it in the translations list. - **Keep entries short.** A name, a term or a phrase works better than a paragraph. ## Edit every translation 1. In the dashboard, open **Translations**. 2. Choose a site and a language. Search the original or translated text, and sort by last updated, original text or translated text. 3. Open a line, change the translation and save. For many lines at once, choose **Export current view to CSV**, edit the `translated_text` column and leave `id` and `type` as they are, then choose **Import translations from CSV**. FluentC reports how many lines it saved and which rows it skipped. ## Review once, send everywhere The loop for a team with many agents is short. Send the sentences that matter, read the translations once, fix any line in the dashboard, and add recurring terms to the glossary. Every agent on the account then sends the reviewed words, through any integration. [Concepts](https://www.fluentc.ai/docs/concepts.md#consistency-across-agents) explains why identical input returns identical output, and [Ten agents, one translation](https://www.fluentc.ai/articles/ten-agents-one-translation/) shows the loop in an example. ## What it doesn't do - **It doesn't make the memory fuzzy.** The memory matches identical text only. - **It doesn't fix your source text.** If two agents word the English differently, they send different strings. Standardise the sentences you care about. - **It doesn't replace review.** For regulated or high-stakes content, keep your own review process. The glossary and the dashboard make that review a one-time job per phrase. --- # Translate > POST /ai_agent/translate. Translate text, HTML or JSON in real-time or batch mode. Request fields, response shapes, formats, and every validation error. Source: https://www.fluentc.ai/docs/api/translate/ ```http POST https://api.fluentc.ai/ai_agent/translate ``` Translates `input` into `target_language`. In `real-time` mode the translation is in the response. In `batch` mode the response is a `job_id` and you fetch the result with [Batch results](https://www.fluentc.ai/docs/api/batch-results.md). ## Request Headers: | Header | Value | | --- | --- | | `Authorization` | Your API key, with no `Bearer` prefix. See [Authentication](https://www.fluentc.ai/docs/authentication.md). | | `Content-Type` | `application/json` | Body: | Field | Type | Required | Description | | --- | --- | --- | --- | | `input` | string or object | Yes | The content to translate. A JSON object is accepted when `input_format` is `json`. | | `input_format` | string | Yes | `text`, `html` or `json`. | | `target_language` | string | Yes | Language to translate into. Two or three lowercase letters such as `es`. Must be enabled for your key. | | `source_language` | string | No | Language of `input`. Same format as `target_language`. If omitted, it is worked out from the text. | | `mode` | string | Yes | `real-time` or `batch`. Case-insensitive. | Language codes and formats are explained in [Concepts](https://www.fluentc.ai/docs/concepts.md#language-codes). ## Response: real-time `200 OK` ```json { "status": "complete", "translation": "¡Hola, mundo!", "token_count": 15, "source_language_detected": "en" } ``` | Field | Type | Description | | --- | --- | --- | | `status` | string | Always `complete` in real-time mode. | | `translation` | string | The translated content. For `json` input this is a JSON-encoded string; parse it. | | `token_count` | integer | The size of the translation in tokens. | | `source_language_detected` | string | The source language code: detected, or the `source_language` you sent. | ## Response: batch `200 OK` ```json { "job_id": "abc123def456" } ``` The request is accepted and translated in the background. Pass `job_id` to [Batch results](https://www.fluentc.ai/docs/api/batch-results.md) until `status` is `complete`. The `job_id` is deterministic: the same `input` and `target_language` always produce the same ID, so it is safe to resubmit. ## Examples ### Text, real-time ```bash curl -X POST https://api.fluentc.ai/ai_agent/translate \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "Hello, world!", "input_format": "text", "target_language": "es", "source_language": "en", "mode": "real-time" }' ``` ```python import os import requests res = requests.post( "https://api.fluentc.ai/ai_agent/translate", headers={"Authorization": os.environ["FLUENTC_KEY"]}, json={ "input": "Hello, world!", "input_format": "text", "target_language": "es", "source_language": "en", "mode": "real-time", }, ) res.raise_for_status() print(res.json()["translation"]) # ¡Hola, mundo! ``` ```js const res = await fetch("https://api.fluentc.ai/ai_agent/translate", { method: "POST", headers: { Authorization: process.env.FLUENTC_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ input: "Hello, world!", input_format: "text", target_language: "es", source_language: "en", mode: "real-time", }), }); const body = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${body.error}`); console.log(body.translation); // ¡Hola, mundo! ``` ### HTML, batch Markup is preserved and the text inside it is translated. ```bash curl -X POST https://api.fluentc.ai/ai_agent/translate \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "This is a sample page.
", "input_format": "html", "target_language": "fr", "mode": "batch" }' ``` ```json { "job_id": "abc123def456" } ``` ### JSON, batch Send the structure as an object. String values are translated and the keys and shape are kept. ```bash curl -X POST https://api.fluentc.ai/ai_agent/translate \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "title": "Welcome", "cta": "Start now" }, "input_format": "json", "target_language": "ja", "mode": "batch" }' ``` When the job completes, `translation` is a JSON-encoded string: ```json { "status": "complete", "translation": "{\"title\":\"ようこそ\",\"cta\":\"今すぐ開始\"}", "token_count": 24, "source_language_detected": "en" } ``` ```python import json translated = json.loads(result["translation"]) print(translated["cta"]) # 今すぐ開始 ``` ## Errors Errors are JSON with an `error` string. The full list is on [Errors](https://www.fluentc.ai/docs/api/errors.md). The ones specific to this endpoint: | Status | Message | Fix | | --- | --- | --- | | `422` | `Input is missing` | Send a non-empty `input`. | | `422` | `Invalid or missing input format. Allowed formats: text, html, json` | Set `input_format` to one of the three. | | `422` | `Invalid or missing target language code.` | Use a lowercase two- or three-letter code. Region codes like `pt-BR` are not accepted. | | `422` | `Target language 'xx' is not enabled for this site.` | Pick a language from [Languages](https://www.fluentc.ai/docs/api/languages.md). | | `422` | `Invalid source language code: 'xx'.` | Fix `source_language`, or omit it. | | `422` | `Source language 'xx' is not enabled for this site.` | Pick a language from [Languages](https://www.fluentc.ai/docs/api/languages.md). | | `422` | `Invalid or missing mode. Allowed modes: batch, real-time` | Set `mode` to `batch` or `real-time`. | | `422` | `Realtime translation is not supported for this agent.` | Your key is on the Batch plan. Use `batch`, or move to the Real-time plan. | | `422` | `Agent translation is not supported for this site.` | The key isn't set up for the translation API. [Contact us](https://www.fluentc.ai/contact/). | | `422` | `Invalid JSON format` | `input_format` is `json` but `input` isn't valid JSON. | ## Notes - **Choose `batch` for large JSON.** It runs in parallel and reassembles the result for you. - **Pass `source_language` when you know it.** It avoids guesses on very short strings. - **Repeat requests are cheap.** Identical input and target language are answered from [translation memory](https://www.fluentc.ai/docs/concepts.md#translation-memory). - **Your terms are used.** Entries in your [glossary](https://www.fluentc.ai/docs/glossary.md) shape new translations, and you can search and edit every translation in the dashboard. - **Request size.** Batch requests carry up to 50,000 rows. The n8n node limits a single input to 100,000 bytes; see [n8n](https://www.fluentc.ai/docs/integrations/n8n.md). --- # Batch results > POST /ai_agent/results. Fetch the result of a batch translation by job_id. The three statuses, polling guidance, and the one case where a wrong job_id looks like processing. Source: https://www.fluentc.ai/docs/api/batch-results/ ```http POST https://api.fluentc.ai/ai_agent/results ``` Returns the current state of a batch job started with [Translate](https://www.fluentc.ai/docs/api/translate.md) in `batch` mode. ## Request Headers are the same as every endpoint: `Authorization` with your key and `Content-Type: application/json`. | Field | Type | Required | Description | | --- | --- | --- | --- | | `job_id` | string | Yes | The `job_id` returned by the batch request. | ```bash curl -X POST https://api.fluentc.ai/ai_agent/results \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "job_id": "abc123def456" }' ``` ## Response The HTTP status is `200` for all three states. Read `status` to tell them apart. ### `complete` ```json { "status": "complete", "translation": "Ceci est un exemple de page.
", "token_count": 31, "source_language_detected": "en" } ``` | Field | Type | Description | | --- | --- | --- | | `translation` | string | The translated content. For `json` input it is a JSON-encoded string; parse it. | | `token_count` | integer | The size of the translation. | | `source_language_detected` | string | The source language code. | ### `processing` ```json { "status": "processing", "estimated_wait_seconds": 5, "next_poll_after": "2026-01-15T10:30:00Z" } ``` | Field | Type | Description | | --- | --- | --- | | `estimated_wait_seconds` | integer | How long to wait before asking again. | | `next_poll_after` | string | The same moment as an ISO 8601 timestamp. | ### `failed` ```json { "status": "failed", "error": "Translation failed for the given job_id; content was recognized but the translation is unavailable." } ``` The job was recognised but no translation could be produced. Resubmit the request. Because job IDs are deterministic, resubmitting returns the same `job_id`. ## Polling 1. Submit the batch request and keep the `job_id`. 2. Call this endpoint. If `status` is `processing`, wait `max(estimated_wait_seconds, 5)` seconds and call again. 3. Stop on `complete` or `failed`. 4. **Cap the number of attempts** (60 is a sensible limit). > **Warning:** A `job_id` that doesn't exist, or one you mistyped, is reported as `processing`, not as an error. Without a cap, a wrong ID polls forever. JavaScript: ```js async function waitForTranslation(jobId, { maxAttempts = 60 } = {}) { for (let attempt = 0; attempt < maxAttempts; attempt++) { const res = await fetch("https://api.fluentc.ai/ai_agent/results", { method: "POST", headers: { Authorization: process.env.FLUENTC_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ job_id: jobId }), }); const body = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${body.error}`); if (body.status === "complete") return body.translation; if (body.status === "failed") throw new Error(body.error); const waitSeconds = Math.max(body.estimated_wait_seconds ?? 5, 5); await new Promise((resolve) => setTimeout(resolve, waitSeconds * 1000)); } throw new Error(`Job ${jobId} did not finish after ${maxAttempts} attempts`); } ``` ## Errors | Status | Message | Cause | | --- | --- | --- | | `422` | `job_id (hash_key) is missing` | The body has no `job_id`. | | `401`, `403` | See [Authentication](https://www.fluentc.ai/docs/authentication.md) | Key or account problem. | All error shapes are on [Errors](https://www.fluentc.ai/docs/api/errors.md). --- # Detect language > POST /ai_agent/checklanguage. Identify the language of text or HTML without translating it. Source: https://www.fluentc.ai/docs/api/detect-language/ ```http POST https://api.fluentc.ai/ai_agent/checklanguage ``` Identifies the language of `input` and reports how confident the detection is. Use it when you need to know the language before you decide what to do, for example to route a support ticket. If you only want a translation, skip this call: [Translate](https://www.fluentc.ai/docs/api/translate.md) works out the source language when you leave `source_language` out. ## Request Headers are the same as every endpoint: `Authorization` with your key and `Content-Type: application/json`. | Field | Type | Required | Description | | --- | --- | --- | --- | | `input` | string | Yes | The text or HTML to analyse. | | `input_format` | string | Yes | `text` or `html`. `json` is not accepted. | ```bash curl -X POST https://api.fluentc.ai/ai_agent/checklanguage \ -H "Authorization: $FLUENTC_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "Bonjour, comment allez-vous?", "input_format": "text" }' ``` ## Response `200 OK` ```json { "detected_language": "fr", "confidence": 0.99 } ``` | Field | Type | Description | | --- | --- | --- | | `detected_language` | string | The language code, in the same format as `target_language`. | | `confidence` | number | From 0 to 1. Higher is more certain. | Decide in your own code what to do below a confidence threshold you choose, for example to ask a person to check. ## Errors | Status | Message | Fix | | --- | --- | --- | | `422` | `Input is missing` | Send a non-empty `input`. | | `422` | `Invalid or missing input format. Allowed formats: text, html` | Set `input_format` to `text` or `html`. | Key and account errors are covered in [Authentication](https://www.fluentc.ai/docs/authentication.md). All error shapes are on [Errors](https://www.fluentc.ai/docs/api/errors.md). --- # Languages > GET /ai_agent/languages. List the languages enabled for your API key, to validate a language code before you translate or to populate a language picker. Source: https://www.fluentc.ai/docs/api/languages/ ```http GET https://api.fluentc.ai/ai_agent/languages ``` Returns the languages your key can use. A language must appear here before it can be a `target_language` or `source_language` in [Translate](https://www.fluentc.ai/docs/api/translate.md). ## Request No body. Send the `Authorization` header. ```bash curl https://api.fluentc.ai/ai_agent/languages \ -H "Authorization: $FLUENTC_KEY" ``` ## Response `200 OK` ```json { "supported_languages": [ { "code": "es", "name": "Spanish" }, { "code": "fr", "name": "French" }, { "code": "de", "name": "German" } ], "source_languages": [ { "code": "en", "name": "English" } ] } ``` | Field | Type | Description | | --- | --- | --- | | `supported_languages` | array | Languages you can translate into. | | `source_languages` | array | Languages you can name as `source_language`. | | `code` | string | The code to send to the API. Lowercase, two or three letters. | | `name` | string | The language's name in English. | Both lists reflect what is enabled for your key, so they can differ from key to key. ## Using it - **Validate before you translate.** Fetch the list once at startup and check `target_language` against it, instead of waiting for a `422`. - **Build a language picker.** Show `name`, send `code`. - **Cache it.** The list changes only when you change your account's languages. ```js const res = await fetch("https://api.fluentc.ai/ai_agent/languages", { headers: { Authorization: process.env.FLUENTC_KEY }, }); const { supported_languages } = await res.json(); const codes = new Set(supported_languages.map((l) => l.code)); if (!codes.has("ja")) throw new Error("Japanese isn't enabled for this key"); ``` ## Errors Only key and account errors apply: `401` and `403`. See [Authentication](https://www.fluentc.ai/docs/authentication.md) and [Errors](https://www.fluentc.ai/docs/api/errors.md). --- # Errors > Every HTTP status and error message the FluentC API returns, what causes it, and which ones are safe to retry. Source: https://www.fluentc.ai/docs/api/errors/ ## Error shape Errors are JSON with a single `error` string, and the HTTP status tells you the class of problem. ```json { "error": "Target language 'es' is not enabled for this site." } ``` Branch on the status code first. Match on the message only for the specific cases below; the messages are quoted exactly as the API returns them. The one exception: a batch job that couldn't be translated is not an HTTP error. [Batch results](https://www.fluentc.ai/docs/api/batch-results.md) returns `200` with `"status": "failed"` and an `error` string. ## Status codes | Status | Meaning | Retry? | | --- | --- | --- | | `200` | Success. For batch results, check `status`. | n/a | | `401` | Authentication failed. | No. Fix the key. | | `403` | The key is valid but the account can't make this request. | No. Fix the account. | | `422` | The request is invalid. | No. Fix the request. | | `500` | Something went wrong on our side. | Yes, with backoff. | ## 401 Unauthorized | Message | Cause | | --- | --- | | `API key (Site UUID) is missing` | The `Authorization` header is absent or empty. | | `Invalid API key: Site not found.` | The key is wrong, has extra characters, or has a `Bearer` prefix. | | `Invalid API key: Associated company not found.` | The key's account can't be resolved. [Contact us](https://www.fluentc.ai/contact/). | ## 403 Forbidden | Message | Cause | | --- | --- | | `Access denied: Translations are disabled for this site.` | Translation is switched off for the key's site. | | `Subscription error: ...` | The subscription isn't active, or has no languages. The text after the colon says which. | | `Usage limit error: ...` | A usage limit was reached. The text after the colon says which. | ## 422 Unprocessable Entity | Message | Endpoint | Cause | | --- | --- | --- | | `Input is missing` | translate, checklanguage | `input` is empty or absent. | | `Invalid or missing input format. Allowed formats: text, html, json` | translate | `input_format` isn't one of the three. | | `Invalid or missing input format. Allowed formats: text, html` | checklanguage | `input_format` isn't `text` or `html`. | | `Invalid or missing target language code.` | translate | `target_language` isn't two or three lowercase letters. | | `Target language 'xx' is not enabled for this site.` | translate | Valid code, but not enabled for your key. | | `Invalid source language code: 'xx'.` | translate | `source_language` isn't two or three letters. | | `Source language 'xx' is not enabled for this site.` | translate | Valid code, but not enabled for your key. | | `Invalid or missing mode. Allowed modes: batch, real-time` | translate | `mode` is absent or unknown. | | `Realtime translation is not supported for this agent.` | translate | `real-time` on a Batch plan key. | | `Agent translation is not supported for this site.` | translate | The key isn't set up for the translation API. | | `Invalid JSON format` | translate | `input_format` is `json` but `input` isn't valid JSON. | | `job_id (hash_key) is missing` | results | The body has no `job_id`. | ## 500 Internal Server Error ```json { "error": "An unexpected error occurred during authentication." } ``` Retry with exponential backoff. If it keeps happening, [contact us](https://www.fluentc.ai/contact/) with the time of the request and the `job_id` if there was one. ## Retrying - **Do retry** `500` responses and network timeouts. Wait 1 second, then 2, 4, 8, up to a limit you choose, and add a little random jitter. - **Back off** if you hit a plan limit. Rate limits depend on your plan; the Batch plan allows 20 calls per hour. Treat `429` the same way as `500`. - **Don't retry** `401`, `403` or `422` unchanged. They will fail the same way. - **Batch requests are safe to resubmit.** The `job_id` is deterministic for the same input and target language. ```js async function translateWithRetry(body, attempts = 4) { for (let i = 0; i < attempts; i++) { const res = await fetch("https://api.fluentc.ai/ai_agent/translate", { method: "POST", headers: { Authorization: process.env.FLUENTC_KEY, "Content-Type": "application/json", }, body: JSON.stringify(body), }); if (res.ok) return res.json(); const retryable = res.status === 429 || res.status >= 500; if (!retryable || i === attempts - 1) { const { error } = await res.json().catch(() => ({})); throw new Error(`${res.status}: ${error ?? res.statusText}`); } const delay = 1000 * 2 ** i + Math.random() * 250; await new Promise((resolve) => setTimeout(resolve, delay)); } } ``` --- # Choose an integration > How to pick between the REST API, the MCP server, LangChain tools, the n8n node, Make and Zapier, and function calling, and what they all have in common. Source: https://www.fluentc.ai/docs/integrations/overview/ All of FluentC's integrations call the same engine. They differ in who decides when to translate: your code, an AI agent, or a workflow. ## Which one to use | You are... | Use | Why | | --- | --- | --- | | Writing application code in any language | [REST API](https://www.fluentc.ai/docs/api/translate.md) | Full control; works anywhere that can send HTTP | | Giving an AI agent or MCP client a translation tool | [MCP server](https://www.fluentc.ai/docs/integrations/mcp.md) | The agent discovers and calls the tool itself; no glue code | | Building agents or chains with LangChain in Python | [LangChain tools](https://www.fluentc.ai/docs/integrations/langchain.md) | Ready-made `BaseTool` classes, including batch polling | | Building workflows in n8n | [n8n node](https://www.fluentc.ai/docs/integrations/n8n.md) | Visual nodes, language dropdowns, automatic batch polling | | Using Make or Zapier | [Make and Zapier](https://www.fluentc.ai/docs/integrations/make-zapier.md) | HTTP steps; no code | | Using a model with tool calling (OpenAI or others) | [Function calling](https://www.fluentc.ai/docs/integrations/function-calling.md) | One tool definition and a small handler | If your tool isn't listed, use the [REST API](https://www.fluentc.ai/docs/api/translate.md). Anything that can send an HTTP request can call FluentC. ## What they share - **One API key.** Create it in the [dashboard](https://dashboard.fluentc.io/users/sign_up) and use it everywhere. See [Authentication](https://www.fluentc.ai/docs/authentication.md). - **One plan.** A Batch plan key can use batch mode in any integration. Real-time mode needs the Real-time plan. See [Concepts](https://www.fluentc.ai/docs/concepts.md#plans-and-modes). - **One translation memory.** A string translated through n8n is answered from memory when an agent asks for it later. See [Concepts](https://www.fluentc.ai/docs/concepts.md#translation-memory). - **One glossary.** Your terms are managed once in the dashboard and used by every integration. See [Glossary and translation memory](https://www.fluentc.ai/docs/glossary.md). - **The same rules.** Language codes, input formats and limits are identical, so everything in the [REST reference](https://www.fluentc.ai/docs/api/translate.md) applies. ## Real-time or batch in an integration | If the translation is... | Use | | --- | --- | | Part of a conversation or a tool call someone is waiting on | `real-time` | | A large document, catalog, or a list of strings | `batch` | | Triggered in bulk by a schedule | `batch` | Integrations that poll batch jobs for you (the n8n node, the LangChain batch tool) cap the number of attempts, so a job that never finishes ends with a clear error instead of hanging. --- # MCP server > Connect an MCP client such as Claude or Cursor to the FluentC MCP server, so an agent can translate on its own. Server URL, authentication, client configuration and troubleshooting. Source: https://www.fluentc.ai/docs/integrations/mcp/ The FluentC MCP server gives any agent that speaks the [Model Context Protocol](https://modelcontextprotocol.io) a translation tool. The agent decides when to translate; you don't write glue code. - **Server URL:** `https://mcp.fluentc.ai` - **Authentication:** your FluentC API key in the `Authorization` header, sent as-is with no `Bearer` prefix, the same as the REST API. - **Plan and languages:** the same as the REST API. The server uses your key's languages and plan. ## Connect a client You need an [API key](https://dashboard.fluentc.io/users/sign_up). Add FluentC as a remote MCP server in your client. ### Claude Code ```bash claude mcp add --transport http fluentc https://mcp.fluentc.ai \ --header "Authorization: YOUR_FLUENTC_KEY" ``` ### Cursor and other clients with a JSON config Most MCP clients take a JSON entry like this (Cursor reads it from `.cursor/mcp.json`): ```json { "mcpServers": { "fluentc": { "url": "https://mcp.fluentc.ai", "headers": { "Authorization": "YOUR_FLUENTC_KEY" } } } } ``` Keep the key out of files you commit. Use your client's support for environment variables or a secrets store where it has one. ### Any other client Point it at `https://mcp.fluentc.ai` as a remote HTTP server and set one request header, `Authorization`, to your key. Check your client's documentation for where headers go. ## Check the connection The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) connects to a server and lists what it offers: ```bash npx @modelcontextprotocol/inspector ``` Enter `https://mcp.fluentc.ai` as the server URL, add the `Authorization` header, and connect. You should see FluentC's tools listed. ## What the agent sees When a client connects, the server lists its tools, each with a name, a description and an input schema. Your client shows the current set and the agent chooses among them, so the tool list here never goes stale. The tools wrap the same operations as the [REST API](https://www.fluentc.ai/docs/api/translate.md), so the same rules apply: - Languages are lowercase two- or three-letter codes, and must be enabled for your key. See [Languages](https://www.fluentc.ai/docs/api/languages.md). - Real-time translation needs the Real-time plan. Batch needs a job to be polled for its result. See [Concepts](https://www.fluentc.ai/docs/concepts.md). - Repeated text is answered from [translation memory](https://www.fluentc.ai/docs/concepts.md#translation-memory). - Your terms come from your [glossary](https://www.fluentc.ai/docs/glossary.md), which you manage in the dashboard. ## Prompting an agent Agents translate best when the request is specific. - Name the target language: "translate this into Japanese" or "into `ja`". - Say what the text is if it matters: UI label, legal notice, chat message. - For a lot of text, ask for batch mode and say it can wait for the result. ## Troubleshooting | Symptom | Likely cause | | --- | --- | | The client can't connect, or reports `401` | The key is missing or wrong, or has a `Bearer` prefix. See [Authentication](https://www.fluentc.ai/docs/authentication.md). | | Tools don't appear | The client didn't send the header, or needs a restart after you edit its config. | | A translation fails with "not enabled" | The language isn't enabled for your key. See [Languages](https://www.fluentc.ai/docs/api/languages.md). | | A real-time call fails with "not supported for this agent" | Your key is on the Batch plan. Ask for batch mode, or move to the Real-time plan. | | `403` | The subscription is inactive or a usage limit was reached. See [Errors](https://www.fluentc.ai/docs/api/errors.md). | If it still doesn't work, [contact us](https://www.fluentc.ai/contact/) with your client's name and the error text. --- # LangChain tools > The official fluentc-langchain-tool Python package. Install it, translate in real time or batch, detect languages, and give a LangChain agent FluentC as tools. Source: https://www.fluentc.ai/docs/integrations/langchain/ `fluentc-langchain-tool` is the official Python package for using FluentC from LangChain. Each capability is a LangChain tool (a `BaseTool` subclass), so you can call it directly or hand it to an agent. - **Requires:** Python 3.8 or newer and LangChain. - **Authentication:** your FluentC API key, passed to each tool's constructor. See [Authentication](https://www.fluentc.ai/docs/authentication.md). - **Source of truth:** the package's page on [PyPI](https://pypi.org/project/fluentc-langchain-tool/). ## Install ```bash pip install fluentc-langchain-tool ``` ```python import os API_KEY = os.environ["FLUENTC_KEY"] ``` ## The tools | Class | Tool name | What it does | | --- | --- | --- | | `FluentCTranslationTool` | `fluentc_translation` | Translate in real-time or batch mode | | `FluentCBatchTranslationTool` | `fluentc_batch_translation` | Submit a batch job and wait for the result | | `FluentCLanguageDetectorTool` | `fluentc_language_detector` | Detect the language of some text | | `FluentCTranslationStatusTool` | `fluentc_translation_status` | Check a batch job by `job_id` | | `FluentCSupportedLanguagesTool` | `fluentc_supported_languages` | List the languages enabled for your key | | `FluentCResultsTool` | `fluentc_results` | Legacy. Use `fluentc_translation_status` instead | All tools take the API key as their only constructor argument: `FluentCTranslationTool(api_key=API_KEY)`. Tools return a string, which is what an agent reads back. ## Translate in real time ```python from fluentc_langchain_tool import FluentCTranslationTool tool = FluentCTranslationTool(api_key=API_KEY) result = tool.run({ "text": "Hello, world!", "target_language": "fr", "source_language": "en", "mode": "realtime", }) print(result) # Bonjour, le monde ! ``` Input fields for `fluentc_translation`: | Field | Type | Required | Description | | --- | --- | --- | --- | | `text` | string or list of strings | Yes | What to translate. | | `target_language` | string | Yes | Target language code, such as `fr`. | | `source_language` | string | Yes | Source language code, such as `en`. | | `mode` | string | No | `realtime` (default) or `batch`. | | `callback_url` | string | No | For batch mode: a URL to notify when the job completes. | Real-time mode needs the Real-time plan. See [Concepts](https://www.fluentc.ai/docs/concepts.md#plans-and-modes). ## Translate in batch `FluentCBatchTranslationTool` submits the job and polls until it finishes or `max_wait_time` runs out: ```python from fluentc_langchain_tool import FluentCBatchTranslationTool tool = FluentCBatchTranslationTool(api_key=API_KEY) result = tool.run({ "text": "Hello, batch world!", "target_language": "de", "source_language": "en", }) print(result) # the translated output, once the job completes ``` Input fields for `fluentc_batch_translation`: | Field | Type | Default | Description | | --- | --- | --- | --- | | `text` | string or list of strings | required | What to translate. | | `target_language` | string | required | Target language code. | | `source_language` | string | required | Source language code. | | `wait_for_completion` | boolean | `true` | Set `false` to return the job ID immediately. | | `max_wait_time` | integer | `300` | Seconds to wait before giving up. | | `callback_url` | string | none | A URL to notify when the job completes. | To control the loop yourself, set `wait_for_completion` to `false` and check the job with `FluentCTranslationStatusTool`: ```python from fluentc_langchain_tool import FluentCTranslationStatusTool status = FluentCTranslationStatusTool(api_key=API_KEY) print(status.run({"job_id": "abc123def456"})) ``` ## Detect a language ```python from fluentc_langchain_tool import FluentCLanguageDetectorTool detector = FluentCLanguageDetectorTool(api_key=API_KEY) print(detector.run({"text": "Hola, ¿cómo estás?"})) # Detected language: es (confidence: 0.99) ``` ## List supported languages ```python from fluentc_langchain_tool import FluentCSupportedLanguagesTool languages = FluentCSupportedLanguagesTool(api_key=API_KEY) print(languages.run({})) ``` ## Use the tools in an agent Pass the tools to any LangChain agent. The tool names and descriptions tell the model when to use each one. ```python from langchain.agents import initialize_agent from langchain.llms import OpenAI from fluentc_langchain_tool import ( FluentCTranslationTool, FluentCLanguageDetectorTool, ) agent = initialize_agent( tools=[ FluentCTranslationTool(API_KEY), FluentCLanguageDetectorTool(API_KEY), ], llm=OpenAI(temperature=0), agent="zero-shot-react-description", ) agent.run("Translate 'Hello world' from English to German using FluentC.") ``` This example uses LangChain's classic `initialize_agent` interface. The tools are standard `BaseTool` objects, so they work with newer LangChain agent constructors too. ## Errors The tools catch API errors and return them as a readable string, for example `Translation error: ...`, instead of raising. An agent can read that and recover or report it. If you need exceptions, call the [REST API](https://www.fluentc.ai/docs/api/translate.md) directly. The usual causes are on the [Errors](https://www.fluentc.ai/docs/api/errors.md) page: a language that isn't enabled for your key, a real-time request on a Batch plan key, or a key problem. --- # n8n node > Install and use the FluentC n8n community node. Credentials, the Translate, Detect and Get Many operations, batch polling, limits and common workflows. Source: https://www.fluentc.ai/docs/integrations/n8n/ `n8n-nodes-fluentc` is the FluentC community node for [n8n](https://n8n.io). It translates text, HTML and JSON, detects languages, and lists the languages enabled for your key, all from the canvas. Source: [GitHub](https://github.com/FluentC/n8n-nodes-fluentc). ## Install In n8n: 1. Open **Settings → Community Nodes** and choose **Install**. 2. Enter the package name `n8n-nodes-fluentc` and confirm. 3. The **FluentC** node is available straight away. You can also search for "FluentC" in the node panel. Self-hosted n8n, from the command line: ```bash cd ~/.n8n/nodes # create it if it doesn't exist npm install n8n-nodes-fluentc # restart n8n ``` With Docker, add the same `npm install` to your image: ```dockerfile FROM n8nio/n8n:latest RUN cd ~/.n8n/ && mkdir -p nodes && cd nodes && npm install n8n-nodes-fluentc ``` ## Add your credentials 1. In n8n, go to **Credentials → New** and choose **FluentC API**. 2. Paste your [API key](https://dashboard.fluentc.io/users/sign_up) into **API Key**. 3. Save. n8n tests the key by listing your languages. The node sends the key in the `Authorization` header as-is, so you paste the bare key. See [Authentication](https://www.fluentc.ai/docs/authentication.md). ## Operations Pick a **Resource**, then an **Operation**. | Resource | Operation | What it does | | --- | --- | --- | | Translation | Translate | Translate text, HTML or JSON in real-time or batch mode | | Language Detection | Detect | Detect the language of text or HTML | | Language | Get Many | List the languages enabled for your key | ### Translate | Field | Description | | --- | --- | | Mode | **Real-Time** for an immediate answer, **Batch** for large content. Real-time needs the Real-time plan. | | Input | The content to translate. Up to 100,000 bytes. | | Input Format | **Text**, **HTML** or **JSON**. | | Target Language | A dropdown filled from the languages enabled for your key. | | Source Language | Optional. Leave empty and the source language is worked out from the text. | | Max Polling Attempts | Batch only, under **Additional Fields**. 1 to 100, default 60. | In batch mode the node submits the job and then polls for you. It waits at least 5 seconds between polls (longer if the API asks), stops when the job completes, and fails the item with a clear error if the job fails or you run out of attempts. **Output.** One item per input item, containing the API's response plus the settings used: ```json { "status": "complete", "translation": "Tu pedido ha sido enviado.", "token_count": 9, "source_language_detected": "en", "mode": "real-time", "input_format": "text", "target_language": "es" } ``` `source_language` is added when you set one. For `JSON` input, `translation` is a JSON-encoded string; parse it with n8n's **Edit Fields** or a Code node. See [Translate](https://www.fluentc.ai/docs/api/translate.md) for every field. ### Detect Takes **Input** and **Input Format** (**Text** or **HTML**). The output is the API's response (the detected language and a confidence score, see [Detect language](https://www.fluentc.ai/docs/api/detect-language.md)) plus `input_format` and `input_length`. ### Get Many (languages) No parameters. The output has two arrays, `supported_languages` and `source_languages`, each item `{ "code": "es", "name": "Spanish" }`. The Target Language and Source Language dropdowns in the Translate operation are filled from the same call. ## Workflows ### Translate one value 1. Add a **FluentC** node. 2. Set **Resource** to **Translation** and **Operation** to **Translate**. 3. Set **Mode** to **Real-Time** or **Batch**. 4. Enter the content in **Input**, or map it from the previous node, and set **Input Format**. 5. Pick a **Target Language** and run the node. The translation is in `translation`. ### Detect, then translate 1. Add a **FluentC** node set to **Language Detection → Detect**. 2. Connect it to a second **FluentC** node set to **Translation → Translate**. 3. In the Translate node, map the detected language to **Source Language** with an expression. 4. Add an **IF** node before Translate if you only want to translate when the language isn't your own, or when confidence is low. ### Translate a list n8n runs a node once per input item, so feed it a list and it translates each item. Use **Batch** mode for long lists. Identical items are answered from [translation memory](https://www.fluentc.ai/docs/concepts.md#translation-memory), so duplicates in a list cost little. Product names and other terms you want translated a set way go in your [glossary](https://www.fluentc.ai/docs/glossary.md). ## Errors and limits - **Continue On Fail.** Turn it on in the node settings and a failed item comes out as `{ "error": "..." }` instead of stopping the workflow. - **Input size.** A single input over 100,000 bytes fails before it is sent. Split large content, or send it as a list of items. - **Languages fallback.** If listing languages fails with Continue On Fail on, the Get Many operation returns a built-in list of ten common languages with the error. Don't treat it as your enabled set. - **Plan.** Real-time mode on a Batch plan key fails with `Realtime translation is not supported for this agent.` Switch the node to Batch. - **API errors** such as `401`, `403` and `422` pass through with the API's message. See [Errors](https://www.fluentc.ai/docs/api/errors.md). ## Ideas that work well - **Multilingual chatbot:** detect the user's language, translate the question to yours, translate the answer back. - **Support triage:** translate every incoming ticket so one team can read and route them. - **Catalog translation:** run a product feed through Batch once; reruns are answered from memory. - **Newsletter localisation:** translate a campaign into each segment's language before it sends. --- # Make and Zapier > Call FluentC from Make scenarios and Zapier Zaps with a plain HTTP step. Request settings, a real-time pattern, a batch pattern with polling, and tips for avoiding duplicate work. Source: https://www.fluentc.ai/docs/integrations/make-zapier/ Make and Zapier don't need a dedicated app to use FluentC. Both can send an HTTP request, and that is all the [REST API](https://www.fluentc.ai/docs/api/translate.md) needs. ## The request Every step uses the same settings: | Setting | Value | | --- | --- | | Method | `POST` | | URL | `https://api.fluentc.ai/ai_agent/translate` | | Header `Authorization` | Your API key, exactly as the dashboard shows it. No `Bearer`. | | Header `Content-Type` | `application/json` | | Body | JSON, as below | Body for real-time mode: ```json { "input": "{{your text from the previous step}}", "input_format": "text", "target_language": "es", "mode": "real-time" } ``` Map your own text into `input` with the tool's field picker. The `{{ }}` above stands for that mapping. The response has the translation in `translation`. See [Translate](https://www.fluentc.ai/docs/api/translate.md) for every field and [Authentication](https://www.fluentc.ai/docs/authentication.md) for the key. > **Note:** Real-time mode needs the Real-time plan. On a Batch plan key use `"mode": "batch"` and the polling pattern below. ## Make 1. Add the **HTTP → Make a request** module. 2. Set **URL**, **Method** (`POST`) and the two **Headers** from the table. 3. Set **Body type** to **Raw**, **Content type** to **JSON (application/json)**, and paste the body into **Request content**. 4. Turn on **Parse response**. The fields `translation`, `status` and `source_language_detected` are then available to later modules. 5. If a request can fail, add an error handler route so one bad item doesn't stop the scenario. ## Zapier 1. Add an action: **Webhooks by Zapier → Custom Request**. 2. Set **Method** to `POST` and **URL** to the translate URL. 3. In **Data**, paste the JSON body and map your fields into it. 4. In **Headers**, add `Authorization` and `Content-Type` as pairs. 5. Later steps can use `translation` from the response. ## Example: translate form submissions 1. **Trigger:** a Google Form response is submitted. 2. **Request:** translate the answer into your team's language (real-time). 3. **Deliver:** add the translation to a Google Sheet row, or post it to Slack. The same shape works for CRM records, support tickets and chat messages. ## Batch with polling Use batch for large or scheduled work, or when your key is on the Batch plan. It takes two requests. **1. Submit.** The same request with `"mode": "batch"`. The response is `{ "job_id": "..." }`. **2. Wait, then fetch.** Add a delay (10 seconds is a good start), then send: | Setting | Value | | --- | --- | | Method | `POST` | | URL | `https://api.fluentc.ai/ai_agent/results` | | Body | `{ "job_id": "