वर्डली एपीआई के साथ निर्माण करें।
सर्वर-साइड एपीआई कुंजी का उपयोग करें, HTTPS अनुरोध करें और पूर्वानुमानित क्रेडिट-आधारित बिलिंग मॉडल के माध्यम से प्रत्येक कॉल को ट्रैक करें। यह संदर्भ वर्तमान में उत्पादन में उपलब्ध समापन बिंदुओं का दस्तावेजीकरण करता है और स्पष्ट रूप से उन समापन बिंदुओं को चिह्नित करता है जो अभी भी तैयार किए जा रहे हैं।
त्वरित शुरुआत
एक मुफ़्त खाता बनाएं, छह अंकों के कोड का उपयोग करके अपना ईमेल सत्यापित करें, और अपने डेवलपर डैशबोर्ड में दिखाई गई एपीआई कुंजी को एक बार कॉपी करें।
- 1एक खाता बनाएं
केवल एक ईमेल पते और पासवर्ड के साथ पंजीकरण करें।
- 2अपना ईमेल सत्यापित करें
द्वारा भेजा गया कोड दर्ज करें
[email protected]. Verification grants 50 free credits. - 3अपनी API कुंजी संग्रहीत करें
जेनरेट की गई प्रतिलिपि बनाएँ
wly_live_...कुंजी और इसे सर्वर-साइड वातावरण चर में रखें। - 4एक परीक्षण अनुरोध करें
प्रमाणीकरण सत्यापित करने और शेष शेष राशि देखने के लिए खाता समापन बिंदु पर कॉल करें।
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 से परोसे जाते हैं:
https://api.wordlyenglish.com/v1प्रतिक्रिया या व्यवहार परिवर्तन को तोड़ने के लिए एक नए पथ संस्करण का उपयोग किया जाएगा। एडिटिव फ़ील्ड्स को भीतर पेश किया जा सकता है v1, so clients should ignore response properties they do not recognize.
प्रमाणीकरण
प्रमाणित समापन बिंदुओं को HTTP में एक एपीआई कुंजी की आवश्यकता होती है Authorization बियरर योजना का उपयोग करते हुए हेडर।
Authorization: Bearer wly_live_your_api_keyब्राउज़र जावास्क्रिप्ट, सार्वजनिक गिट रिपॉजिटरी, स्क्रीनशॉट, लॉग या वितरित मोबाइल एप्लिकेशन में कभी भी लाइव कुंजी न रखें। अपने बैकएंड से वर्डली एपीआई को कॉल करें और अपने स्वयं के एप्लिकेशन को उस बैकएंड के साथ संचार करने दें।
स्थानीयकृत एपीआई संदेश
प्रतिक्रिया भाषा को इसके साथ सेट करें ?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/status | 0 | जियो |
GET /v1/account | 0 | जियो |
GET /v1/words/{word} | 1–5 | जियो |
GET /v1/words/search | 1 | जियो |
GET /v1/words/random | 1 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 और ऑपरेशन की प्रक्रिया नहीं करता है.
{
"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
विकास, स्टेजिंग और उत्पादन के लिए अलग-अलग कुंजियाँ बनाएँ। वर्डली प्रत्येक कुंजी का केवल एक क्रिप्टोग्राफ़िक हैश संग्रहीत करता है; संपूर्ण मान निर्माण के समय एक बार प्रदर्शित होता है।
- परिवेश या सेवा के अनुसार कुंजियाँ नाम दें.
- पर्यावरण चर या प्रबंधित गुप्त स्टोर का उपयोग करें।
- यदि कोई कुंजी उजागर हो गई हो तो उसे तुरंत रद्द करें।
- पुराने मानों का पुन: उपयोग किए बिना कुंजियाँ घुमाएँ।
- क्वेरी स्ट्रिंग में कुंजियाँ न भेजें.
प्रतिक्रिया स्वरूप
सफल प्रतिक्रियाएँ शीर्ष-स्तर का उपयोग करती हैं data वस्तु और इसमें एक शामिल हो सकता है 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.
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जियोसार्वजनिक सेवा स्वास्थ्य और एपीआई संस्करण की जानकारी लौटाता है। इस समापन बिंदु को प्रमाणीकरण की आवश्यकता नहीं है और इसकी लागत शून्य क्रेडिट है।
उदाहरण अनुरोध
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.
हेडर
| नाम | आवश्यक | विवरण |
|---|---|---|
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" }
}शब्दावली समापनबिंदु
प्रत्येक रिकार्ड इसकी रिपोर्ट करता है 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 समर्थित इंटरफ़ेस और एपीआई-संदेश स्थान लौटाता है। शब्दावली अनुवाद केवल तभी लौटाए जाते हैं जब उपलब्ध हों। यह समापन बिंदु सार्वजनिक है और इसकी लागत शून्य क्रेडिट है।
दर सीमा
प्रत्येक एपीआई कुंजी प्रति रोलिंग मिनट में 120 स्वीकृत अनुरोधों तक सीमित है। प्रतिक्रियाओं में शामिल हैं X-RateLimit-Limit और X-RateLimit-Remaining. A 429 rate_limit_exceeded प्रतिक्रिया शामिल है 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
| नाम | Type | आवश्यक | Rules | विवरण |
|---|---|---|---|---|
lang | string | No | Supported locale code | Language 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" }
}/v1/words/{word}Live · 1–5 creditsReturns one exact vocabulary record. Catalog and translated records cost 1 credit; enriched records cost 5 credits.
Parameters
| नाम | Location | Type | आवश्यक | Rules and meaning |
|---|---|---|---|---|
word | Path | string | हाँ | 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. |
उदाहरण अनुरोध
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/searchलाइव · 1 क्रेडिटSearches active vocabulary in alphabetical order. Use the returned cursor for stable forward pagination.
Query parameters
| नाम | Type | आवश्यक | Default / limit | विवरण |
|---|---|---|---|---|
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. |
उदाहरण अनुरोध
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
| नाम | Type | आवश्यक | Default / limit | विवरण |
|---|---|---|---|---|
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. |
उदाहरण अनुरोध
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.
हेडर
| नाम | आवश्यक | Value |
|---|---|---|
Authorization | हाँ | Bearer wly_live_... |
Content-Type | हाँ | application/json |
Accept | अनुशंसित | application/json |
JSON body
| Field | Type | आवश्यक | Rules | विवरण |
|---|---|---|---|---|
words | string[] | हाँ | 1–50 items; each max 120 chars | Words to resolve; duplicates are normalized and removed. |
languages | string[] | No | Supported locale codes | Translations 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" }
}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 | विवरण |
|---|---|---|---|
id | string | No | Stable URL-safe slug. |
word | string | No | Canonical English word. |
part_of_speech | string | हाँ | Grammatical class. |
level | string | हाँ | Learning difficulty or catalog level. |
definition | string | हाँ | Concise English definition. |
example | string | हाँ | Natural example sentence. |
phonetic | string | हाँ | 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 | हाँ | Learning image URL. |
media.audio_url | URL string | हाँ | Pronunciation audio URL. |
media.attribution | object | No | Required media attribution metadata. |
completeness | enum | No | catalog, translated, or enriched. |
Meta object
| Field | Type | When present | विवरण |
|---|---|---|---|
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 | विवरण |
|---|---|---|
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. |
त्रुटियाँ
| HTTP | कोड | मतलब | ग्राहक कार्रवाई |
|---|---|---|---|
| 401 | invalid_api_key | गुम, विकृत, निरस्त, या निष्क्रिय कुंजी। | बियरर हेडर की जाँच करें या कुंजी बदलें। |
| 402 | credits_exhausted | खाते में परिचालन के लिए क्रेडिट का अभाव है। | पुनः प्रयास रोकें और ग्राहक को बिलिंग के लिए निर्देशित करें। |
| 404 | not_found | अनुरोधित समापन बिंदु उपलब्ध नहीं है. | पथ और एपीआई संस्करण की जाँच करें। |
| 404 | word_not_found | अनुरोधित शब्दावली प्रविष्टि अनुपलब्ध है. | वर्तनी जांचें या खोज का उपयोग करें. |
| 422 | invalid_request | कोई पैरामीटर या बैच बॉडी अमान्य है. | पुनः प्रयास करने से पहले अनुरोध को ठीक करें। |
| 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 | एपीआई कुंजी प्रति मिनट 120 अनुरोधों से अधिक हो गई। | Wait for Retry-After. |
| 5xx | server_error | एक अप्रत्याशित सर्वर-साइड विफलता. | बैकऑफ़ के साथ पुनः प्रयास करें; यदि लगातार हो तो समर्थन से संपर्क करें। |
अनुशंसित पुनः प्रयास नीति
पुनः प्रयास न करें 401, 402, or 404 स्वचालित रूप से. क्षणिक के लिए 5xx प्रतिक्रियाएँ, घबराहट और एक सख्त पुनः प्रयास सीमा के साथ घातीय बैकऑफ़ का उपयोग करें। कभी भी अनबाउंड रिट्री लूप न बनाएं क्योंकि प्रत्येक स्वीकृत प्रमाणित अनुरोध क्रेडिट का उपभोग कर सकता है।
जावास्क्रिप्ट / नोड.जे.एस
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);डार्ट/फड़फड़ाहट
फ़्लटर एप्लिकेशन के अंदर वर्डली कुंजी न भेजें। उदाहरण एक विश्वसनीय डार्ट बैकएंड या सर्वर फ़ंक्शन से संबंधित है।
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, and5xxअलग से. - Query
GET /v1/accountwhen your application needs the current balance. - लॉग एंडपॉइंट, स्थिति, विलंबता, और
request_idएपीआई कुंजी लॉग किए बिना। - प्रत्येक परिवेश के लिए अलग-अलग कुंजियों का उपयोग करें और उन्हें समय-समय पर घुमाएँ।
- Cache stable vocabulary responses in your backend when appropriate.
क्या आप अपना पहला अनुरोध करने के लिए तैयार हैं?
एक खाता बनाएं, अपना ईमेल सत्यापित करें और 50 निःशुल्क क्रेडिट प्राप्त करें।
एकीकरण सहायता की आवश्यकता है? ईमेल [email protected].