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: generic' \
--header 'REV-APPNAME: localization' \
--header 'REV-APPVERSION: 3.0' \
--data '{
"data": [
"Reverie Language Technologies was established in 2009.",
"The company head office is located in Bengaluru."
],
"nmtMask": true,
"nmtMaskTerms": {
"Reverie Language Technologies":"Reverie Language Technologies"
},
"enableNmt": true,
"enableLookup": true
}'
from reverie_sdk import ReverieClient
client = ReverieClient(
api_key="MY_API_KEY",
app_id="MY_APP_ID",
)
resp = client.nmt.localization(
data=[
"Reverie Language Technologies was established in 2009.",
"The company head office is located in Bangalore.",
],
domain=1,
src_lang="en",
tgt_lang=["hi"],
nmtMask=True,
nmtMaskTerms=["Reverie Language Technologies"],
nmtParam=True,
dbLookupParam=True,
segmentationParam=False,
)
print(resp)
const ReverieClient = require("@reverieit/reverie-client");
const reverieClient = new ReverieClient({
apiKey: "YOUR-API-KEY",
appId: "YOUR-APP-ID",
});
async function translateText() {
const translation = await reverieClient.translate({
text: "Hey there, how are you doing?",
src_lang: "en",
tgt_lang: "or",
});
console.log(translation);
}
translateText();
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"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"` // Change []string to string
} `json:"responseList"`
TokenConsumed int `json:"tokenConsumed"`
}
func main() {
text := "Reverie Language Technologies ltd is a great place to work."
// Constructing JSON Request Body
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)
}
// Creating HTTP Request
req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonData))
if err != nil {
log.Fatalf("Error creating request: %v", err)
}
// Setting Request Headers
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", "localization")
// Making HTTP Request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatalf("Error making request: %v", err)
}
defer resp.Body.Close()
// Handle non-200 response codes
if resp.StatusCode != http.StatusOK {
log.Fatalf("Unexpected API response status: %d", resp.StatusCode)
}
// Read Response Body
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalf("Error reading response body: %v", err)
}
// Unmarshalling JSON Response
var apiResponse APIResponse
err = json.Unmarshal(body, &apiResponse)
if err != nil {
log.Fatalf("Error unmarshaling response: %v", err)
}
// Check if response contains valid translation
if len(apiResponse.ResponseList) > 0 {
response := apiResponse.ResponseList[0]
if len(response.OutString) > 0 {
fmt.Println("Translated Text:", response.OutString)
} else {
fmt.Println("No translated text received.")
}
// Handling API Status
if response.APIStatus != 3 { // Example: 3 might indicate partial success
fmt.Printf("Warning: API returned status %d\n", response.APIStatus)
}
} else {
fmt.Println("No response from API")
}
}
{
"responseList": [
{
"inString": "Reverie Language Technologies was established in 2009.",
"outString": "Reverie Language Technologies की स्थापना 2009 में की गई थी।",
"apiStatus": 3
},
{
"inString": "The company head office is located in Bengaluru.",
"outString": "कंपनी का मुख्यालय बेंगलुरु में स्थित है।",
"apiStatus": 3
}
],
"tokenConsumed": 102
}
{
"message" : "Message depending on the missing parameter"
}
{
"message" : "Invalid REV-API-KEY or REV-APP-ID"
}
{
"message" : "usage exhausted"
}
{
"message" : "API key expired"
}
{
"message" : "unauthorized to use this src/tgt language"
}
{
"message" : "unauthorized to use this API"
}
{
"message" : "Internal Server Error"
}
Endpoints
Translation API
Translation is a REST API that quickly translates English content into Indic languages, supporting single or multiple sentences.
POST
/
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: generic' \
--header 'REV-APPNAME: localization' \
--header 'REV-APPVERSION: 3.0' \
--data '{
"data": [
"Reverie Language Technologies was established in 2009.",
"The company head office is located in Bengaluru."
],
"nmtMask": true,
"nmtMaskTerms": {
"Reverie Language Technologies":"Reverie Language Technologies"
},
"enableNmt": true,
"enableLookup": true
}'
from reverie_sdk import ReverieClient
client = ReverieClient(
api_key="MY_API_KEY",
app_id="MY_APP_ID",
)
resp = client.nmt.localization(
data=[
"Reverie Language Technologies was established in 2009.",
"The company head office is located in Bangalore.",
],
domain=1,
src_lang="en",
tgt_lang=["hi"],
nmtMask=True,
nmtMaskTerms=["Reverie Language Technologies"],
nmtParam=True,
dbLookupParam=True,
segmentationParam=False,
)
print(resp)
const ReverieClient = require("@reverieit/reverie-client");
const reverieClient = new ReverieClient({
apiKey: "YOUR-API-KEY",
appId: "YOUR-APP-ID",
});
async function translateText() {
const translation = await reverieClient.translate({
text: "Hey there, how are you doing?",
src_lang: "en",
tgt_lang: "or",
});
console.log(translation);
}
translateText();
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"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"` // Change []string to string
} `json:"responseList"`
TokenConsumed int `json:"tokenConsumed"`
}
func main() {
text := "Reverie Language Technologies ltd is a great place to work."
// Constructing JSON Request Body
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)
}
// Creating HTTP Request
req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonData))
if err != nil {
log.Fatalf("Error creating request: %v", err)
}
// Setting Request Headers
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", "localization")
// Making HTTP Request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatalf("Error making request: %v", err)
}
defer resp.Body.Close()
// Handle non-200 response codes
if resp.StatusCode != http.StatusOK {
log.Fatalf("Unexpected API response status: %d", resp.StatusCode)
}
// Read Response Body
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalf("Error reading response body: %v", err)
}
// Unmarshalling JSON Response
var apiResponse APIResponse
err = json.Unmarshal(body, &apiResponse)
if err != nil {
log.Fatalf("Error unmarshaling response: %v", err)
}
// Check if response contains valid translation
if len(apiResponse.ResponseList) > 0 {
response := apiResponse.ResponseList[0]
if len(response.OutString) > 0 {
fmt.Println("Translated Text:", response.OutString)
} else {
fmt.Println("No translated text received.")
}
// Handling API Status
if response.APIStatus != 3 { // Example: 3 might indicate partial success
fmt.Printf("Warning: API returned status %d\n", response.APIStatus)
}
} else {
fmt.Println("No response from API")
}
}
{
"responseList": [
{
"inString": "Reverie Language Technologies was established in 2009.",
"outString": "Reverie Language Technologies की स्थापना 2009 में की गई थी।",
"apiStatus": 3
},
{
"inString": "The company head office is located in Bengaluru.",
"outString": "कंपनी का मुख्यालय बेंगलुरु में स्थित है।",
"apiStatus": 3
}
],
"tokenConsumed": 102
}
{
"message" : "Message depending on the missing parameter"
}
{
"message" : "Invalid REV-API-KEY or REV-APP-ID"
}
{
"message" : "usage exhausted"
}
{
"message" : "API key expired"
}
{
"message" : "unauthorized to use this src/tgt language"
}
{
"message" : "unauthorized to use this API"
}
{
"message" : "Internal Server Error"
}
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: generic' \
--header 'REV-APPNAME: localization' \
--header 'REV-APPVERSION: 3.0' \
--data '{
"data": [
"Reverie Language Technologies was established in 2009.",
"The company head office is located in Bengaluru."
],
"nmtMask": true,
"nmtMaskTerms": {
"Reverie Language Technologies":"Reverie Language Technologies"
},
"enableNmt": true,
"enableLookup": true
}'
from reverie_sdk import ReverieClient
client = ReverieClient(
api_key="MY_API_KEY",
app_id="MY_APP_ID",
)
resp = client.nmt.localization(
data=[
"Reverie Language Technologies was established in 2009.",
"The company head office is located in Bangalore.",
],
domain=1,
src_lang="en",
tgt_lang=["hi"],
nmtMask=True,
nmtMaskTerms=["Reverie Language Technologies"],
nmtParam=True,
dbLookupParam=True,
segmentationParam=False,
)
print(resp)
const ReverieClient = require("@reverieit/reverie-client");
const reverieClient = new ReverieClient({
apiKey: "YOUR-API-KEY",
appId: "YOUR-APP-ID",
});
async function translateText() {
const translation = await reverieClient.translate({
text: "Hey there, how are you doing?",
src_lang: "en",
tgt_lang: "or",
});
console.log(translation);
}
translateText();
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"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"` // Change []string to string
} `json:"responseList"`
TokenConsumed int `json:"tokenConsumed"`
}
func main() {
text := "Reverie Language Technologies ltd is a great place to work."
// Constructing JSON Request Body
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)
}
// Creating HTTP Request
req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonData))
if err != nil {
log.Fatalf("Error creating request: %v", err)
}
// Setting Request Headers
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", "localization")
// Making HTTP Request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatalf("Error making request: %v", err)
}
defer resp.Body.Close()
// Handle non-200 response codes
if resp.StatusCode != http.StatusOK {
log.Fatalf("Unexpected API response status: %d", resp.StatusCode)
}
// Read Response Body
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalf("Error reading response body: %v", err)
}
// Unmarshalling JSON Response
var apiResponse APIResponse
err = json.Unmarshal(body, &apiResponse)
if err != nil {
log.Fatalf("Error unmarshaling response: %v", err)
}
// Check if response contains valid translation
if len(apiResponse.ResponseList) > 0 {
response := apiResponse.ResponseList[0]
if len(response.OutString) > 0 {
fmt.Println("Translated Text:", response.OutString)
} else {
fmt.Println("No translated text received.")
}
// Handling API Status
if response.APIStatus != 3 { // Example: 3 might indicate partial success
fmt.Printf("Warning: API returned status %d\n", response.APIStatus)
}
} else {
fmt.Println("No response from API")
}
}
Headers
string
required
The format of the data to be posted: “application/json”
string
required
A unique key/token provided by Reverie to identify the user using the Translation API.
string
required
The unique account ID to identify the user and the default account settings.
string
required
The parameter to identify the API : “localization”
string
required
The version refers to the specific iteration of the API that is being called. : “2.0/3.0”
Note: The default version is “2.0”.
string
required
The language of the input text
Codes: hi, en, as, bn, gu, kn, kok, ml, mr, mai, or, pa, ta, te, ne, ur
string
required
Language to which you want to localize the input text
Codes: hi, en, as, bn, gu, kn, kok, ml, mr, mai, or, pa, ta, te, ne, ur
string
required
Domain for APPVERSION 2.0: 0, 1, 2, 3, 4, 5, 6, 7, 8
Domain for APPVERSION 3.0: generic, government, travel, ecommerce, infotainment, bfsi, food, education, medical
Body
string[]
required
List of input text for Translation.
boolean
Specify whether the content Translation process should use NMT technology or not.
- For Example, When the enableNmt value is true, the system will initially refer to the Lookup database to localize content. If the content is not available in the database, then the NMT is used for translation.
- Note - By default, the
enableNmt=true
boolean
Specify whether the content Translation process should use transliteration technology or not.
- For Example, When the enableTransliteration value is true, the system will initially refer to the Lookup database to localize content. If the content is not available in the database, then nmt is used for translation. If nmt fails, transliteration is called.
- Note - By default, the
enableTransliteration=true
boolean
The parameter will specify whether the application should refer to the Lookup DB or not.
- For Example, when the enableLookup is true, the system will initially refer to the Database to fetch contents.
- Note - By default, the
enableLookup=true
boolean
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 thesrc_lang=en(English).
array[]
Determines the words that are to be masked.
- Note - On defining values in the
nmtMaskTerms, then automatically thenmtMaskis set to true. - Example - Masking a term:
nmtMaskTerms: ["Reverie Language Technologies"]
Here, the API will mask the termReverie Language Technologies, if found in the source content, and will transliterate the word.
boolean
Specify whether you want to filter out profane content from the input.
- Note - By default, the
filterProfane=true
{
"responseList": [
{
"inString": "Reverie Language Technologies was established in 2009.",
"outString": "Reverie Language Technologies की स्थापना 2009 में की गई थी।",
"apiStatus": 3
},
{
"inString": "The company head office is located in Bengaluru.",
"outString": "कंपनी का मुख्यालय बेंगलुरु में स्थित है।",
"apiStatus": 3
}
],
"tokenConsumed": 102
}
{
"message" : "Message depending on the missing parameter"
}
{
"message" : "Invalid REV-API-KEY or REV-APP-ID"
}
{
"message" : "usage exhausted"
}
{
"message" : "API key expired"
}
{
"message" : "unauthorized to use this src/tgt language"
}
{
"message" : "unauthorized to use this API"
}
{
"message" : "Internal Server Error"
}
Response
Object
required
An array of translation responses
Show ResponseList
Show ResponseList
string
The input text in the source language.Example:
Reverie Language Technologies was established in 2009.string
The localized content in the requested target language.Example:
Reverie Language Technologies की स्थापना 2009 में की गई थी।integer
Status of API Moderated / Partial / Unmoderated (Aggregate of all segments). Refer to API Messages for available apiStatus and its description.Example:
3integer
required
The payload length served by NMT. Note: If LookUp DB serves the payload and the content is moderated, then tokenConsumed = 0.Example:
102