πŸ” Engoro Lexicon API

Public API for word search, filtering, and discovery. Powered by Cloudflare Workers + D1.

Endpoints

GET /api/v1/words/search

Search words by query string

Query Parameters:

ParameterTypeRequiredDescription
qstringYesSearch query (min 2 chars)
limitnumberNoResults per page (default: 20, max: 100)
offsetnumberNoPagination offset (default: 0)
localestringNoInclude translation for locale (e.g. vi-VN)

Example:

curl 'https://api.engoro.com/api/v1/words/search?q=hello&limit=10'

GET /api/v1/words

Filter words by criteria

Query Parameters:

ParameterTypeDescription
difficultynumber1-5 scale (comma-separated for multiple)
posstringPart of speech (noun, verb, etc)
frequencystringcommon, uncommon, rare
cefrLevelstringA1, A2, B1, B2, C1, C2
sortBystringdifficulty, frequency, alphabetical
limitnumberResults per page (default: 20)
offsetnumberPagination offset (default: 0)

GET /api/v1/words/:id

Get a specific word by ID

Example:

curl 'https://api.engoro.com/api/v1/words/1?locale=vi-VN'

GET /api/v1/suggestions

Get word suggestions for autocomplete

ParameterTypeDescription
qstringSearch query (min 1 char)
limitnumberMax results (default: 10, max: 50)
localestringInclude translation for locale

GET /api/v1/random

Get random words

ParameterTypeDescription
countnumberNumber of words (default: 5, max: 50)
difficultynumberOptional difficulty filter (1-5)

GET /api/v1/translate

Translate a word to a specific locale

Query Parameters:

ParameterTypeRequiredDescription
wordstringYesWord to translate
localestringYesTarget locale (e.g., vi-VN, zh-CN)

How it works:

  1. First checks D1 database for existing translation
  2. If found, returns database translation with source: "database"
  3. If not found, attempts LLM translation with source: "llm"
  4. Returns null if translation not available

Example:

curl 'https://api.engoro.com/api/v1/translate?word=hello&locale=vi-VN'

Response:

{
  "success": true,
  "data": {
    "word": "hello",
    "locale": "vi-VN",
    "translation": "xin chΓ o",
    "source": "database"
  }
}

GET /api/v1/stats

Get API statistics (total words, locales, distribution)

Response Format

Success (200):

{
  "success": true,
  "data": [...],
  "pagination": {
    "total": 1000,
    "limit": 20,
    "offset": 0,
    "hasMore": true
  },
  "meta": {
    "queryTime": "12.5ms"
  }
}

Error (400/404/500):

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Query parameter 'q' is required"
  }
}

Features

Status

API Version: v1

Database: Cloudflare D1 (SQLite)

Rate Limiting: None (subject to change)