Wordly API を使用して構築します。
サーバー側 API キーを使用し、HTTPS リクエストを作成し、予測可能なクレジットベースの請求モデルを通じてすべての通話を追跡します。このリファレンスには、実稼働環境で現在利用可能なエンドポイントが文書化されており、まだ準備中のエンドポイントが明確にマークされています。
クイックスタート
無料アカウントを作成し、6 桁のコードを使用して電子メールを認証し、開発者ダッシュボードに一度表示された API キーをコピーします。
- 1アカウントを作成する
メールアドレスとパスワードのみでご登録いただけます。
- 2メールアドレスを確認してください
から送られてきたコードを入力してください
[email protected]. Verification grants 50 free credits. - 3API キーを保存する
生成されたものをコピーする
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.
認証
認証されたエンドポイントには HTTP の API キーが必要です 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 回のリクエストで 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 キーは、ローリング 1 分あたり受け入れられるリクエストの数が 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 キーが 1 分あたり 120 リクエストを超えました。 | Wait for Retry-After. |
| 5xx | server_error | 予期しないサーバー側の障害。 | バックオフを使用して再試行します。解決しない場合はサポートにお問い合わせください。 |
推奨される再試行ポリシー
再試行しないでください 401, 402, or 404 自動的に。過渡用 5xx 応答には、ジッターと厳格な再試行制限を伴う指数バックオフを使用します。承認された認証リクエストごとにクレジットが消費される可能性があるため、無制限の再試行ループを作成しないでください。
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'])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']);
}製作チェックリスト
- Wordly リクエストは信頼できるバックエンドを通じてプロキシされます。
- 接続と応答のタイムアウトを設定します。
- ハンドル
401,402,404, and5xx別に。 - Query
GET /v1/accountwhen your application needs the current balance. - エンドポイント、ステータス、遅延、および
request_idAPI キーをログに記録しないでください。 - 環境ごとに個別のキーを使用し、定期的にローテーションします。
- Cache stable vocabulary responses in your backend when appropriate.
最初のリクエストをする準備はできましたか?
アカウントを作成し、メールアドレスを認証すると、50 クレジットを無料で受け取ります。
統合に関するサポートが必要ですか?電子メール [email protected].