Skip to main content

How Does API Work?

The Translation API will use the App Id and API key to authenticate requests. Your credentials carry many privileges, so be sure to keep them secure.
  • Post the request by:
    • Enter the valid REV-APPNAME, REV-APP-ID, and REV-API-KEY.
    • Specify the Source language & Target language(s) code.
    • Enter the content you want to localize and mention the domain.
  • On posting the request:
    • The API will validate user credentials.
    • Validate the key-value pairs in the API request.
    • If all the information is valid, then initially, the API will refer to the Database (Lookup DB & Template DB) to localize the content.
    • If the content is not available in the Database, then the NMT (Neural Machine Translation) technology is adapted.
  • On successfully translating the content:
    • The API returns the content in the requested target language(s).

cURL for Integration

Translate content to one target language

Request

Response

Translate content to multiple target languages

Request

Response

Error Response

API References

HTTP Request URL

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.
  • Note: The default version is 2.0.
string
required
  • The language of the input text
  • Example : or, hi, bn
  • Refer to section Language Codes for valid language code.
string
required
  • Language to which you want to localize the input text
  • Note: To enter multiple target languages, separate the value using the comma separator(,). For example: tgt_lang : hi, ta
  • Example : or, hi, bn
  • Refer to section Language Codes for valid language code.
string
required
  • The Domain refers to the universe in which you use the Translation API. Example- Health Care, Insurance, Legal, etc.
  • Refer to section Domain Codes for valid language code.

Request

array[]
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 the src_lang = en (English).
array[]
  • Determines the words that are to be masked.
  • Note - On defining values in the nmtMaskTerms, then automatically the nmtMask is set to true.
  • Example - Masking a term:
    nmtMaskTerms: ["Reverie Language Technologies"]
    Here, the API will mask the term Reverie 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

Response

array[]
  • The API will return the string(s) in the target language(s).
string
  • The input text in the source language.
string
  • The localized content in the requested target language(s).
integer
  • Status of API Moderated / Partial /Unmoderated (Aggregate of all segments). Refer to API Messages to know about the available apiStatus and its description.
Map<String, Integer>
  • A dictionary/object with language codes as keys and integer status codes as values. Represents the status of the API output for each language, indicating the moderation level of the response content. Each key is a language code (e.g.,”hi” for Hindi,”ta” for Tamil), and each value is an integer status code representing the moderation level.
  • Note: This api_statuses field will be displayed only if multiple languages are requested in the same API payload.
  • Refer to section Language Codes for valid language code.
  • Refer to API Messages to know about the available apiStatus and its description.
string
  • Error status code for the invalid request.
  • Note: The status is shown only for the invalid request.
string
  • A Human-readable error message.
  • Refer to API Messages to know about the available apiStatus and its description.
integer
  • The payload length served by NMT.
  • Note - if LookUp DB serves the payload and if the content is moderated, then the tokenConsumed = 0` (Zero).
string
  • It is a 128-bit Universally Unique Identifier. It is likely being used for tracking a request in the Translation API.

Handling Errors

The Translation 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 section to know the error code and corresponding messages.

API Messages