ڈویلپر کی دستاویزات

Wordly API کے ساتھ بنائیں۔

ایک سرور سائیڈ API کلید کا استعمال کریں، HTTPS درخواستیں کریں، اور پیشین گوئی کے قابل کریڈٹ پر مبنی بلنگ ماڈل کے ذریعے ہر کال کو ٹریک کریں۔ یہ حوالہ اس وقت پروڈکشن میں دستیاب اختتامی نکات کو دستاویز کرتا ہے اور واضح طور پر ان اختتامی نکات کو نشان زد کرتا ہے جو ابھی تک تیار ہو رہے ہیں۔

API version v1فارمیٹ JSONٹرانسپورٹ صرف HTTPSمفت بیلنس 50 creditsاوپن اے پی آئی اسکیما ڈاؤن لوڈ کریں۔Postman CollectionPostman Environment

کوئیک اسٹارٹ

ایک مفت اکاؤنٹ بنائیں، چھ ہندسوں کے کوڈ کا استعمال کرتے ہوئے اپنے ای میل کی تصدیق کریں، اور اپنے ڈویلپر ڈیش بورڈ میں ایک بار دکھائی جانے والی API کلید کو کاپی کریں۔

  1. 1
    ایک اکاؤنٹ بنائیں

    صرف ایک ای میل ایڈریس اور پاس ورڈ کے ساتھ رجسٹر کریں۔

  2. 2
    اپنے ای میل کی تصدیق کریں۔

    کی طرف سے بھیجا گیا کوڈ درج کریں۔ [email protected]. Verification grants 50 free credits.

  3. 3
    اپنی API کلید کو اسٹور کریں۔

    تیار کردہ کاپی کریں۔ wly_live_... کلید بنائیں اور اسے سرور سائیڈ ماحول کے متغیر میں رکھیں۔

  4. 4
    ٹیسٹ کی درخواست کریں۔

    تصدیق کی توثیق کرنے اور بقیہ بیلنس دیکھنے کے لیے اکاؤنٹ اینڈ پوائنٹ پر کال کریں۔

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

بیس یو آر ایل اور ورژننگ

تمام پروڈکشن اینڈ پوائنٹس درج ذیل ورژن والے بیس یو آر ایل سے پیش کیے جاتے ہیں:

بنیادی URLhttps://api.wordlyenglish.com/v1

بریکنگ رسپانس یا رویے میں تبدیلیاں ایک نیا پاتھ ورژن استعمال کریں گی۔ اضافی فیلڈز کے اندر متعارف کرایا جا سکتا ہے v1, so clients should ignore response properties they do not recognize.

تصدیق

توثیق شدہ اختتامی پوائنٹس کو HTTP میں API کلید کی ضرورت ہوتی ہے۔ Authorization بیئرر اسکیم کا استعمال کرتے ہوئے ہیڈر۔

Authorization: Bearer wly_live_your_api_key
API کیز کو بے نقاب نہ کریں۔

براؤزر JavaScript، عوامی Git ریپوزٹریز، اسکرین شاٹس، لاگز، یا تقسیم شدہ موبائل ایپلیکیشن میں کبھی بھی لائیو کلید نہ رکھیں۔ اپنے بیک اینڈ سے Wordly API کو کال کریں اور آپ کی اپنی ایپلیکیشن کو اس بیک اینڈ کے ساتھ بات چیت کرنے دیں۔

مقامی API پیغامات

کے ساتھ جوابی زبان سیٹ کریں۔ ?lang=tr یا معیار Accept-Language ہیڈر استفسار کے پیرامیٹرز کو فوقیت حاصل ہے۔ ہر JSON جواب میں منتخب کردہ مقام کا اعلان کرتا ہے۔ Content-Language اور meta.lang. Error codes remain stable in English for programmatic handling; only the human-readable message is localized.

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

معاون زبان کے کوڈز: 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.

کریڈٹ اور بلنگ

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.

آپریشنکریڈٹ لاگتدستیابی
GET /v1/status0جیو
GET /v1/account0جیو
GET /v1/words/{word}1–5جیو
GET /v1/words/search1جیو
GET /v1/words/random1 per wordجیو
POST /v1/words/batchواپس کیے گئے ریکارڈ کی بنیاد پرجیو

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 اور آپریشن پر کارروائی نہیں کرتا۔

402 response
{
  "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 key lifecycle

ڈویلپمنٹ، سٹیجنگ اور پروڈکشن کے لیے علیحدہ کلیدیں بنائیں۔ Wordly ہر کلید کی صرف ایک کرپٹوگرافک ہیش اسٹور کرتا ہے۔ مکمل قدر تخلیق کے وقت ایک بار ظاہر ہوتی ہے۔

  • ماحول یا خدمت کے لحاظ سے نام کی چابیاں۔
  • ماحولیاتی متغیرات یا منظم خفیہ اسٹور کا استعمال کریں۔
  • اگر کسی کلید کو ظاہر کیا گیا ہو تو اسے فوری طور پر منسوخ کریں۔
  • پرانی اقدار کو دوبارہ استعمال کیے بغیر چابیاں گھمائیں۔
  • استفسار کے تاروں میں چابیاں نہ بھیجیں۔

جوابی شکل

کامیاب جوابات اعلیٰ سطح کا استعمال کرتے ہیں۔ data اعتراض اور شامل ہوسکتا ہے a meta اعتراض غلطیاں ہمیشہ اعلیٰ سطح کا استعمال کرتی ہیں۔ error ایک مستحکم مشین کے ساتھ پڑھنے کے قابل آبجیکٹ code اور انسانی پڑھنے کے قابل message.

کامیاب درخواست
{
  "data": { ... },
  "meta": {
    "credits_used": 1,
    "request_id": "..."
  }
}
ناکام درخواست
{
  "error": {
    "code": "invalid_api_key",
    "message": "..."
  }
}

رکھیں request_id کامیاب بل کی درخواست کے بارے میں سپورٹ سے رابطہ کرتے وقت۔ JSON UTF-8 انکوڈ شدہ ہے اور کلائنٹس کو بھیجنا چاہیے۔ 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.

اختتامی حوالہ

پیداوار کے اختتامی مقامات

حاصل کریں۔/v1/statusجیو

پبلک سروس ہیلتھ اور API ورژن کی معلومات لوٹاتا ہے۔ اس اختتامی نقطہ کو توثیق کی ضرورت نہیں ہے اور اس کی قیمت صفر کریڈٹ ہے۔

مثال کی درخواست

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.
حاصل کریں۔/v1/accountLive · 0 credits

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

ہیڈرز

نامدرکار ہے۔تفصیل
Authorizationجی ہاںBearer wly_live_...
Acceptتجویز کردہapplication/json

جوابی ہیڈرز

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.

الفاظ کے اختتامی نکات

20,000+ catalog entries are live.

ہر ریکارڈ اپنی رپورٹ کرتا ہے۔ completeness کے طور پر catalog, translated, or enriched. Fields that are not available are returned as null یا ایجاد کردہ ڈیٹا کی بجائے ایک خالی چیز۔

GET /v1/words/{word}

ایک عین مطابق الفاظ کی مماثلت لوٹاتا ہے۔ استعمال کریں۔ languages=tr,de,fr صرف درخواست کردہ ترجمے واپس کرنے کے لیے۔ کیٹلاگ یا ترجمہ شدہ ریکارڈز کی قیمت 1 کریڈٹ؛ مکمل طور پر افزودہ پروفائلز کی قیمت 5 کریڈٹس۔

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

GET /v1/words/search

کے ساتھ تلاش کریں۔ q اور اختیاری level, part_of_speech, category, limit, and cursor. Limits range from 1 to 50. Pass meta.next_cursor اگلی درخواست میں۔

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 بے ترتیب الفاظ لوٹاتا ہے۔ کے لحاظ سے فلٹر کریں۔ level, part_of_speech, or category. Each returned slot costs one credit.

POST /v1/words/batch

ایک درخواست میں 1 اور 50 کے درمیان منفرد الفاظ نظر آتے ہیں۔ جواب درخواست کے آرڈر کو محفوظ رکھتا ہے اور ہر آئٹم کو نشان زد کرتا ہے۔ 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

تمام 30 تعاون یافتہ انٹرفیس اور API- میسج لوکلز لوٹاتا ہے۔ الفاظ کے ترجمے صرف دستیاب ہونے پر واپس کیے جاتے ہیں۔ یہ اختتامی نقطہ عوامی ہے اور اس کی قیمت صفر کریڈٹ ہے۔

شرح کی حد

ہر API کلید فی رولنگ منٹ 120 قبول شدہ درخواستوں تک محدود ہے۔ جوابات شامل ہیں۔ X-RateLimit-Limit اور X-RateLimit-Remaining. A 429 rate_limit_exceeded جواب شامل ہے Retry-After: 60.

حاصل کریں۔/v1/languagesLive · 0 credits

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

Query parameters

نامTypeدرکار ہے۔Rulesتفصیل
langstringNoSupported locale codeLanguage for human-readable messages.

مثال کی درخواست

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.
حاصل کریں۔/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

نامLocationTypeدرکار ہے۔Rules and meaning
wordPathstringجی ہاں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.

مثال کی درخواست

شیل
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.
حاصل کریں۔/v1/words/randomLive · 1 credit per requested slot

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

Query parameters

نامTypeدرکار ہے۔Default / limitتفصیل
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.

مثال کی درخواست

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.

ہیڈرز

نامدرکار ہے۔Value
Authorizationجی ہاںBearer wly_live_...
Content-Typeجی ہاںapplication/json
Acceptتجویز کردہapplication/json

JSON body

FieldTypeدرکار ہے۔Rulesتفصیل
wordsstring[]جی ہاں1–50 items; each max 120 charsWords to resolve; duplicates are normalized and removed.
languagesstring[]NoSupported locale codesTranslations to include.

مثال کی درخواست

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

FieldTypeNullableتفصیل
idstringNoStable URL-safe slug.
wordstringNoCanonical English word.
part_of_speechstringجی ہاںGrammatical class.
levelstringجی ہاںLearning difficulty or catalog level.
definitionstringجی ہاںConcise English definition.
examplestringجی ہاںNatural example sentence.
phoneticstringجی ہاں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 stringجی ہاںLearning image URL.
media.audio_urlURL stringجی ہاںPronunciation audio URL.
media.attributionobjectNoRequired media attribution metadata.
completenessenumNocatalog, translated, or enriched.

Meta object

FieldTypeWhen presentتفصیل
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

FieldTypeتفصیل
error.codestringStable machine-readable code.
error.messagestringLocalized human-readable explanation.
error.upgrade_urlstringRelative billing URL on a 402 result.
meta.langstringError-message locale.

غلطیاں

HTTPکوڈمطلبکلائنٹ کی کارروائی
401invalid_api_keyغائب، خراب، منسوخ، یا غیر فعال کلید۔بیئرر ہیڈر کو چیک کریں یا کلید کو تبدیل کریں۔
402credits_exhaustedاکاؤنٹ میں آپریشن کے لیے کریڈٹ کی کمی ہے۔دوبارہ کوششیں بند کریں اور کسٹمر کو بلنگ کی ہدایت کریں۔
404not_foundمطلوبہ اختتامی نقطہ دستیاب نہیں ہے۔راستہ اور API ورژن چیک کریں۔
404word_not_foundمطلوبہ الفاظ کا اندراج دستیاب نہیں ہے۔ہجے چیک کریں یا تلاش کا استعمال کریں۔
422invalid_requestپیرامیٹر یا بیچ باڈی غلط ہے۔دوبارہ کوشش کرنے سے پہلے درخواست کو درست کریں۔
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_exceededAPI کلید فی منٹ 120 درخواستوں سے تجاوز کر گئی۔Wait for Retry-After.
5xxserver_errorایک غیر متوقع سرور سائیڈ کی ناکامی۔بیک آف کے ساتھ دوبارہ کوشش کریں؛ اگر مستقل ہو تو مدد سے رابطہ کریں۔

دوبارہ کوشش کرنے کی تجویز کردہ پالیسی

دوبارہ کوشش نہ کریں۔ 401, 402, or 404 خود بخود عارضی کے لیے 5xx جوابات، jitter اور ایک سخت دوبارہ کوشش کیپ کے ساتھ ایکسپونینشل بیک آف کا استعمال کریں۔ کبھی بھی بغیر کسی حد کے دوبارہ کوشش کرنے کا لوپ نہ بنائیں کیونکہ ہر منظور شدہ تصدیق شدہ درخواست کریڈٹ استعمال کر سکتی ہے۔

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);

ازگر

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'])

پی ایچ پی

$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);

ڈارٹ / پھڑپھڑانا

فلٹر ایپلیکیشن کے اندر Wordly کلید نہ بھیجیں۔ مثال ایک بھروسہ مند ڈارٹ بیک اینڈ یا سرور فنکشن سے تعلق رکھتی ہے۔

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']);
}

پروڈکشن چیک لسٹ

  • پراکسی ورڈلی ایک بھروسہ مند بیک اینڈ کے ذریعے درخواست کرتا ہے۔
  • کنکشن اور رسپانس ٹائم آؤٹ سیٹ کریں۔
  • سنبھالنا 401, 402, 404, and 5xx الگ سے
  • Query GET /v1/account when your application needs the current balance.
  • لاگ اینڈ پوائنٹ، اسٹیٹس، لیٹینسی، اور request_id API کلید کو لاگ ان کیے بغیر۔
  • ماحول کے مطابق الگ الگ کلیدیں استعمال کریں اور انہیں وقفے وقفے سے گھمائیں۔
  • Cache stable vocabulary responses in your backend when appropriate.

اپنی پہلی درخواست کرنے کے لیے تیار ہیں؟

ایک اکاؤنٹ بنائیں، اپنے ای میل کی تصدیق کریں، اور 50 مفت کریڈٹ حاصل کریں۔

مفت اکاؤنٹ بنائیں

انضمام کی مدد کی ضرورت ہے؟ ای میل [email protected].