> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reverieinc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transliteration API

> The Transliteration API enables you to convert text content from one language script to another. Below are examples demonstrating how to transliterate single and multiple sentences.

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://revapi.reverieinc.com' \
  --header 'Content-Type: application/json' \
  --header 'REV-API-KEY: <YOUR API KEY>' \
  --header 'REV-APP-ID: <YOUR APP-ID>' \
  --header 'src_lang: en' \
  --header 'tgt_lang: hi' \
  --header 'domain: 1' \
  --header 'REV-APPNAME: transliteration' \
  --data-raw '{
  "data": ["Hello, how are you?"],
  "isBulk": true,
  "ignoreTaggedEntities": true
  }'
  ```

  ```python Python theme={null}
  from reverie_sdk import ReverieClient

  client = ReverieClient(
     api_key="MY_API_KEY",
     app_id="MY_APP_ID",
  )

  res = client.t13n.transliteration(
     data=[
         "Reverie Language Technologies is located in Bengaluru ",
         "The address is Jio Avana, Bellandur, Bengaluru -560102",
         "The website address is www.reverieinc.com.",
     ],
     src_lang="en",
     cnt_lang="en",
     tgt_lang="hi",
     noOfSuggestions=2,
  )

  print(res)

  ```

  ```javascript JavaScript theme={null}
  const ReverieClient = require("@reverieit/reverie-client");

  const reverieClient = new ReverieClient({
   apiKey: "YOUR-API-KEY",
   appId: "YOUR-APP-ID",
  });

  async function transliterateText() {
   const translation = await reverieClient.transliterate({
     text: "Namaste",
     src_lang: "en",
     tgt_lang: "ta",
   });
   console.log(translation);
  }

  transliterateText();

  ```

  ```go Go theme={null}
  package main

  import (
     "bytes"
     "encoding/json"
     "fmt"
     "io/ioutil"
     "log"
     "net/http"
  )

  const (
     apiURL     = "https://revapi.reverieinc.com/"
     apiKey     = "<YOUR API KEY>"
     appID      = "<YOUR APP ID>"
  )

  type RequestBody struct {
     Data                 []string `json:"data"`
     IsBulk               bool     `json:"isBulk"`
     IgnoreTaggedEntities bool     `json:"ignoreTaggedEntities"`
  }

  type APIResponse struct {
     ResponseList []struct {
     	APIStatus int      `json:"apiStatus"`
     	InString  string   `json:"inString"`
     	OutString []string `json:"outString"`
     } `json:"responseList"`
  }
  func main() {
     text := "Reverie Language Technologies ltd website address is www.reverieinc.com"
     requestBody := map[string]interface{}{
     	"data":                 []string{text},
     	"isBulk":               false,
     	"ignoreTaggedEntities": false,
     }

     jsonData, err := json.Marshal(requestBody)
     if err != nil {
     	log.Fatalf("Error marshaling JSON: %v", err)
     }

     req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonData))
     if err != nil {
     	log.Fatalf("Error creating request: %v", err)
     }

     req.Header.Set("Content-Type", "application/json")
     req.Header.Set("REV-API-KEY", apiKey)
     req.Header.Set("REV-APP-ID", appID)
     req.Header.Set("src_lang", "en")
     req.Header.Set("tgt_lang", "hi")
     req.Header.Set("domain", "1")
     req.Header.Set("cnt_lang", "en")
     req.Header.Set("REV-APPNAME", "transliteration")

     client := &http.Client{}
     resp, err := client.Do(req)
     if err != nil {
     	log.Fatalf("Error making request: %v", err)
     }
     defer resp.Body.Close()

     body, err := ioutil.ReadAll(resp.Body)
     if err != nil {
     	log.Fatalf("Error reading response body: %v", err)
     }

     var apiResponse APIResponse
     err = json.Unmarshal(body, &apiResponse)
     if err != nil {
     	log.Fatalf("Error unmarshaling response: %v", err)
     }

     if len(apiResponse.ResponseList) > 0 && len(apiResponse.ResponseList[0].OutString) > 0 {
     	fmt.Println("Transliterated text:", apiResponse.ResponseList[0].OutString[0])
     } else {
     	fmt.Println("No response from API")
     }
  }
  ```
</RequestExample>

### Headers

<ParamField header="Content-Type" type="string" required default="application/json">
  The format of the data to be posted. Must be set to "application/json".
</ParamField>

<ParamField header="REV-API-KEY" type="string" required>
  {" "}

  A unique key/token provided by Reverie to identify the user using the Localization
  API.{" "}
</ParamField>

<ParamField header="REV-APP-ID" type="string" required>
  {" "}

  The unique account ID to identify the user and the default account settings.

  {" "}
</ParamField>

<ParamField header="REV-APPNAME" type="string" default="transliteration" required>
  Application name i.e., transliteration
</ParamField>

<ParamField header="src_lang" type="string" required>
  Source language code : hi, as, bn, gu, kn, ml, mr, or, pa, ta, te, en, ur, sd, doi, kon, brx, ks, mai, mni, sa, sat
</ParamField>

<ParamField header="tgt_lang" type="string" required>
  Target language code : hi, as, bn, gu, kn, ml, mr, or, pa, ta, te, en, ur, sd, doi, kon, brx, ks, mai, mni, sa, sat
</ParamField>

<ParamField header="domain" type="string" required>
  {" "}

  Domain category : generic, pii\_names, pii\_addresses, OnlyEnglish, bfsi, ecommerce, food, infotainment
</ParamField>

<ParamField header="cnt_lang" type="string">
  Content language code : en
</ParamField>

### Body

<ParamField body="data" type="string[]" required>
  The text you want to translate. This is the input text that will be processed by the translation model.
</ParamField>

<ParamField body="isBulk" type="boolean">
  {" "}

  Indicates whether the request is for bulk processing. Set to `false` for single
  sentence transliteration.{" "}
</ParamField>

<ParamField body="ignoreTaggedEntities" type="boolean">
  {" "}

  Determines whether to ignore tagged entities during transliteration. Set to `false`
  to include all entities.{" "}
</ParamField>

<ResponseExample>
  ```bash 200 theme={null}
  {
  	"responseList": [
      	{
          	"inString": "Reverie Language Technologies ltd website address is www.reverieinc.com ",
          	"outString": [
              	"रेवरी लैंग्वेज टेक्नोलॉजीस लिमिटेड वेबसाइट एड्रेस इज़ www.reverieinc.com"
          	],
          	"status": 2
      	}
     ]
  }
  ```

  ```bash 400 theme={null}
  {
  	"message" : "Message depending on the missing parameter"
  }
  ```

  ```bash 403 theme={null}
  {
    "message" : "Invalid REV-API-KEY or REV-APP-ID"
  }
  ```

  ```bash 403 theme={null}
   {
   	"message" : "usage exhausted"
   }
  ```

  ```bash 403 theme={null}
  {
  	"message" : "API key expired"
  }
  ```

  ```bash 403 theme={null}
  {
  	"message" : "unauthorized to use this src/tgt language"
  }
  ```

  ```bash 403 theme={null}
  {
  	"message" : "unauthorized to use this API"
  }
  ```

  ```bash 500 theme={null}
  {
    "message" : "Internal Server Error"
  }
  ```
</ResponseExample>

### Response

<ResponseField name="responseList" type="Object" required>
  An array of translation responses

  <Expandable title="ResponseList">
    <ResponseField name="inString" type="string">
      The input text in the source language script.

      Example: `Reverie Language Technologies ltd website address is www.reverieinc.com`
    </ResponseField>

    <ResponseField name="outString" type="string[]">
      The result of converting the input text to the output script.

      Example: `["रेवरी लैंग्वेज टेक्नोलॉजीस लिमिटेड वेबसाइट एड्रेस इज़ www.reverieinc.com"]`
    </ResponseField>

    <ResponseField name="status" type="integer">
      Status of API – successful/fail. By default, 2 for successful transactions.

      Example: `2`
    </ResponseField>
  </Expandable>
</ResponseField>
