API Documentation
Vocabulary Audio API Reference
Overview
Get R2 URLs for word pronunciation audio
POST words to get their audio URLs. Audio is generated on-demand using Azure Text-to-Speech and cached permanently in Cloudflare R2.
Supported Languages
| Code | Language | Voice |
|---|---|---|
| en | English | en-US-JennyNeural |
| zh-cn | Simplified Chinese | zh-CN-XiaoxiaoNeural |
| zh-tw | Traditional Chinese | zh-TW-HsiaoChenNeural |
| ko | Korean | ko-KR-SunHiNeural |
| ja | Japanese | ja-JP-NanamiNeural |
Get Audio URLs
POST/api/audio
Request Body
{
"lang": "en",
"words": ["hello", "world"],
"key": "YOUR_API_KEY"
}lang- Language code (en, zh-cn, zh-tw, ko, ja)words- Single word or array (max 50, each max 100 chars)key- API key (required)
Response
{
"lang": "en",
"results": [
{ "word": "hello", "url": "https://r2-domain.com/en/hello.mp3" },
{ "word": "world", "url": "https://r2-domain.com/en/world.mp3" }
],
"requestId": "uuid"
}Example
curl -X POST "https://vocabulary-audio-service.loveyouall.qzz.io/api/audio" \
-H "Content-Type: application/json" \
-d '{"lang":"en","words":["hello","world"],"key":"YOUR_API_KEY"}'Try It
Test the API directly
Node.js Example
const response = await fetch("https://vocabulary-audio-service.loveyouall.qzz.io/api/audio", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
lang: "en",
words: ["hello", "world"],
key: "YOUR_API_KEY"
})
});
const data = await response.json();
// { lang: "en", results: [{ word: "hello", url: "https://..." }, ...], requestId: "..." }
for (const item of data.results) {
console.log(`${item.word}: ${item.url}`);
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_LANG | Unsupported language code |
| 400 | EMPTY_WORDS | No words provided |
| 400 | TOO_MANY_WORDS | Exceeds 50 word limit |
| 401 | UNAUTHORIZED | Invalid or missing API key |