Shobdo Logo

SDKs & Libraries

We are actively developing official client libraries to make integrating with the Shobdo API even easier. In the meantime, you can use any HTTP client to interact with the API directly.

Coming Soon

LanguagePackageStatus
JavaScript / TypeScript@shobdo/js✅ Available
Pythonshobdo-python🚧 In Development

Official SDKs

JavaScript / TypeScript

The official JavaScript and TypeScript client is available on npm. It works in Node.js 18+ and modern browsers out of the box.

npm install @shobdo/js
# or
yarn add @shobdo/js
# or
pnpm add @shobdo/js

Basic Usage

Import the ShobdoClient and initialize it with your API key from the Shobdo Console.

import { ShobdoClient } from '@shobdo/js';
 
const client = new ShobdoClient({ 
  apiKey: process.env.SHOBDO_API_KEY,
});
 
// Search across all dictionaries
const response = await client.search("hello", {
  lang: "en",             // Filter by language
  limit: 10,              // Pagination limit
  matchType: "prefix",    // Match type
});
 
console.log(`Found ${response.meta.total} results`);
response.data.forEach(result => {
  console.log(`${result.word} - ${result.preview}`);
});
 
// Retrieve a specific entry
const entry = await client.getEntryByWord("shobdo_en_us_bn_bd", "ধন্যবাদ");
console.log(entry.data.htmlContent);
 
// Get Audio URLs
const audioUrl = client.getAudioUrl("dictionary_id", "entry_id");
const audio = new Audio(audioUrl);
audio.play();

Using the API Directly

The REST API is simple enough to use with any HTTP client. Here are minimal examples in popular languages:

Python
import os
import requests
 
def search_shobdo(query: str):
    response = requests.get(
        "https://api.shobdo.me/api/v1/search",
        params={"q": query},
        headers={"Authorization": f"Bearer {os.environ['SHOBDO_API_KEY']}"},
    )
    result = response.json()
    if not result["ok"]:
        raise Exception(result["error"])
    return result["data"]
Go
package main
 
import (
    "encoding/json"
    "fmt"
    "net/http"
    "net/url"
    "os"
)
 
func searchShobdo(query string) (map[string]interface{}, error) {
    u := fmt.Sprintf("https://api.shobdo.me/api/v1/search?q=%s", url.QueryEscape(query))
    req, _ := http.NewRequest("GET", u, nil)
    req.Header.Set("Authorization", "Bearer "+os.Getenv("SHOBDO_API_KEY"))
 
    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        return nil, err
    }
    defer resp.Body.Close()
 
    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    return result, nil
}

Community Libraries

If you build a client library for the Shobdo API in any language, let us know and we will feature it here.

Assistant

Hi! I'm the Shobdo Assistant.
Ask me anything about the documentation.