Shobdo Logo

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

ParameterTypeDescription
sourcestringThe dictionary ID.
lexidstringThe 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.spx

The -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();

Availability

Check Before Requesting

Not all entries have audio. Check the hasAudio field in search results or entry responses before making audio requests. Requesting audio for an entry without it returns:

{
  "ok": false,
  "error": "No audio found"
}

Assistant

Hi! I'm the Shobdo Assistant.
Ask me anything about the documentation.