# Translation API - Ecommerce field Text/HTML translation

## API Overview

- The translated text by AI, specially optimized for e-commerce field

## API URL

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

## 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 |
| sourceText | string | Source text, and the character count needs to be less than 5000 | 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/ecommerce?apiToken=xxxxxx'

```

## Response Example

```json

{
  "code": 200,
  "msg": "success",
  "data": {
    "fromLang": "zh",
    "translated": "Face Recognition Fingerprint Lock Smart Door Lock",
    "charCount": "11"
  }
}

```