How to use Free dictionary API

Cover photo by Christopher Gower on Unsplash

Are you developing a language learning app, a writing assistant, or any project involving words and need an API to retrieve word meanings? Free Dictionary API offers a free and accessible way to incorporat…


This content originally appeared on DEV Community and was authored by Iryna Trush

Cover photo by Christopher Gower on Unsplash

Are you developing a language learning app, a writing assistant, or any project involving words and need an API to retrieve word meanings? Free Dictionary API offers a free and accessible way to incorporate language data into your work. This documentation will show you how to get started.

In this API documentation:

  • About Free dictionary API
  • Endpoint
  • Examples
  • Additional Resources

About Free dictionary API:

Free Dictionary API developed by meetDeveloper and has 2.6k stars on GitHub. API supports only GET requests and provides word definitions along with phonetic transcriptions.

Key Features:

  • Free to use
  • No usage limits
  • No authorization or API keys required

Endpoint

https://api.dictionaryapi.dev/api/v2/entries/en/<word>
  • This endpoint retrieves dictionary information for the specified English word.

  • The API has two versions: v1 and v2. The primary difference lies in the response structure. Current version is v2.

Query Parameters

  • word (string, required): The word you want to look up.

Response Format

The API returns a JSON array containing a single object with detailed information about the word, including:

If the request is successful:

  • word(string): The queried word
  • phonetic(string): The phonetic transcription of the word
  • phonetics(array): An array of phonetic objects, each with:
  • text(string): The phonetic transcription
  • audio(string): A URL to an audio pronunciation (may be empty)
  • meanings(array): An array of objects representing meanings
  • partOfSpeech (string): The part of speech (e.g., noun, verb)
  • definitions (array): An array of definition objects, each with:
  • definition (string): The definition of the word
  • synonyms(array): An array of synonyms
  • antonyms (array): An array of antonyms
  • license(object): Information about the license under which the data is provided
  • sourceUrls (array): An array of URLs to the sources of the data

If the request is not successful:

  • title (string): A message indicating that no definitions were found for the word
  • message (string): Message that the definitions for the word was not found
  • resolution(string): Suggestion to use search again or web.

Examples:

Example Request 1 (successful):

const word = "documentation";
fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${word}`)
  .then(response => response.json())
  .then(data => console.log(data));

Example Response 1:

[
  {
    "word": "documentation",
    "phonetic": "/ˌdɒkjʊmənˈteɪʃən/",
    "phonetics": [
      {
        "text": "/ˌdɒkjʊmənˈteɪʃən/",
        "audio": ""
      },
      {
        "text": "/ˌdɑkjəmənˈteɪʃən/",
        "audio": ""
      }
    ],
    "meanings": [
      {
        "partOfSpeech": "noun",
        "definitions": [
          {
            "definition": "Something transposed from a thought to a document; the written account of an idea.",
            "synonyms": [],
            "antonyms": []
          },
          {
            "definition": "Documentary evidence and sources.",
            "synonyms": [],
            "antonyms": []
          },
          {
            "definition": "Documents that explain the operation of a particular machine or software program.",
            "synonyms": [],
            "antonyms": []
          },
          {
            "definition": "Comments that explain the usage of individual functions, libraries and blocks of code.",
            "synonyms": [],
            "antonyms": []
          }
        ],
        "synonyms": [],
        "antonyms": []
      }
    ],
    "license": {
      "name": "CC BY-SA 3.0",
      "url": "https://creativecommons.org/licenses/by-sa/3.0"
    },
    "sourceUrls": [
      "https://en.wiktionary.org/wiki/documentation"
    ]
  }
]

Example Request 2 :

const word = "Software engineer";
fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${word}`)
  .then(response => response.json())
  .then(data => console.log(data));

Example Response 2 (not successful):

{
  "title": "No Definitions Found",
  "message": "Sorry pal, we couldn't find definitions for the word you were looking for.",
  "resolution": "You can try the search again at later time or head to the web instead."
}

Success and Error Codes

This API does not currently return specific success or error codes.

Additional Resources

To try the API or support the Free Dictionary API, go to Free Dictionary API website.

See also Free Dictionary API project on Github.


This content originally appeared on DEV Community and was authored by Iryna Trush


Print Share Comment Cite Upload Translate Updates
APA

Iryna Trush | Sciencx (2024-09-24T21:41:59+00:00) How to use Free dictionary API. Retrieved from https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/

MLA
" » How to use Free dictionary API." Iryna Trush | Sciencx - Tuesday September 24, 2024, https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/
HARVARD
Iryna Trush | Sciencx Tuesday September 24, 2024 » How to use Free dictionary API., viewed ,<https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/>
VANCOUVER
Iryna Trush | Sciencx - » How to use Free dictionary API. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/
CHICAGO
" » How to use Free dictionary API." Iryna Trush | Sciencx - Accessed . https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/
IEEE
" » How to use Free dictionary API." Iryna Trush | Sciencx [Online]. Available: https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/. [Accessed: ]
rf:citation
» How to use Free dictionary API | Iryna Trush | Sciencx | https://www.scien.cx/2024/09/24/how-to-use-free-dictionary-api/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.