Audio
Retrieve the pronunciation audio for a dictionary entry. This endpoint returns a 302 redirect to the audio file on our CDN.
GET /api/v1/audio/{source}/{lexid}
Path Parameters
| Parameter | Type | Description |
|---|---|---|
source | string | The dictionary ID. |
lexid | string | The entry ID (same as id in search/entry responses). |
Response
Unlike other endpoints, this does not return JSON. Instead, it issues a 302 Found redirect to the audio file URL on our content delivery network. Your HTTP client should follow redirects automatically.
Example Request
curl -L -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.shobdo.me/api/v1/audio/DICTIONARY_ID/42" \
--output pronunciation.spxThe -L flag tells curl to follow the redirect.
Supported Formats
Audio files are served in Speex (.spx) or MP3 (.mp3) format depending on the dictionary. The format is indicated by the file extension in the redirect URL.
Embedding in HTML
If you are building a web application, you can use the audioUrl field from the Entry response directly:
<!-- Using the audioUrl from the Entry response -->
<audio controls>
<source src="AUDIO_URL_FROM_ENTRY" />
Your browser does not support the audio element.
</audio>// JavaScript
const audio = new Audio(entry.audioUrl);
audio.play();