Google Translate Free API Documentation

# Translation

Returns a translated text string of the vocabulary word or text fragment.

Request

Method: GET, URL: api/v1/dictionary/translate

Parameter Type Position Require Description
string string Body True Vocabulary or text you want to translate (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List
to_lang string Body False Target text language (default is vi). Supported Language List

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/translate?string=summer

=> "mùa hè"

# Alternate Translations

Returns an array containing the alternative translations..

Request

Method: GET, URL: api/v1/dictionary/alternate_translations

Parameter Type Position Required Description
string string Body True Vocabulary or text you want to get alternate translations (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List
to_lang string Body False Target text language (default is vi). Supported Language List

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/alternate_translations?string=summer

[
  "mùa hè",
  "mùa hạ",
  "hè"
]

# Definitions

Returns an array containing JSON definitions of the keyword by word type (noun, verb, adjective...).

Request

Method: GET, URL: api/v1/dictionary/definitions

Parameter Type Position Require Description
keyword string Body True Vocabulary or text you want to get definitions (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/definitions?keyword=summer

[
  {
    "noun": [
      [
        "The warmest season of the year, in the northern hemisphere from june to august and in the southern hemisphere from december to february.",
        "summer vacation.",
        null
      ],
      [
        "A horizontal bearing beam, especially one supporting joists or rafters.",
        null,
        null
      ]
    ]
  },
  {
    "verb": [
      [
        "Spend the summer in a particular place.",
        null,
        null
      ]
    ]
  }
]

# Examples

Returns an array containing single-sentence strings containing the keyword.

Request

Method: GET, URL: api/v1/dictionary/examples

Parameter Type Position Require Description
keyword string Body True Vocabulary or text you want to get examples (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/examples?keyword=summer

[
  "summer vacation.",
  "The plant flowers in late summer.",
  "The golden summer of her life.",
  "A long hot summer."
]

# Transliteration

Returns the transliteration of the keyword as a string.

Request

Method: GET, URL: api/v1/dictionary/transliteration

Parameter Type Position Require Description
keyword string Body True Vocabulary you want to get transliteration (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/transliteration?keyword=summer

=> "ˈsəmər"

# Suggestion

Returns a vocabulary or text string that suggests correct spelling.

Request

Method: GET, URL: api/v1/dictionary/suggest

Parameter Type Position Require Description
string string Body True Vocabulary or text you want to get suggest (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/suggest?string=how%20aboutt%20you?

=> "how about you?"

# Detection

Returns an array with the first value being the language ISO-639 code, the second value being the precision.

Request

Method: GET, URL: api/v1/dictionary/detection

Parameter Type Position Require Description
string string Body True Vocabulary or text you want to detection (maximum 5000 characters).

Response

Example: GET https://api.datpmt.com/api/v1/dictionary/detection?string=summer

=> ["en",0.93254006]

# See more

Returns suggested keywords to see more.

Request

Method: GET, URL: api/v1/dictionary/see_more

Parameter Type Position Require Description
keyword string Body True Vocabulary you want to see more (maximum 5000 characters).
from_lang string Body False Source text language (default is auto). Supported Language List

Response

# [kids -> kid, tables -> table]

Example: GET https://api.datpmt.com/api/v1/dictionary/see_more?keyword=kids

=> "kid"

# API Changes Log

- Version V1 (2023 Apr 22)

Removed:

  • Deprecated endpoint GET api/v1/dictionary in favor of GET api/v1/dictionary/google_translate

- Version V1 (2023 Apr 23)

Fixed:

  • Resolved an issue causing intermittent 500 errors in the GET api/v1/dictionary/alternate_translations endpoint.

- Version V1 (2023 Jul 28)

Added:

  • Suggestion endpoint: GET api/v1/dictionary/suggest
  • Detection endpoint: GET api/v1/dictionary/detection

- Version V1 (2024 Jan 4)

Fixed:

  • Resolved an issue causing intermittent 500 errors when too many requests were made to the endpoint.

- Version V1 (2024 Jan 18)

Security:

  • Patched a vulnerability related to not validating endpoint parameters(from_lang and to_lang).

- Version V1 (2024 Mar 12)

Changed:

  • Change the default from_lang from en to auto

- Version V1 (2024 Mar 22)

Fixed:

  • Resolved an issue that caused intermittent 500 errors involving language code parameters(from_lang and to_lang).