Google Translate Free API Documentation

# Translation

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

Request

Method: GET, URL: api/v2/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/v2/dictionary/translate?string=summer

=> "mùa hè"

# Alternate Translations

Returns an array containing the alternative translations..

Request

Method: GET, URL: api/v2/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/v2/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/v2/dictionary/definitions

Parameter Type Position Require Description
keyword string (single word) Body True Vocabulary or text you want to get definitions (maximum 5000 characters).

Response

Example: GET https://api.datpmt.com/api/v2/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/v2/dictionary/examples

Parameter Type Position Require Description
keyword string (single word) Body True Vocabulary or text you want to get examples (maximum 5000 characters).

Response

Example: GET https://api.datpmt.com/api/v2/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/v2/dictionary/transliteration

Parameter Type Position Require Description
keyword string (single word) Body True Vocabulary you want to get transliteration (maximum 5000 characters).

Response

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

=> "ˈsəmər"

# Suggestion

Returns a vocabulary or text string that suggests correct spelling.

Request

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

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

Response

Example: GET https://api.datpmt.com/api/v2/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/v2/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/v2/dictionary/detection?string=summer

=> ["en",0.93254006]

# See more

Returns suggested keywords to see more.

Request

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

Parameter Type Position Require Description
keyword string Body True Vocabulary you want to see more (maximum 5000 characters).

Response

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

Example: GET https://api.datpmt.com/api/v2/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).

- Version v1 (2024 Aug 27)

Updated:

  • Removed redundant parameters from the api/v1/dictionary/definitions endpoint to streamline requests and improve efficiency (from_lang and to_lang).
  • Removed redundant parameters from the api/v1/dictionary/examples endpoint to streamline requests and improve efficiency (from_lang).
  • Removed redundant parameters from the api/v1/dictionary/transliteration endpoint to streamline requests and improve efficiency (from_lang).
  • Removed redundant parameters from the api/v1/dictionary/see_more endpoint to streamline requests and improve efficiency (from_lang).
  • Removed redundant parameters from the api/v1/dictionary/suggest endpoint to streamline requests and improve efficiency (from_lang).
  • Revised the error message displayed when the number of parameters exceeds the 5,000 limit.

- Version v2 Release (2024 Aug 28)

Introduction:

  • The v2 API introduces a range of new features and improvements designed to enhance performance and usability.
  • This release addresses feedback from v1 users and incorporates advanced functionalities to better support your needs.

If you have any questions or need assistance, please reach out to me on GitHub.