# Translator API

> Translator is a language translation API that translates plain text or HTML into target languages using standard language codes. Submit any string with a target language code to receive the translated text, both language names, and the confirmed or auto-detected source language.

**Endpoint:** `POST https://api.apiverve.com/v1/translator`  
**Category:** Text Processing  
**Cost:** 40 credits per call  
**Canonical page:** https://apiverve.com/marketplace/translator

## Overview

A translation API for apps, support desks and content pipelines. Translator converts text between languages with neural machine translation and detects the source language when you leave it out. Set format to html to translate web content: tags and attributes stay intact and only the text between them is translated (entities such as &amp; are decoded and may be translated as words). Each response names both languages in English, says whether the source was detected, and counts the characters translated.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/translator" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"I'\''m so excited that tomorrow is going to be sunny! Can'\''t wait!","target":"es","source":"en","format":"value"}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | The text to translate. length 0-50000 |
| `target` | string | Yes | The language code to translate the text to (e.g., fr, es, de). length 0-10 |
| `source` | string | No | The language code of the text to translate (e.g., en). If left blank, language will be auto-detected |
| `format` | string | No | text (default) or html. With html, tags and attributes are kept and only the text between tags is translated; entities such as &amp; are decoded and may be translated as words. Any other value returns 400. default text |

## Response fields

- `sourceLang` — string · The detected or specified source language code
- `targetLang` — string · The target language code for translation output
- `translatedText` — string · The translated text in the target language
- `sourceLangName` — string · English name of the source language (e.g. English); null for an unrecognised code
- `targetLangName` — string · English name of the target language (e.g. Spanish); null for an unrecognised code
- `sourceDetected` — boolean · True when the source language was auto-detected rather than sent
- `format` — string · Whether the text was translated as plain text or html
- `characterCount` — number · Number of characters in the submitted text

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "sourceLang": "en",
    "targetLang": "es",
    "translatedText": "¡Estoy tan emocionada de que mañana vaya a hacer sol! ¡Qué ganas tengo!",
    "sourceLangName": "English",
    "targetLangName": "Spanish",
    "sourceDetected": false,
    "format": "text",
    "characterCount": 62
  }
}
```

## Use cases

- **Live Agent Chat Translation** — When international customers message support in their native language, agents translate incoming tickets to draft localized replies without switching software.
- **Catalog Description Localization** — Translate marketplace product titles and item descriptions into target consumer languages before launching digital storefronts in new overseas territories.
- **App Store Review Translation** — Product teams convert foreign-language app store reviews into English using automatic language detection to monitor bug reports across regional markets.
- **Internal Employee Announcement Translation** — To keep distributed staff updated, internal communicators render company-wide policy updates into multiple recipient languages for regional email distributions.

## SDKs

- **npm** — `npm install @apiverve/translator` (https://www.npmjs.com/package/@apiverve/translator)
- **PyPI** — `pip install apiverve-translator` (https://pypi.org/project/apiverve-translator/)
- **NuGet** — `dotnet add package APIVerve.API.Translator` (https://www.nuget.org/packages/APIVerve.API.Translator)
- **Source** — https://github.com/apiverve/translator-api

## More

- Full reference: https://docs.apiverve.com/ref/translator
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
