Wordly API ile oluşturun.
Sunucu tarafı bir API anahtarı kullanın, HTTPS istekleri yapın ve öngörülebilir bir kredi tabanlı faturalandırma modeli aracılığıyla her çağrıyı izleyin. Bu referans, şu anda üretimde mevcut olan uç noktaları belgelemekte ve halen hazırlanmakta olan uç noktaları açıkça belirtmektedir.
Hızlı başlangıç
Ücretsiz bir hesap oluşturun, altı haneli kodu kullanarak e-postanızı doğrulayın ve geliştirici kontrol panelinizde bir kez gösterilen API anahtarını kopyalayın.
- 1Hesap oluştur
Yalnızca e-posta adresi ve şifreyle kaydolun.
- 2E-postanızı doğrulayın
tarafından gönderilen kodu girin
[email protected]. Doğrulama sonrasında 50 ücretsiz kredi verilir. - 3API anahtarınızı saklayın
Oluşturulanı kopyala
wly_live_...anahtarını kullanın ve onu sunucu tarafı ortam değişkeninde tutun. - 4Test isteğinde bulunun
Kimlik doğrulamayı doğrulamak ve kalan bakiyeyi görmek için hesap uç noktasını arayın.
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" }
}Temel URL ve sürüm oluşturma
Tüm üretim uç noktalarına aşağıdaki sürüme sahip temel URL'den hizmet verilir:
https://api.wordlyenglish.com/v1Yanıt veya davranış değişikliklerini kırmak için yeni bir yol sürümü kullanılacaktır. İlave alanlar eklenebilir v1, bu nedenle istemciler tanımadıkları yanıt alanlarını yok saymalıdır.
Kimlik doğrulama
Kimliği doğrulanmış uç noktalar, HTTP'de bir API anahtarı gerektirir Authorization Taşıyıcı şemasını kullanarak başlık.
Authorization: Bearer wly_live_your_api_keyTarayıcı JavaScript'ine, genel Git depolarına, ekran görüntülerine, günlüklere veya dağıtılmış bir mobil uygulamaya asla canlı anahtar yerleştirmeyin. Arka uçtan Wordly API'yi çağırın ve kendi uygulamanızın bu arka uçla iletişim kurmasına izin verin.
Yerelleştirilmiş API mesajları
Yanıt dilini şununla ayarlayın: ?lang=tr veya standart Accept-Language başlık. Sorgu parametreleri önceliklidir. Her JSON yanıtı, seçilen yerel ayarı bildirir. Content-Language ve meta.lang. Programatik kullanım için hata kodları İngilizce ve sabit kalır; yalnızca okunabilir mesaj yerelleştirilir.
curl "https://api.wordlyenglish.com/v1/account?lang=tr" \
-H "Authorization: Bearer $WORDLY_API_KEY" \
-H "Accept-Language: tr-TR"Desteklenen dil kodları: 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.
Krediler ve faturalandırma
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.
| Operasyon | Kredi maliyeti | Kullanılabilirlik |
|---|---|---|
GET /v1/status | 0 | Canlı |
GET /v1/account | 0 | Canlı |
GET /v1/words/{word} | 1–5 | Canlı |
GET /v1/words/search | 1 | Canlı |
GET /v1/words/random | Kelime başına 1 | Canlı |
POST /v1/words/batch | Döndürülen kayıtlara göre | Canlı |
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 ve işlemi işlemez.
{
"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"
}
}API anahtarının yaşam döngüsü
Geliştirme, hazırlama ve üretim için ayrı anahtarlar oluşturun. Wordly her anahtarın yalnızca kriptografik karmasını saklar; değerin tamamı oluşturma sırasında bir kez görüntülenir.
- Anahtarları ortama veya hizmete göre adlandırın.
- Ortam değişkenlerini veya yönetilen bir gizli depoyu kullanın.
- Açığa çıkmış olabilecek bir anahtarı derhal iptal edin.
- Eski değerleri tekrar kullanmadan tuşları döndürün.
- Anahtarları sorgu dizelerinde göndermeyin.
Yanıt formatı
Başarılı yanıtlar üst düzey bir data nesne ve şunları içerebilir: meta nesne. Hatalar her zaman üst düzey bir değer kullanır error makine tarafından okunabilen kararlı bir nesne code ve insan tarafından okunabilen message.
{
"data": { ... },
"meta": {
"credits_used": 1,
"request_id": "..."
}
}{
"error": {
"code": "invalid_api_key",
"message": "..."
}
}Sakla request_id Başarılı bir faturalandırılmış istek hakkında destek ekibiyle iletişime geçtiğinizde. JSON, UTF-8 kodludur ve istemcilerin göndermesi gerekir 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.
Üretim uç noktaları
/v1/statusCanlıKamu hizmeti durumunu ve API sürüm bilgilerini döndürür. Bu uç nokta, kimlik doğrulama gerektirmez ve sıfır krediye mal olur.
Örnek istek
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.
Başlıklar
| İsim | Gerekli | Açıklama |
|---|---|---|
Authorization | Evet | Bearer wly_live_... |
Accept | Önerilen | application/json |
Yanıt başlıkları
X-Credits-Remaining is returned only by this balance endpoint.
200 · Success
{
"data": { "message": "Authenticated", "credits_remaining": 1250 },
"meta": { "lang": "en" }
}Kelime uç noktaları
Her kayıt kendi durumunu bildirir completeness olarak catalog, translatedveya enriched. Kullanılamayan alanlar şu şekilde döndürülür: null veya icat edilmiş veriler yerine boş bir nesne.
GET /v1/words/{word}
Tam bir kelime eşleşmesi döndürür. Kullanım languages=tr,de,fr yalnızca istenen çevirileri döndürmek için. Katalog veya çevrilmiş kayıtların maliyeti 1 kredidir; tamamen zenginleştirilmiş profillerin maliyeti 5 kredidir.
curl "https://api.wordlyenglish.com/v1/words/water?languages=tr,de" \
-H "Authorization: Bearer $WORDLY_API_KEY"GET /v1/words/search
Şu alanlarla arama yapın: q ve isteğe bağlı level, part_of_speech, category, limitve cursor. Limit 1 ile 50 arasındadır. Şunu gönderin: meta.next_cursor bir sonraki talebe.
curl "https://api.wordlyenglish.com/v1/words/search?q=app&level=advanced&limit=20" \
-H "Authorization: Bearer $WORDLY_API_KEY"GET /v1/words/random
1-20 rastgele kelimeyi döndürür. Şuna göre filtrele: level, part_of_speechveya category. Döndürülen her öğe bir kredi tutar.
POST /v1/words/batch
Tek bir istekte 1 ile 50 arasında benzersiz kelimeyi arar. Yanıt, istek sırasını korur ve her öğeyi şu şekilde işaretler: 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
Desteklenen 30 arayüzün ve API mesajı yerel ayarının tamamını döndürür. Kelime çevirileri yalnızca mevcut olduğunda döndürülür. Bu uç nokta halka açıktır ve sıfır krediye mal olur.
Oran sınırı
Her API anahtarı, sürekli dakika başına 120 kabul edilen istekle sınırlıdır. Yanıtlar şunları içerir: X-RateLimit-Limit ve X-RateLimit-Remaining. bir 429 rate_limit_exceeded yanıt şunları içerir 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
| İsim | Type | Gerekli | Rules | Açıklama |
|---|---|---|---|---|
lang | string | No | Supported locale code | Language for human-readable messages. |
Örnek istek
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
| İsim | Location | Type | Gerekli | Rules and meaning |
|---|---|---|---|---|
word | Path | string | Evet | 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. |
Örnek istek
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/searchCanlı · 1 krediSearches active vocabulary in alphabetical order. Use the returned cursor for stable forward pagination.
Query parameters
| İsim | Type | Gerekli | Default / limit | Açıklama |
|---|---|---|---|---|
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. |
Örnek istek
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
| İsim | Type | Gerekli | Default / limit | Açıklama |
|---|---|---|---|---|
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. |
Örnek istek
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.
Başlıklar
| İsim | Gerekli | Value |
|---|---|---|
Authorization | Evet | Bearer wly_live_... |
Content-Type | Evet | application/json |
Accept | Önerilen | application/json |
JSON body
| Field | Type | Gerekli | Rules | Açıklama |
|---|---|---|---|---|
words | string[] | Evet | 1–50 items; each max 120 chars | Words to resolve; duplicates are normalized and removed. |
languages | string[] | No | Supported locale codes | Translations to include. |
Örnek istek
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 | Açıklama |
|---|---|---|---|
id | string | No | Stable URL-safe slug. |
word | string | No | Canonical English word. |
part_of_speech | string | Evet | Grammatical class. |
level | string | Evet | Learning difficulty or catalog level. |
definition | string | Evet | Concise English definition. |
example | string | Evet | Natural example sentence. |
phonetic | string | Evet | 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 | Evet | Learning image URL. |
media.audio_url | URL string | Evet | Pronunciation audio URL. |
media.attribution | object | No | Required media attribution metadata. |
completeness | enum | No | catalog, translatedveya enriched. |
Meta object
| Field | Type | When present | Açıklama |
|---|---|---|---|
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 | Açıklama |
|---|---|---|
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. |
Hatalar
| HTTP | Kod | Anlamı | İstemci eylemi |
|---|---|---|---|
| 401 | invalid_api_key | Eksik, hatalı biçimlendirilmiş, iptal edilmiş veya etkin olmayan anahtar. | Taşıyıcı başlığını kontrol edin veya anahtarı değiştirin. |
| 402 | credits_exhausted | Hesapta işlem için gerekli kredi yok. | Yeniden denemeleri durdurun ve müşteriyi faturalandırmaya yönlendirin. |
| 404 | not_found | İstenen uç nokta mevcut değil. | Yolu ve API sürümünü kontrol edin. |
| 404 | word_not_found | İstenilen kelime girişi mevcut değil. | Yazımı kontrol edin veya aramayı kullanın. |
| 422 | invalid_request | Bir parametre veya toplu iş gövdesi geçersiz. | Yeniden denemeden önce isteği düzeltin. |
| 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 | API anahtarı dakikada 120 isteği aştı. | Şu süreyi bekleyin: Retry-After. |
| 5xx | server_error | Beklenmeyen bir sunucu tarafı hatası. | Geri alma ile yeniden deneyin; ısrar ederse desteğe başvurun. |
Önerilen yeniden deneme politikası
Tekrar deneme 401, 402veya 404 otomatik olarak. Geçici için 5xx Yanıtlar için titreşimli üstel geri çekilme ve katı bir yeniden deneme sınırı kullanın. Kabul edilen her kimliği doğrulanmış istek kredi tüketebileceğinden asla sınırsız bir yeniden deneme döngüsü oluşturmayın.
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);Python
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);Dart / Flutter
Wordly anahtarını Flutter uygulamasının içine göndermeyin. Örnek, güvenilir bir Dart arka ucuna veya sunucu işlevine aittir.
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']);
}Üretim kontrol listesi
- Güvenilir bir arka uç aracılığıyla Proxy Wordly istekleri.
- Bağlantı ve yanıt zaman aşımlarını ayarlayın.
- Şu durumları
401,402,404ve5xxayrı ayrı ele alın. - Query
GET /v1/accountwhen your application needs the current balance. - Uç noktayı, durumu, gecikmeyi ve
request_idAPI anahtarını kaydetmeden. - Her ortam için ayrı anahtarlar kullanın ve bunları düzenli aralıklarla değiştirin.
- Cache stable vocabulary responses in your backend when appropriate.
İlk isteğinizi yapmaya hazır mısınız?
Bir hesap oluşturun, e-postanızı doğrulayın ve 50 ücretsiz kredi kazanın.
Entegrasyon yardımına mı ihtiyacınız var? E-posta [email protected].