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.
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.
- 1Crea un account
Registrati solo con un indirizzo email e una password.
- 2Verifica la tua email
Inserisci il codice inviato da
[email protected]. La verifica garantisce 50 crediti gratuiti. - 3Memorizza la tua chiave API
Copia il generato
wly_live_...key e mantenerla in una variabile di ambiente lato server. - 4Effettua una richiesta di prova
Chiama l'endpoint dell'account per verificare l'autenticazione e visualizzare il saldo rimanente.
curl "https://api.wordlyenglish.com/v1/account" \
-H "Authorization: Bearer $WORDLY_API_KEY" \
-H "Accept: application/json"{
"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:
https://api.wordlyenglish.com/v1La 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_keyNon 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.
| Operazione | Costo del credito | Disponibilità |
|---|---|---|
GET /v1/status | 0 | Vivi |
GET /v1/account | 0 | Vivi |
GET /v1/words/{word} | 1–5 | Vivi |
GET /v1/words/search | 1 | Vivi |
GET /v1/words/random | 1 per parola | Vivi |
POST /v1/words/batch | Sulla base dei record restituiti | Vivi |
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.
{
"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.
{
"data": { ... },
"meta": {
"credits_used": 1,
"request_id": "..."
}
}{
"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.
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.
Endpoint di produzione
/v1/statusViviRestituisce 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" }
}/v1/accountLive · 0 creditsValidates the supplied key and returns the current account balance without charging a credit.
Intestazioni
| Nome | Obbligatorio | Descrizione |
|---|---|---|
Authorization | Sì | Bearer wly_live_... |
Accept | Consigliato | application/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" }
}Endpoint del vocabolario
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.
/v1/languagesLive · 0 creditsLists all supported interface and API-message locales. Vocabulary translations are returned only when a record contains them.
Query parameters
| Nome | Type | Obbligatorio | Rules | Descrizione |
|---|---|---|---|---|
lang | string | No | Supported locale code | Language 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" }
}/v1/words/{word}Live · 1–5 creditsReturns one exact vocabulary record. Catalog and translated records cost 1 credit; enriched records cost 5 credits.
Parameters
| Nome | Location | Type | Obbligatorio | Rules and meaning |
|---|---|---|---|---|
word | Path | string | Sì | Exact word or slug; maximum 120 characters. URL-encode special characters. |
languages | Query | string | No | Comma-separated translation codes, for example tr,de,fr. |
lang | Query | string | No | Human-readable message language; not a vocabulary filter. |
Richiesta di esempio
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" }
}/v1/words/searchDal vivo · 1 creditoSearches active vocabulary in alphabetical order. Use the returned cursor for stable forward pagination.
Query parameters
| Nome | Type | Obbligatorio | Default / limit | Descrizione |
|---|---|---|---|---|
q | string | No | Max 120 chars | Case-insensitive contained text. |
level | string | No | Max 30 chars | Exact level filter. |
part_of_speech / pos | string | No | Max 40 chars | Exact grammatical-class filter. |
category | string | No | Max 80 chars | Category-array filter. |
limit | integer | No | 20; min 1, max 50 | Maximum returned records. |
cursor | string | No | Max 120 chars | Previous meta.next_cursor. |
languages | string | No | Comma-separated | Translations to include. |
Richiesta di esempio
curl "https://api.wordlyenglish.com/v1/words/search?q=app&level=advanced&languages=tr&limit=2" \
-H "Authorization: Bearer $WORDLY_API_KEY"200 · Success
{
"data": [{
"id": "application",
"word": "application",
"part_of_speech": "noun",
"level": "advanced",
"definition": null,
"example": null,
"translations": { "tr": "uygulama" },
"categories": [],
"media": { "image_url": null, "audio_url": null, "attribution": {} },
"completeness": "translated"
}],
"meta": { "credits_used": 1, "request_id": "...", "lang": "en", "count": 1, "next_cursor": null }
}/v1/words/randomLive · 1 credit per requested slotReturns random active words for quizzes, discovery feeds, and practice sessions.
Query parameters
| Nome | Type | Obbligatorio | Default / limit | Descrizione |
|---|---|---|---|---|
count | integer | No | 1; min 1, max 20 | Requested slots and credit cost. |
level | string | No | Exact value | Level filter. |
part_of_speech / pos | string | No | Exact value | Grammatical-class filter. |
category | string | No | Exact value | Category filter. |
languages | string | No | Comma-separated | Translations 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 }
}/v1/words/batchLive · calculatedLooks 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
| Nome | Obbligatorio | Value |
|---|---|---|
Authorization | Sì | Bearer wly_live_... |
Content-Type | Sì | application/json |
Accept | Consigliato | application/json |
JSON body
| Field | Type | Obbligatorio | Rules | Descrizione |
|---|---|---|---|---|
words | string[] | Sì | 1–50 items; each max 120 chars | Words to resolve; duplicates are normalized and removed. |
languages | string[] | No | Supported locale codes | Translations 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" }
}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
| Field | Type | Nullable | Descrizione |
|---|---|---|---|
id | string | No | Stable URL-safe slug. |
word | string | No | Canonical English word. |
part_of_speech | string | Sì | Grammatical class. |
level | string | Sì | Learning difficulty or catalog level. |
definition | string | Sì | Concise English definition. |
example | string | Sì | Natural example sentence. |
phonetic | string | Sì | Pronunciation transcription when available. |
translations | object<string,string> | No | Locale codes mapped to translations; may be empty. |
synonyms | string[] | No | Available synonyms. |
antonyms | string[] | No | Available antonyms. |
categories | string[] | No | Learning or semantic categories. |
media.image_url | URL string | Sì | Learning image URL. |
media.audio_url | URL string | Sì | Pronunciation audio URL. |
media.attribution | object | No | Required media attribution metadata. |
completeness | enum | No | catalog, translated, o enriched. |
Meta object
| Field | Type | When present | Descrizione |
|---|---|---|---|
credits_used | integer | Metered responses | Credits charged by this request. |
request_id | UUID string | Metered success | Support and billing trace ID. |
lang | string | Always | Selected message locale. |
count | integer | List responses | Number of response items. |
next_cursor | string or null | Search | Next page cursor; null means final page. |
Error object
| Field | Type | Descrizione |
|---|---|---|
error.code | string | Stable machine-readable code. |
error.message | string | Localized human-readable explanation. |
error.upgrade_url | string | Relative billing URL on a 402 result. |
meta.lang | string | Error-message locale. |
Errori
| HTTP | Codice | Significato | Azione del cliente |
|---|---|---|---|
| 401 | invalid_api_key | Chiave mancante, non valida, revocata o inattiva. | Controllare l'intestazione del Portatore o sostituire la chiave. |
| 402 | credits_exhausted | Il conto non dispone di crediti per l'operazione. | Interrompi i tentativi e indirizza il cliente alla fatturazione. |
| 404 | not_found | L'endpoint richiesto non è disponibile. | Controlla il percorso e la versione dell'API. |
| 404 | word_not_found | La voce del vocabolario richiesto non è disponibile. | Controlla l'ortografia o usa la ricerca. |
| 422 | invalid_request | Un parametro o un corpo batch non è valido. | Correggere la richiesta prima di riprovare. |
| 405 | method_not_allowed | The endpoint does not accept the HTTP method. | Use the documented GET or POST method. |
| 413 | payload_too_large | The JSON request body exceeds 64 KB. | Reduce the batch body. |
| 415 | unsupported_media_type | The batch request is not JSON. | Send Content-Type: application/json. |
| 429 | rate_limit_exceeded | La chiave API ha superato 120 richieste al minuto. | Aspetta Retry-After. |
| 5xx | server_error | Un 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, e5xxseparatamente. - Query
GET /v1/accountwhen your application needs the current balance. - Registra endpoint, stato, latenza e
request_idsenza 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.
Hai bisogno di aiuto per l'integrazione? E-mail [email protected].