Documentazione per gli sviluppatori

Costruisci con l'API Wordly.

Utilizza una chiave API lato server, effettua richieste HTTPS e monitora ogni chiamata attraverso un modello di fatturazione prevedibile basato sul credito. Questo riferimento documenta gli endpoint attualmente disponibili in produzione e contrassegna chiaramente gli endpoint che sono ancora in fase di preparazione.

Versione dell'API v1Formato JSONTrasporti Solo HTTPSSaldo libero 50 creditiOpenAPI Scarica lo schemaPostman CollectionPostman Environment

Avvio rapido

Crea un account gratuito, verifica la tua email utilizzando il codice a sei cifre e copia la chiave API mostrata una volta nella dashboard dello sviluppatore.

  1. 1
    Crea un account

    Registrati solo con un indirizzo email e una password.

  2. 2
    Verifica la tua email

    Inserisci il codice inviato da [email protected]. La verifica garantisce 50 crediti gratuiti.

  3. 3
    Memorizza la tua chiave API

    Copia il generato wly_live_... key e mantenerla in una variabile di ambiente lato server.

  4. 4
    Effettua una richiesta di prova

    Chiama l'endpoint dell'account per verificare l'autenticazione e visualizzare il saldo rimanente.

Conchiglia
curl "https://api.wordlyenglish.com/v1/account" \
  -H "Authorization: Bearer $WORDLY_API_KEY" \
  -H "Accept: application/json"
200 risposte
{
  "data": {
    "message": "Authenticated",
    "credits_remaining": 50
  },
  "meta": { "lang": "en" }
}

URL di base e controllo delle versioni

Tutti gli endpoint di produzione vengono serviti dal seguente URL di base con versione:

URL di basehttps://api.wordlyenglish.com/v1

La risposta di rottura o le modifiche al comportamento utilizzeranno una nuova versione del percorso. All'interno possono essere introdotti campi aggiuntivi v1, quindi i client dovrebbero ignorare le proprietà di risposta che non riconoscono.

Autenticazione

Gli endpoint autenticati richiedono una chiave API nell'HTTP Authorization intestazione utilizzando lo schema Bearer.

Authorization: Bearer wly_live_your_api_key
Non esporre le chiavi API.

Non inserire mai una chiave live nel JavaScript del browser, nei repository Git pubblici, negli screenshot, nei log o in un'applicazione mobile distribuita. Chiama l'API Wordly dal tuo backend e lascia che la tua applicazione comunichi con quel backend.

Messaggi API localizzati

Imposta la lingua di risposta con ?lang=tr o la norma Accept-Language intestazione. I parametri di query hanno la precedenza. Ogni risposta JSON dichiara la locale selezionata in Content-Language e meta.lang. I codici di errore rimangono stabili in inglese per la gestione programmatica; solo il messaggio leggibile dall'uomo è localizzato.

curl "https://api.wordlyenglish.com/v1/account?lang=tr" \
  -H "Authorization: Bearer $WORDLY_API_KEY" \
  -H "Accept-Language: tr-TR"

Codici lingua supportati: en, tr, de, fr, es, it, pt, nl, pl, ru, uk, ar, fa, he, hi, bn, ur, zh, ja, ko, id, ms, vi, th, sv, no, da, fi, cs, ro.

Crediti e fatturazione

Each successful metered request consumes the documented number of credits. Email-verified accounts receive 50 free credits once. Credits are deducted atomically, so concurrent requests cannot spend the same balance twice. Balance lookup through GET /v1/account is free.

OperazioneCosto del creditoDisponibilità
GET /v1/status0Vivi
GET /v1/account0Vivi
GET /v1/words/{word}1–5Vivi
GET /v1/words/search1Vivi
GET /v1/words/random1 per parolaVivi
POST /v1/words/batchSulla base dei record restituitiVivi

Use GET /v1/account when you need the current balance. Other endpoint responses include the operation charge but omit the remaining balance. When the balance is insufficient, the API returns HTTP 402 e non elabora l'operazione.

Risposta 402
{
  "error": {
    "code": "credits_exhausted",
    "message": "Your credit balance is exhausted. Add a package or enable pay-as-you-go to continue.",
    "upgrade_url": "/app.php?page=billing"
  }
}

Ciclo di vita della chiave API

Crea chiavi separate per sviluppo, gestione temporanea e produzione. Wordly memorizza solo un hash crittografico di ciascuna chiave; il valore completo viene visualizzato una volta al momento della creazione.

  • Assegnare un nome alle chiavi in base all'ambiente o al servizio.
  • Utilizzare variabili di ambiente o un archivio segreto gestito.
  • Revocare immediatamente una chiave se potrebbe essere stata esposta.
  • Ruota le chiavi senza riutilizzare i vecchi valori.
  • Non inviare chiavi nelle stringhe di query.

Formato della risposta

Le risposte riuscite utilizzano un livello superiore data oggetto e può includere a meta oggetto. Gli errori utilizzano sempre un livello superiore error oggetto con un carattere leggibile dalla macchina stabile code e leggibile dall'uomo message.

Richiesta riuscita
{
  "data": { ... },
  "meta": {
    "credits_used": 1,
    "request_id": "..."
  }
}
Richiesta non riuscita
{
  "error": {
    "code": "invalid_api_key",
    "message": "..."
  }
}

Conserva il request_id quando si contatta l'assistenza per una richiesta fatturata con successo. JSON è codificato UTF-8 e i client devono inviare Accept: application/json.

Cache behavior

Wordly caches shared vocabulary data on the server, never API keys, account identities, balances, rate-limit state, or request identifiers. Public status and language responses advertise shared-cache lifetimes. Authenticated responses remain private, no-store; applications may cache the stable data value in their own trusted backend when appropriate.

Riferimento dell'endpoint

Endpoint di produzione

OTTIENI/v1/statusVivi

Restituisce informazioni sullo stato del servizio pubblico e sulla versione dell'API. Questo endpoint non richiede autenticazione e costa zero crediti.

Richiesta di esempio

curl "https://api.wordlyenglish.com/v1/status" \
  -H "Accept: application/json"

200 · Success

{
  "data": { "status": "ok", "version": "v1" },
  "meta": { "lang": "en" }
}
Possible results200 Service is reachable.405 Method is not GET.429 IP request limit exceeded.
OTTIENI/v1/accountLive · 0 credits

Validates the supplied key and returns the current account balance without charging a credit.

Intestazioni

NomeObbligatorioDescrizione
AuthorizationSìBearer wly_live_...
AcceptConsigliatoapplication/json

Intestazioni di risposta

X-Credits-Remaining is returned only by this balance endpoint.

200 · Success

{
  "data": { "message": "Authenticated", "credits_remaining": 1250 },
  "meta": { "lang": "en" }
}
Possible results200 Key accepted and balance returned.401 Missing, invalid, revoked, or suspended key.429 Rate limit exceeded.

Endpoint del vocabolario

Sono attive oltre 20.000 voci di catalogo.

Ogni record riporta il suo completeness come catalog, translated, o enriched. I campi che non sono disponibili vengono restituiti come null o un oggetto vuoto invece di dati inventati.

GET /v1/words/{word}

Restituisce una corrispondenza esatta della parola. Utilizzare languages=tr,de,fr per restituire solo le traduzioni richieste. Cataloghi o documenti tradotti costano 1 credito; i profili completamente arricchiti costano 5 crediti.

curl "https://api.wordlyenglish.com/v1/words/water?languages=tr,de" \
  -H "Authorization: Bearer $WORDLY_API_KEY"

GET /v1/words/search

Cerca con q e facoltativo level, part_of_speech, category, limit, e cursor. I limiti vanno da 1 a 50. Passato meta.next_cursor nella richiesta successiva.

curl "https://api.wordlyenglish.com/v1/words/search?q=app&level=advanced&limit=20" \
  -H "Authorization: Bearer $WORDLY_API_KEY"

GET /v1/words/random

Restituisce da 1 a 20 parole casuali. Filtra per level, part_of_speech, o category. Ogni slot restituito costa un credito.

POST /v1/words/batch

Cerca da 1 a 50 parole univoche in un'unica richiesta. La risposta preserva l'ordine della richiesta e contrassegna ogni elemento con found.

curl -X POST "https://api.wordlyenglish.com/v1/words/batch?lang=tr" \
  -H "Authorization: Bearer $WORDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"words":["water","opportunity"],"languages":["tr","de"]}'

GET /v1/languages

Restituisce tutte le 30 interfacce supportate e le impostazioni locali dei messaggi API. Le traduzioni del vocabolario vengono restituite solo quando disponibili. Questo endpoint è pubblico e costa zero crediti.

Limite di tariffa

Ciascuna chiave API è limitata a 120 richieste accettate per minuto continuativo. Le risposte includono X-RateLimit-Limit e X-RateLimit-Remaining. A 429 rate_limit_exceeded la risposta include Retry-After: 60.

OTTIENI/v1/languagesLive · 0 credits

Lists all supported interface and API-message locales. Vocabulary translations are returned only when a record contains them.

Query parameters

NomeTypeObbligatorioRulesDescrizione
langstringNoSupported locale codeLanguage for human-readable messages.

Richiesta di esempio

curl "https://api.wordlyenglish.com/v1/languages?lang=tr"

200 · Success

{
  "data": [{
    "code": "tr",
    "name": "Türkçe",
    "message_localization": true,
    "vocabulary_translation": "when_available"
  }],
  "meta": { "count": 30, "lang": "tr" }
}
Possible results200 Locale list returned.405 Method is not GET.429 IP request limit exceeded.
OTTIENI/v1/words/{word}Live · 1–5 credits

Returns one exact vocabulary record. Catalog and translated records cost 1 credit; enriched records cost 5 credits.

Parameters

NomeLocationTypeObbligatorioRules and meaning
wordPathstringSìExact word or slug; maximum 120 characters. URL-encode special characters.
languagesQuerystringNoComma-separated translation codes, for example tr,de,fr.
langQuerystringNoHuman-readable message language; not a vocabulary filter.

Richiesta di esempio

Conchiglia
curl "https://api.wordlyenglish.com/v1/words/water?languages=tr,de" \
  -H "Authorization: Bearer $WORDLY_API_KEY" \
  -H "Accept: application/json"

200 · Success

{
  "data": {
    "id": "water",
    "word": "water",
    "part_of_speech": "noun",
    "level": "basic",
    "definition": "A clear liquid essential for life.",
    "example": "Please drink enough water every day.",
    "translations": { "tr": "su", "de": "Wasser" },
    "categories": ["nature", "daily-life"],
    "media": {
      "image_url": "https://media.example/water.webp",
      "audio_url": "https://media.example/water.mp3",
      "attribution": {}
    },
    "completeness": "enriched"
  },
  "meta": {
    "credits_used": 5,
    "request_id": "5ebac760-cdc5-4a73-a87b-22463d81483c",
    "lang": "en"
  }
}

404 · Word unavailable

{
  "error": { "code": "word_not_found", "message": "The requested word was not found." },
  "meta": { "lang": "en" }
}
Possible results200 Exact record returned.401 Invalid API key.402 Insufficient credits.404 Word not found.422 Word too long.429 Rate limit exceeded.
OTTIENI/v1/words/randomLive · 1 credit per requested slot

Returns random active words for quizzes, discovery feeds, and practice sessions.

Query parameters

NomeTypeObbligatorioDefault / limitDescrizione
countintegerNo1; min 1, max 20Requested slots and credit cost.
levelstringNoExact valueLevel filter.
part_of_speech / posstringNoExact valueGrammatical-class filter.
categorystringNoExact valueCategory filter.
languagesstringNoComma-separatedTranslations to include.

Richiesta di esempio

curl "https://api.wordlyenglish.com/v1/words/random?count=3&level=basic&languages=tr" \
  -H "Authorization: Bearer $WORDLY_API_KEY"

200 · Success

{
  "data": [{ "id": "water", "word": "water", "part_of_speech": "noun", "level": "basic", "definition": null, "example": null, "translations": { "tr": "su" }, "categories": [], "media": { "image_url": null, "audio_url": null, "attribution": {} }, "completeness": "translated" }],
  "meta": { "credits_used": 3, "request_id": "...", "lang": "en", "count": 1 }
}
Possible results200 Random array returned.401 Invalid API key.402 Balance below requested count.429 Rate limit exceeded.
POST/v1/words/batchLive · calculated

Looks up 1–50 unique words while preserving request order. Each enriched result costs 5 credits, another found result costs 1, and the minimum request charge is 1.

Intestazioni

NomeObbligatorioValue
AuthorizationSìBearer wly_live_...
Content-TypeSìapplication/json
AcceptConsigliatoapplication/json

JSON body

FieldTypeObbligatorioRulesDescrizione
wordsstring[]Sì1–50 items; each max 120 charsWords to resolve; duplicates are normalized and removed.
languagesstring[]NoSupported locale codesTranslations to include.

Richiesta di esempio

curl -X POST "https://api.wordlyenglish.com/v1/words/batch?lang=tr" \
  -H "Authorization: Bearer $WORDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"words":["water","not-a-word"],"languages":["tr","de"]}'

200 · Success

{
  "data": [
    { "query": "water", "found": true, "word": { "id": "water", "word": "water", "part_of_speech": "noun", "level": "basic", "definition": null, "example": null, "translations": { "tr": "su", "de": "Wasser" }, "categories": [], "media": { "image_url": null, "audio_url": null, "attribution": {} }, "completeness": "translated" } },
    { "query": "not-a-word", "found": false, "word": null }
  ],
  "meta": { "credits_used": 1, "request_id": "...", "lang": "tr", "count": 2 }
}

422 · Invalid body

{
  "error": { "code": "invalid_request", "message": "Provide between 1 and 50 words." },
  "meta": { "lang": "en" }
}
Possible results200 Ordered results.401 Invalid API key.402 Insufficient credits.413 Body over 64 KB.415 Content-Type is not JSON.422 Invalid words array.429 Rate limit exceeded.

Response field reference

Every stable response variable is described below. Additive fields may appear later, so clients should ignore fields they do not recognize.

Vocabulary object

FieldTypeNullableDescrizione
idstringNoStable URL-safe slug.
wordstringNoCanonical English word.
part_of_speechstringSìGrammatical class.
levelstringSìLearning difficulty or catalog level.
definitionstringSìConcise English definition.
examplestringSìNatural example sentence.
phoneticstringSìPronunciation transcription when available.
translationsobject<string,string>NoLocale codes mapped to translations; may be empty.
synonymsstring[]NoAvailable synonyms.
antonymsstring[]NoAvailable antonyms.
categoriesstring[]NoLearning or semantic categories.
media.image_urlURL stringSìLearning image URL.
media.audio_urlURL stringSìPronunciation audio URL.
media.attributionobjectNoRequired media attribution metadata.
completenessenumNocatalog, translated, o enriched.

Meta object

FieldTypeWhen presentDescrizione
credits_usedintegerMetered responsesCredits charged by this request.
request_idUUID stringMetered successSupport and billing trace ID.
langstringAlwaysSelected message locale.
countintegerList responsesNumber of response items.
next_cursorstring or nullSearchNext page cursor; null means final page.

Error object

FieldTypeDescrizione
error.codestringStable machine-readable code.
error.messagestringLocalized human-readable explanation.
error.upgrade_urlstringRelative billing URL on a 402 result.
meta.langstringError-message locale.

Errori

HTTPCodiceSignificatoAzione del cliente
401invalid_api_keyChiave mancante, non valida, revocata o inattiva.Controllare l'intestazione del Portatore o sostituire la chiave.
402credits_exhaustedIl conto non dispone di crediti per l'operazione.Interrompi i tentativi e indirizza il cliente alla fatturazione.
404not_foundL'endpoint richiesto non è disponibile.Controlla il percorso e la versione dell'API.
404word_not_foundLa voce del vocabolario richiesto non è disponibile.Controlla l'ortografia o usa la ricerca.
422invalid_requestUn parametro o un corpo batch non è valido.Correggere la richiesta prima di riprovare.
405method_not_allowedThe endpoint does not accept the HTTP method.Use the documented GET or POST method.
413payload_too_largeThe JSON request body exceeds 64 KB.Reduce the batch body.
415unsupported_media_typeThe batch request is not JSON.Send Content-Type: application/json.
429rate_limit_exceededLa chiave API ha superato 120 richieste al minuto.Aspetta Retry-After.
5xxserver_errorUn errore imprevisto sul lato server.Riprova con backoff; contattare l'assistenza se persistente.

Politica di ripetizione consigliata

Non riprovare 401, 402, o 404 automaticamente. Per transitorio 5xx risposte, utilizzare il backoff esponenziale con jitter e un limite rigoroso ai tentativi. Non creare mai un ciclo illimitato di tentativi poiché ogni richiesta autenticata accettata potrebbe consumare crediti.

JavaScript/Node.js

const response = await fetch('https://api.wordlyenglish.com/v1/account', {
  headers: {
    Authorization: `Bearer ${process.env.WORDLY_API_KEY}`,
    Accept: 'application/json'
  }
});

const body = await response.json();
if (!response.ok) {
  throw new Error(`${body.error.code}: ${body.error.message}`);
}

console.log(body.data.credits_remaining);

Pitone

import os
import requests

response = requests.get(
    'https://api.wordlyenglish.com/v1/account',
    headers={
        'Authorization': f'Bearer {os.environ["WORDLY_API_KEY"]}',
        'Accept': 'application/json',
    },
    timeout=15,
)
response.raise_for_status()
print(response.json()['data']['credits_remaining'])

PHP

$curl = curl_init('https://api.wordlyenglish.com/v1/account');
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('WORDLY_API_KEY'),
    'Accept: application/json',
  ],
]);

$body = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
curl_close($curl);

if ($status >= 400) {
  throw new RuntimeException('Wordly API request failed');
}
$data = json_decode($body, true, flags: JSON_THROW_ON_ERROR);

Dardo / Svolazzo

Non spedire la chiave Wordly all'interno di un'applicazione Flutter. L'esempio appartiene a un backend o a una funzione server Dart attendibile.

final response = await http.get(
  Uri.parse('https://api.wordlyenglish.com/v1/account'),
  headers: {
    'Authorization': 'Bearer ${Platform.environment['WORDLY_API_KEY']}',
    'Accept': 'application/json',
  },
);

final body = jsonDecode(response.body) as Map<String, dynamic>;
if (response.statusCode >= 400) {
  throw Exception((body['error'] as Map)['code']);
}

Lista di controllo della produzione

  • Richieste proxy Wordly tramite un backend affidabile.
  • Imposta i timeout di connessione e risposta.
  • Maniglia 401, 402, 404, e 5xx separatamente.
  • Query GET /v1/account when your application needs the current balance.
  • Registra endpoint, stato, latenza e request_id senza registrare la chiave API.
  • Utilizza chiavi separate per ambiente e ruotale periodicamente.
  • Cache stable vocabulary responses in your backend when appropriate.

Pronto a fare la tua prima richiesta?

Crea un account, verifica la tua email e ricevi 50 crediti gratuiti.

Crea un account gratuito

Hai bisogno di aiuto per l'integrazione? E-mail [email protected].