สร้างด้วย Wordly API
ใช้คีย์ API ฝั่งเซิร์ฟเวอร์ สร้างคำขอ HTTPS และติดตามทุกการโทรผ่านรูปแบบการเรียกเก็บเงินตามเครดิตที่คาดการณ์ได้ ข้อมูลอ้างอิงนี้บันทึกตำแหน่งข้อมูลที่มีอยู่ในการผลิตในปัจจุบัน และทำเครื่องหมายตำแหน่งข้อมูลอย่างชัดเจนที่ยังคงถูกจัดเตรียมไว้
เริ่มต้นอย่างรวดเร็ว
สร้างบัญชีฟรี ยืนยันอีเมลของคุณโดยใช้รหัสหกหลัก และคัดลอกคีย์ API ที่แสดงครั้งเดียวในแดชบอร์ดนักพัฒนาซอฟต์แวร์ของคุณ
- 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 ฐานและการกำหนดเวอร์ชัน
จุดสิ้นสุดการใช้งานจริงทั้งหมดให้บริการจาก URL พื้นฐานที่มีเวอร์ชันต่อไปนี้:
https://api.wordlyenglish.com/v1การตอบสนองที่ไม่สมบูรณ์หรือการเปลี่ยนแปลงพฤติกรรมจะใช้เวอร์ชันเส้นทางใหม่ อาจมีการแนะนำช่องเพิ่มเติมภายใน v1, so clients should ignore response properties they do not recognize.
การรับรองความถูกต้อง
ตำแหน่งข้อมูลที่ได้รับการตรวจสอบสิทธิ์ต้องใช้คีย์ API ใน HTTP Authorization ส่วนหัวโดยใช้โครงการ Bearer
Authorization: Bearer wly_live_your_api_keyห้ามวางคีย์สดใน 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/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
สร้างคีย์แยกต่างหากสำหรับการพัฒนา การจัดเตรียม และการใช้งานจริง Wordly เก็บเฉพาะแฮชการเข้ารหัสลับของแต่ละคีย์ ค่าที่สมบูรณ์จะแสดงครั้งเดียวเมื่อสร้าง
- คีย์ชื่อตามสภาพแวดล้อมหรือบริการ
- ใช้ตัวแปรสภาพแวดล้อมหรือที่เก็บความลับที่มีการจัดการ
- เพิกถอนคีย์ทันทีหากคีย์อาจถูกเปิดเผย
- หมุนคีย์โดยไม่ใช้ค่าเก่าซ้ำ
- อย่าส่งคีย์ในสตริงการสืบค้น
รูปแบบการตอบกลับ
การตอบกลับที่ประสบความสำเร็จจะใช้ระดับบนสุด 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สดส่งคืนข้อมูลสถานภาพบริการสาธารณะและเวอร์ชัน API ตำแหน่งข้อมูลนี้ไม่ต้องการการรับรองความถูกต้องและมีค่าใช้จ่ายเป็นศูนย์เครดิต
ตัวอย่างคำขอ
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
ส่งคืนอินเทอร์เฟซที่รองรับและตำแหน่งข้อความ API ทั้งหมด 30 รายการ การแปลคำศัพท์จะถูกส่งกลับเมื่อมีให้เท่านั้น ตำแหน่งข้อมูลนี้เป็นสาธารณะและมีค่าใช้จ่ายเป็นศูนย์เครดิต
ขีดจำกัดอัตรา
คีย์ API แต่ละรายการจำกัดคำขอที่ยอมรับได้ 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 | คีย์หายไป มีรูปแบบไม่ถูกต้อง ถูกเพิกถอน หรือไม่ใช้งาน | ตรวจสอบส่วนหัวของ Bearer หรือเปลี่ยนกุญแจ |
| 402 | credits_exhausted | บัญชีขาดเครดิตสำหรับการดำเนินงาน | หยุดลองอีกครั้งและนำลูกค้าไปที่การเรียกเก็บเงิน |
| 404 | not_found | ปลายทางที่ร้องขอไม่พร้อมใช้งาน | ตรวจสอบเส้นทางและเวอร์ชัน API |
| 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 | คีย์ API เกิน 120 คำขอต่อนาที | Wait for Retry-After. |
| 5xx | server_error | ความล้มเหลวฝั่งเซิร์ฟเวอร์ที่ไม่คาดคิด | ลองอีกครั้งโดยถอยกลับ ติดต่อฝ่ายสนับสนุนหากยังคงมีอยู่ |
นโยบายการลองใหม่ที่แนะนำ
อย่าลองอีกครั้ง 401, 402, or 404 โดยอัตโนมัติ สำหรับชั่วคราว 5xx การตอบกลับ ให้ใช้การถอยกลับแบบเอกซ์โปเนนเชียลโดยมีการกระวนกระวายใจและจำกัดการลองใหม่อย่างเข้มงวด อย่าสร้างการวนซ้ำแบบไม่มีขอบเขต เนื่องจากคำขอตรวจสอบสิทธิ์ที่ยอมรับแต่ละรายการอาจใช้เครดิต
จาวาสคริปต์ / 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'])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);โผ / กระพือ
อย่าจัดส่งคีย์ Wordly ภายในแอปพลิเคชัน Flutter ตัวอย่างนี้อยู่ในแบ็กเอนด์ Dart หรือฟังก์ชันเซิร์ฟเวอร์ที่เชื่อถือได้
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']);
}รายการตรวจสอบการผลิต
- Proxy Wordly ร้องขอผ่านแบ็กเอนด์ที่เชื่อถือได้
- ตั้งค่าการหมดเวลาการเชื่อมต่อและการตอบสนอง
- มือจับ
401,402,404, and5xxแยกกัน - Query
GET /v1/accountwhen your application needs the current balance. - บันทึกปลายทาง สถานะ เวลาแฝง และ
request_idโดยไม่ต้องบันทึกคีย์ API - ใช้คีย์แยกกันตามสภาพแวดล้อมและหมุนเวียนคีย์เป็นระยะ
- Cache stable vocabulary responses in your backend when appropriate.
พร้อมที่จะส่งคำขอแรกของคุณแล้วหรือยัง?
สร้างบัญชี ยืนยันอีเมลของคุณ และรับ 50 เครดิตฟรี
ต้องการความช่วยเหลือในการบูรณาการหรือไม่? อีเมล [email protected].