Supported Languages

We provide first-party SDKs for the most popular development environments. All SDKs share the same underlying API and receive updates simultaneously.

Installation

Install the SDK for your preferred language using your package manager of choice.

Terminal
npm install @dictionary/sdk
Terminal
pip install dictionary-sdk
Terminal
swift package add-dependency DictionarySDK
build.gradle.kts
dependencies {
    implementation("com.dictionary:sdk:3.2.0")
}

Quick Start

Initialize the client and make your first lookup request in under 30 seconds.

app.js
import { DictionaryClient } from '@dictionary/sdk';

const client = new DictionaryClient({
    apiKey: process.env.DICTIONARY_API_KEY
});

async function getDefinition(word) {
    const result = await client.lookup(word, {
        include: ['definitions', 'synonyms', 'pronunciation'],
        lang: 'en'
    });
    console.log(result);
}

getDefinition('ephemeral');
app.py
from dictionary_sdk import Client

client = Client(api_key="your-api-key")

result = client.lookup(
    word="ephemeral",
    include=["definitions", "synonyms"],
    lang="en"
)
print(result.to_dict())
Lookup.swift
import DictionarySDK

let client = DictionaryClient(apiKey: "your-api-key")

client.lookup("ephemeral") {
    result in
    switch result {
    case .success(let response):
        print(response.definitions)
    case .failure(let error):
        print("Lookup failed: \(error)")
    }
}

Authentication

All SDKs require an API key for authentication. Keep your keys secure and never expose them in client-side code or public repositories.

โ„น๏ธ
Use environment variables or secret management services to store your API keys. The SDKs automatically handle key rotation and refresh tokens.
Environment Variable Description Required
DICTIONARY_API_KEY Primary authentication key Yes
DICTIONARY_BASE_URL Override API endpoint (for sandbox) No
DICTIONARY_TIMEOUT Request timeout in milliseconds No

Error Handling

The SDKs throw standardized exceptions/errors that you can catch and handle gracefully.

JavaScript Error Example
try {
    await client.lookup('unknown_word');
} catch (error) {
    if (error instanceof DictionarySdkError) {
        console.error(`[${error.code}] ${error.message}`);
        
        if (error.code === 'RATE_LIMIT_EXCEEDED') {
            // Implement retry with exponential backoff
        }
    }
}