# Translation API - Batch Text/HTML Translation

## API Overview

- The result of batch translation

## API URL

`POST https://api.tmapi.io/trans/v1/batch`

## Request Parameters

### Body

| Field | Type | Explanation | Required |
| --- | --- | --- | --- |
| format | string | Optional values: `text`, `html`<br/>Default value: text | false |
| fromLang | string | Source language, two-letter language code(ISO 639-1 standard), default value: `auto` | false |
| toLang | string | Target language, two-letter language code(ISO 639-1 standard) | true |
| sourceTextMap | object | Key-value pair format<br/>**key** is the unique identifier of the text to be translated, can be used to correspond to source text,<br/>**value** is the text to be translated.<br/>eg.: `{ "1": "男士T恤衫", "2": "夏季裙子"}` | true |
| scene | string | Translation scene, optional values:<br/>`title`(product title)<br/>`description`(product detailed description)<br/>`chat`(for the communication scenario with e-commerce buyers and sellers)<br/>`other`(other common scenarios) | true |

## Security Auth

> Please go to [Console-Account Center](https://console.tmapi.io/account/center) to get your apiToken.

> Add your apiToken to the request parameters. Please refer to the examples below.

## Request Example

```bash

curl --request POST 'https://api.tmapi.io/trans/v1/batch?apiToken=xxxxxx'

```

## Response Example

```json

{
  "code": 200,
  "msg": "success",
  "data": {
    "1": {
      "fromLang": "zh",
      "translated": "Men's T-shirt",
      "charCount": "5"
    },
    "2": {
      "fromLang": "zh",
      "translated": "Summer dress",
      "charCount": "4"
    }
  }
}

```