npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

oxford-dictionary-api-client

v1.1.0

Published

A Node.js and browser wrapper for Oxford Dictionary API

Readme

Oxford Dictionary API

A TypeScript library for interacting with the Oxford Dictionary API. This library provides a comprehensive interface to access dictionary entries, translations, lemmas, inflections, thesaurus data, and more.

Features

  • 🔍 Dictionary Entries - Get detailed word definitions, pronunciations, and examples
  • 🌐 Translations - Access translations between different languages
  • 📚 Thesaurus - Find synonyms and antonyms
  • 🔤 Lemmas & Inflections - Get word forms and grammatical variations
  • 📝 Sentences - Retrieve example sentences
  • 🔎 Search - Search for words with various filters
  • 🛠️ Utility Functions - Access metadata, filters, fields, and more

Installation

npm install oxford-dictionary-api-client

Quick Start

import { OxfordDictionary } from "oxford-dictionary-api-client";

// Initialize the client
const dictionary = new OxfordDictionary(
  "your-app-id",
  "your-app-key",
  "https://od-api.oxforddictionaries.com/api/v2"
);

// Get word entries
const entries = await dictionary.entries("en", "hello");
console.log(entries);

API Reference

Constructor

new OxfordDictionary(appId: string, appKey: string, baseUrl: string)
  • appId - Your Oxford Dictionary API application ID
  • appKey - Your Oxford Dictionary API application key
  • baseUrl - The base URL for the API (default: https://od-api.oxforddictionaries.com/api/v2)

Core Methods

entries(sourceLang, wordId, options?)

Get detailed dictionary entries for a word.

Options:

  • domains (string) - Filter by domain (e.g., 'academic', 'business', 'medical')
  • fields (string[]) - Array of fields to include in response (e.g., ['definitions', 'examples', 'pronunciations'])
  • grammaticalFeatures (string) - Filter by grammatical features
  • lexicalCategory (string) - Filter by lexical category (e.g., 'noun', 'verb', 'adjective')
  • registers (string) - Filter by register (e.g., 'formal', 'informal', 'technical')
  • strictMatch (boolean) - Use strict matching (default: false)
const entries = await dictionary.entries("en", "hello", {
  fields: ["definitions", "examples"],
  lexicalCategory: "noun",
  strictMatch: true,
});

translations(sourceLang, targetLang, wordId, options?)

Get translations for a word between languages.

Options:

  • domains (string) - Filter by domain (e.g., 'academic', 'business', 'medical')
  • fields (string[]) - Array of fields to include in response (e.g., ['translations', 'definitions'])
  • grammaticalFeatures (string) - Filter by grammatical features
  • lexicalCategory (string) - Filter by lexical category (e.g., 'noun', 'verb', 'adjective')
  • registers (string) - Filter by register (e.g., 'formal', 'informal', 'technical')
  • strictMatch (boolean) - Use strict matching (default: false)
const translations = await dictionary.translations("en", "es", "hello", {
  fields: ["translations"],
  strictMatch: true,
});

words(sourceLang, query, options?)

Search for words with various filters.

Options:

  • domains (string) - Filter by domain (e.g., 'academic', 'business', 'medical')
  • fields (string[]) - Array of fields to include in response (e.g., ['definitions', 'examples'])
  • grammaticalFeatures (string) - Filter by grammatical features
  • lexicalCategory (string) - Filter by lexical category (e.g., 'noun', 'verb', 'adjective')
  • registers (string) - Filter by register (e.g., 'formal', 'informal', 'technical')
  • strictMatch (boolean) - Use strict matching (default: false)
const words = await dictionary.words("en", "hello", {
  domains: "academic",
  lexicalCategory: "noun",
});

lemmas(sourceLang, wordId, options?)

Get lemmas (base forms) of a word.

Options:

  • grammaticalFeatures (string) - Filter by grammatical features
  • lexicalCategory (string) - Filter by lexical category (e.g., 'noun', 'verb', 'adjective')
const lemmas = await dictionary.lemmas("en", "running", {
  lexicalCategory: "verb",
});

inflections(sourceLang, wordId, options?)

Get inflected forms of a word.

Options:

  • strictMatch (boolean) - Use strict matching (default: false)
const inflections = await dictionary.inflections("en", "run", {
  strictMatch: true,
});

thesaurus(sourceLang, wordId, options?)

Get thesaurus data (synonyms, antonyms).

Options:

  • fields (string[]) - Array of fields to include in response (e.g., ['synonyms', 'antonyms'])
  • strictMatch (boolean) - Use strict matching (default: false)
const thesaurus = await dictionary.thesaurus("en", "happy", {
  fields: ["synonyms", "antonyms"],
});

sentences(sourceLang, wordId, options?)

Get example sentences for a word.

Options:

  • strictMatch (boolean) - Use strict matching (default: false)
const sentences = await dictionary.sentences("en", "hello", {
  strictMatch: true,
});

Search Methods

search.entries(sourceLang, query, options?)

Search for dictionary entries.

Options:

  • limit (number) - Maximum number of results to return (default: 50)
  • offset (number) - Number of results to skip for pagination (default: 0)
  • prefix (boolean) - Use prefix matching (default: false)
const searchResults = await dictionary.search.entries("en", "hello", {
  limit: 10,
  offset: 0,
  prefix: true,
});

search.thesaurus(sourceLang, query, options?)

Search for thesaurus entries.

Options:

  • limit (number) - Maximum number of results to return (default: 50)
  • offset (number) - Number of results to skip for pagination (default: 0)
  • prefix (boolean) - Use prefix matching (default: false)
const thesaurusSearch = await dictionary.search.thesaurus("en", "happy", {
  limit: 5,
});

search.translations(sourceLang, targetLang, query, options?)

Search for translations.

Options:

  • limit (number) - Maximum number of results to return (default: 50)
  • offset (number) - Number of results to skip for pagination (default: 0)
  • prefix (boolean) - Use prefix matching (default: false)
const translationSearch = await dictionary.search.translations(
  "en",
  "es",
  "hello",
  {
    limit: 10,
  }
);

Utility Methods

utility.dictionaryNames(options?)

Get available dictionary names.

Options:

  • sourceLang (string) - Source language code (e.g., 'en', 'es', 'fr')
  • targetLang (string) - Target language code (e.g., 'en', 'es', 'fr')
const dictionaries = await dictionary.utility.dictionaryNames({
  sourceLang: "en",
  targetLang: "es",
});

utility.filters(endpoint?)

Get available filters.

Parameters:

  • endpoint (string, optional) - Specific endpoint to get filters for (e.g., 'entries', 'thesaurus')
const filters = await dictionary.utility.filters("entries");

utility.fields(endpoint?)

Get available fields.

Parameters:

  • endpoint (string, optional) - Specific endpoint to get fields for (e.g., 'entries', 'thesaurus')
const fields = await dictionary.utility.fields("entries");

utility.lexicalCategories(sourceLang, targetLang?)

Get lexical categories.

Parameters:

  • sourceLang (string) - Source language code (e.g., 'en', 'es', 'fr')
  • targetLang (string, optional) - Target language code (e.g., 'en', 'es', 'fr')
const categories = await dictionary.utility.lexicalCategories("en", "es");

utility.registers(sourceLang, targetLang?)

Get available registers.

Parameters:

  • sourceLang (string) - Source language code (e.g., 'en', 'es', 'fr')
  • targetLang (string, optional) - Target language code (e.g., 'en', 'es', 'fr')
const registers = await dictionary.utility.registers("en", "es");

utility.domains(sourceLang, targetLang?)

Get available domains.

Parameters:

  • sourceLang (string) - Source language code (e.g., 'en', 'es', 'fr')
  • targetLang (string, optional) - Target language code (e.g., 'en', 'es', 'fr')
const domains = await dictionary.utility.domains("en", "es");

utility.grammaticalFeatures(sourceLang, targetLang?)

Get grammatical features.

Parameters:

  • sourceLang (string) - Source language code (e.g., 'en', 'es', 'fr')
  • targetLang (string, optional) - Target language code (e.g., 'en', 'es', 'fr')
const features = await dictionary.utility.grammaticalFeatures("en", "es");

Response Types

The library provides comprehensive TypeScript types for all API responses:

  • Entries - Dictionary entries
  • Lemmas - Word lemmas
  • Inflections - Word inflections
  • Thesaurus - Thesaurus data
  • Sentences - Example sentences
  • Search - Search results

Error Handling

The library throws errors for failed API requests:

try {
  const entries = await dictionary.entries("en", "nonexistentword");
} catch (error) {
  console.error("API Error:", error);
}

Getting API Credentials

To use this library, you need to register for an Oxford Dictionary API account:

  1. Visit Oxford Dictionary API
  2. Sign up for a free account
  3. Create a new application to get your App ID and App Key

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.