---
title: Text Translator
slug: api-marketplace/text-translator
createdAt: 2024-07-19T12:50:51.947Z
---

## Introduction

The Text Translator API provides a simple and efficient way to translate text from one language to another. Whether you're building a multilingual application, need to translate user input, or want to localize your content, our API offers a seamless solution.

***

## API details

### Endpoint

:::CodeblockTabs
Production Environment

```jsx
POST https://api.signzy.app/api/v3/translators/text
```
:::

:::CodeblockTabs
UAT/Testing environment

```jsx
POST https://api-preproduction.signzy.app/api/v3/translators/text
```
:::

***

### Request headers&#x20;

| Name          | Value            | Required  | Description                                                                                                |
| ------------- | ---------------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| Content-Type  | application/json | Mandatory | The type of content that the request body contains.                                                        |
| Authorization | XXXXXXXXXXXXXXX  | Mandatory | An authentication token to authorize the request. Reach out to the Signzy support team to get one created. |

***

### Request body parameters

| Parameter | Data Type        | Description                                              | Required  |
| --------- | ---------------- | -------------------------------------------------------- | --------- |
| language  | string           | The language in which you wanted to translate your text. | Mandatory |
| input     | Array of Objects | Statement you want to convert.                           | Mandatory |

```json
{
    "language":"hi",
    "input": [
        {
            "source": "તારું નામ શું છે"
        },
        {
            "source": "મારું નામ રામ છે"
        }
    ]
}
```

***

### Code samples

:::CodeblockTabs
```curl
curl --location 'https://api.signzy.app/api/v3/translators/text' \
--header 'Content-Type: application/json' \
--header 'Authorization: <Auth Token>' \
--data '{
    "language":"hi",
    "input": [
        {
            "source": "મારું નામ રામ છે"
        },
        {
            "source": "તારું નામ શું છે"
        }
    ]
}'
```

```nodejs
import requests
import json

url = "https://api.signzy.app/api/v3/translators/text"

payload = json.dumps({
  "task": "translation",
  "language": "hi",
  "input": [
    {
      "source": "મારું નામ રામ છે"
    },
    {
      "source": "તારું નામ શું છે"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': '<Auth Token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

```python
import requests
import json

url = "https://api.signzy.app/api/v3/translators/text"

payload = json.dumps({
  "task": "translation",
  "language": "hi",
  "input": [
    {
      "source": "મારું નામ રામ છે"
    },
    {
      "source": "તારું નામ શું છે"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': '<Auth Token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.signzy.app/api/v3/translators/text"
  method := "POST"

  payload := strings.NewReader(`{
    "task": "translation",
    "language":"hi",
    "input": [
        {
            "source": "મારું નામ રામ છે"
        },
        {
            "source": "તારું નામ શું છે"
        }
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "<Auth Token>")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```
:::

***

### Language code List

| Language Code | Language  |
| ------------- | --------- |
| en            | English   |
| as            | Assamese  |
| bn            | Bengali   |
| brx           | Bodo      |
| doi           | Dogri     |
| gom           | Konkani   |
| gu            | Gujarati  |
| hi            | Hindi     |
| kn            | Kannada   |
| ks            | Kashmiri  |
| mai           | Maithili  |
| ml            | Malayalam |
| mni           | Manipuri  |
| mr            | Marathi   |
| ne            | Nepali    |
| or            | Odia      |
| pa            | Punjabi   |
| sa            | Sanskrit  |
| sat           | Santali   |
| sd            | Sindhi    |
| ta            | Tamil     |
| te            | Telugu    |
| ur            | urdu      |

***

### Response body parameters

| Parameter     | Data Type        | Description                                 |
| ------------- | ---------------- | ------------------------------------------- |
| result        | Array of Objects | A list containing the translation results.  |
| result.source | String           | The original text that was translated.      |
| result.target | String           | The translated text in the target language. |

:::CodeblockTabs
200

```json
{
    "result": [
        {
            "source": "મારું નામ રામ છે",
            "target": "मेरा नाम राम है।"
        },
        {
            "source": "તારું નામ શું છે",
            "target": "तेरा नाम क्या है?"
        }
    ]
}
```

400

```json
// When task is not translation
{
    "error": {
        "name": "error",
        "message": "Task is tts",
        "status": 400,
        "reason": "VALIDATION_ERROR",
        "type": "Bad Request",
        "statusCode": 400
    }
}
//When the language is invalid
{
    "error": {
        "name": "error",
        "message": "Invalid language",
        "status": 400,
        "reason": "VALIDATION_ERROR",
        "type": "Bad Request",
        "statusCode": 400
    }
}
```

401

```json
// When API key is not passed in headers
{
    "message": "No API key found in request"
}

// When wrong API key is passed in headers
{
    "message": "Invalid authentication credentials"
}
```

409

```json
{
    "error": {
        "name": "error",
        "message": "Error in getting Data from Upstream",
        "status": 409,
        "reason": "ERROR",
        "type": "Conflict",
        "statusCode": 409
    }
}
```
:::

***

**Contact Us for Any Assistance**

If you have any questions or need assistance, please reach out to our customer support team. You can contact us via email at <font color="#2166ae">**help\@signzy.com**</font>. We strive to provide prompt and reliable assistance, ensuring your queries are addressed effectively.

We value your feedback and are committed to making your experience smooth and enjoyable. Our team is dedicated to assisting you with any needs you may have. Thank you for choosing our services. We look forward to helping you!

