> ## 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 is a REST API used to transliterate the content from English to Indic languages and vice-versa.  The solution is an automated solution that converts the content in real-time. It is easy to integrate into your applications and display content in the 11 most popular Indian languages

# How Does API Work?

The Transliteration API will use the REV-APP-ID and REV-API-KEY to authenticate requests. Your credentials carry many privileges, so be sure to keep them secure.

* **Pass valid login credentials**:
  * `REV-APP-ID`
  * `REV-API-KEY`

* Select Source language & Target language

* Post Source Content

* Validate user credentials & load default account settings

* Return content in Target language

## cURL for Integration

### Translate content to one target language

#### Request

```bash 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 'cnt_lang: en' \
--header 'REV-APPNAME: transliteration' \
--data-raw '{"data": ["Reverie Language Technologies ltd website address is www.reverieinc.com"],
"isBulk" :false,
"ignoreTaggedEntities" : false
}'
```

#### Response

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

### Transliterating Multiple sentences

#### Request

```bash 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 'REV-APPNAME: transliteration' \
--header 'domain: 1' \
--header 'cnt_lang: en' \
--data-raw '{"data": [
	"Reverie Language Technologies is located in Bengaluru ",
	"The address is Jio Avana, Bellandur, Bengaluru -560102",
	"The website address is www.reverieinc.com."
  ],
  "isBulk": false,
  "ignoreTaggedEntities": false
}'
```

#### Response

```json theme={null}
{
	"responseList": [
    	{
        	"inString": "Reverie Language Technologies is located in Bengaluru ",
        	"outString": [
            	"रेवरी लैंग्वेज टेक्नोलॉजीस इज़ लोकेटेड इन बेंगलुरु "
        	],
        	"status": 2
    	},
    	{
        	"inString": "The address is Jio Avana, Bellandur, Bengaluru -560102",
        	"outString": [
            	"द एड्रेस इज़ जियो अवाना, बेल्लन्दूर, बेंगलूरु -560102"
        	],
        	"status": 2
    	},
    	{
        	"inString": "The website address is www.reverieinc.com",
        	"outString": [
            	"द वेबसाइट ऍड्रेस इज़ www.reverieinc.com"
        	],
        	"status": 2
    	}
	]
}
```

## API References

### HTTP Request URL

| URL Elements | Sample URL |
| - | - |
| https\://(hostname) | [https://revapi.reverieinc.com/](https://revapi.reverieinc.com/) |

### Headers

**Content-Type** `string` *required*

&#x20;

The format of the data to be posted: `application/json`

**REV-API-KEY** `string` *required*

&#x20;

A unique key/token provided by Reverie to identify the user using the Localization API.

**REV-APP-ID** `string` *required*

&#x20;

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

**REV-APPNAME** `string` *required*

&#x20;

The parameter to identify the API : `transliteration`

**REV-APPVERSION** `string` *required*

&#x20;

* The version refers to the specific iteration of the API that is being called.
* Note: The default version is **2.0**.

**src\_lang** `string` *required*

&#x20;

* The script used in the input text.
* Example : `or`, `hi`, `bn`
* Refer to section [Language Codes](https://docs.reverieinc.com/usage-guides/transliteration/supported-languages.md) for valid language code.

**tgt\_lang** `string` *required*

&#x20;

* The script to which you want to convert the input text.
* Example : `or`, `hi`, `bn`
* Refer to section [Language Codes](https://docs.reverieinc.com/usage-guides/transliteration/supported-languages.md) for valid language code.

**domain** `string` *required*

&#x20;

* The Domain refers to the universe in which you use the Transliteration . Example- Health Care, Insurance, Legal, etc.
* Refer to section [Domain Codes](https://docs.reverieinc.com/usage-guides/transliteration/supported-domains.md) for valid language code.

**cnt\_lang** `string`

* The language of the words in the input text.
* Refer to section [Supported Language](https://docs.reverieinc.com/usage-guides/transliteration/supported-languages.md) for valid language code.
* **Example**:\
  `data: "Singh Sahab aap Kahan the."`\
  In the example above, the Hindi language words are written in the English language script (Roman Script). So `cnt_lang = "hi"`.
* **Note**: This is an optional parameter. If no value is provided, by default the value is the same as `src_lang`.

### Request

**data** `array[]` *required*

&#x20;

* List of input text for transliteration.

**isBulk** `boolean`

&#x20;

* Specify whether the API should initially search in the Exception DB to transliterate the input text.
* **Note** - By default, the `isBulk`= `true` and will not search in the Exception DB.

**noOfSuggestions** `integer`

* Mention the number of transliteration suggestions the API should return for the input text.
* **Note** - By default, the `noOfSuggestions` = 1, means the API will return only one transliteration suggestion for the input string.
* **Example**: Consider `noOfSuggestions = 2`
  | **Source Content** | **Target Content** |
  | - | - |
  | Rama | 1. रामा |
  | | 2. रमा |

**abbreviate** `boolean`

&#x20;

* The abbreviate will Validate whether any Abbreviations/ Acronyms are passed in the input text and will transliterate it accurately.
* **Note** -  By default, the `abbreviate` = `true`
* **Note** -  If the value is false, the API will consider the abbreviation as a word and transliterate it to the nearest available word.
* **Note** -  In the input text, pass the abbreviations in upper case.

**convertNumber** `string`

* The feature to screen the non-dictionary words used in a sentence. In other words, the mask will indicate the words that should not be translated into the target language.
* **Note** - By default, the `enableLookup` = `true`.
* **Note** - To set the `nmtMask` = `true`, it is mandatory the `src_lang` = `en` (English).
* **Description**: Specify whether to convert the numbers in the input text to the target language script based on the value type.
* **Three types of values for this parameter:**
  * **local**: This value can convert the input number to the target language script.\
    **Example**:
    | **Source String** | **Target String** |
    | - | - |
    | 2020.04 | २०२०.०४ |
  * **words**: This value can convert numbers into words with respect to the target language.\
    **Example**:
    | **Source String** | **Target String** |
    | - | - |
    | 505 | पांच सौ पांच |
  * **roman**: This value can convert Roman numbers to English numbers.\
    **Example**:
    * If the user types `sector V` in English, the transliteration would be `सेक्टर 5` in Hindi.
    * `Block II` will be transliterated as `ब्लॉक 2`.

**ignoreTaggedEntities** `boolean`

* Specify whether you want to retain the entities like email ID and URL in the input script.
* **Note**: By default, the `ignoreTaggedEntities` = `true` and will transliterate the email ID and URL into the target language script.
* **Example**: Consider `ignoreTaggedEntities = false`
  | **Source String** | **Target String** |
  | - | - |
  | Check product details in [www.reverieinc.com](http://www.reverieinc.com) | चेक प्रोडक्ट डिटेल्स इन [www.reverieinc.com](http://www.reverieinc.com) |

**convertOrdinal** `boolean`

* This is used for transliterating ordinal values to English numbers.
* **Note** - Default value = `False`.
* **Example**: If the user types `15th Main` in English, the transliteration would be `15 मेन` in Hindi.

**abbreviationWithoutDot** `boolean`

* This is used to produce the abbreviation output without a dot.
* **Note** - Default value = `False`.
* **Example**: If a user wants an abbreviation output without a dot and is given `SMS` as an input, then the result would be `एसएमएस`.

### Response

**responseList** `array[]`

* The API will return the string(s) in the target language script.

**inString** `string`

* The input text in the source language script.

**outString** `string`

* A string which is the result of converting the input text to the output script

**api\_status** `integer`

* Status of API – successful/fail.
* By default, the `api_status` = 2 for all the successful transactions.

### Handling Errors

The Transliteration API raises exceptions for many reasons, such as failed conversions, invalid parameters, authentication errors, and network unavailability. It will provide more specific machine-readable messages with an error response so that users can react to errors more effectively.

Refer to: [API Messages](https://docs.reverieinc.com/api-reference/transliteration.md#api-messages) section to know the error code and corresponding messages.

```json theme={null}
{
    "documentation": "https://revup.reverieinc.com/dashboard/documentation",
    "message": "Oops! Something wrong happened",
    "error_cause": "Required String parameter 'target_lang' is not present",
    "status": "BAD_REQUEST"
}
```

### API Messages

| Status Code | Status Type | Message | Description |
| - | - | - | - |
| 200 | Success/OK | - | Successfully executed the request. |
| 400 | Bad Request | Message depending on the missing parameter | Incorrect request format or data posted incorrectly. |
| 403 | Forbidden | Invalid REV-API-KEY or REV-APP-ID | Entered invalid credentials. |
| 403 | Forbidden | usage exhausted | The provided credits or character limit is exhausted. |
| 403 | Forbidden | API key expired | The API key provided to a user is expired. |
| 403 | Forbidden | unauthorized to use this src/tgt language | Invalid language code passed or user cannot use the defined language code. |
| 403 | Forbidden | unauthorized to use this API | The REV-APPNAME entered is invalid, or the user is not authorized to use it. |
| 500 | Internal Server Error | Internal Server Error | An error occurred with the API. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.