Swedish Text-to-Speech API: sv_SE Voice to MP3
You need to turn Swedish text into an MP3 you can stream or download, and you want an API call you can ship today. By the end of this guide you’ll authenticate, post a request with language=sv_SE, and read the MP3 URL from the response so you can play it in your app or store it on your backend.
What you’ll build
You’ll wire up a single API call that converts Swedish (sv_SE) text to an MP3 file. The Woord API returns a direct MP3 URL you can use immediately in a media player, send to clients, or cache on your CDN.
- Authentication: Bearer API key from your account.
- Request: POST a convert call with form field language=sv_SE and your text.
- Response: Parse the convert envelope and read audio_src (the MP3 URL).
If the official sample below shows a different language or content, simply set language=sv_SE to synthesize Swedish instead.
Plan and trial details you actually need
You can start with an 8-day trial, which includes 20k characters. The free tier cannot call the convert endpoint, so to execute the request below you’ll need to start the trial or use a paid plan. The Starter plan is $9.99/mo. If you only need to evaluate, activate the trial and you’re good to go.
End-to-end setup
1) Create your account and get a key
Register for your trial here: Register. After sign-up, copy your Bearer API key from the dashboard.
2) Send your first convert call
Use the official request below. It already shows the correct convert envelope and how to pass your API key. Make sure the form field language is set to sv_SE to request Swedish audio.
curl "https://www.getwoord.com/api/convert" -X POST -H "Authorization: Bearer YOUR_KEY" --data "text=Hello+World&gender_voice=male&language=sv_SE&speakingRate=1.00"
When the request succeeds, the response includes the MP3 URL. You’ll read it from audio_src.
3) Handle the response
The official JSON structure for the convert endpoint is shown here. You’ll primarily use audio_src (the MP3 URL). If there is a success flag, check it first. If success is false or audio_src is missing or empty, treat it as a failed synthesis and surface the error to logs and the caller.
{"message":"Your audio has been created!","audio_src":"https://getwoord.s3.amazonaws.com/4273352455515882618255eaaf3c1cbdbe0.55443890.mp3","error":false}
A working curl you can copy
Below is a complete curl you can run. Replace YOUR_API_KEY with your Bearer token. If the sample above uses a different language, set language=sv_SE here to request Swedish.
curl -X POST "USE_THE_SAME_URL_AS_IN_THE_OFFICIAL_SAMPLE" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "language=sv_SE" \
--data-urlencode "text=Hej! Det här är ett svenskt text-till-tal-exempel."
This is functionally equivalent to the official sample request shown earlier. The only required form field for language selection is language=sv_SE, and the text field contains the content to synthesize.
One minimal client example
The snippet below performs the same request in Python. Use the same endpoint URL that appears in the official curl sample above.
import os
import requests
API_KEY = os.getenv("WOORD_API_KEY", "YOUR_API_KEY")
URL = "USE_THE_SAME_URL_AS_IN_THE_OFFICIAL_SAMPLE" # Same URL as in the curl above
data = {
"language": "sv_SE",
"text": "Hej! Det här är ett svenskt text-till-tal-exempel."
}
headers = {
"Authorization": f"Bearer {API_KEY}"
}
resp = requests.post(URL, data=data, headers=headers, timeout=60)
resp.raise_for_status()
payload = resp.json()
# Typical handling: check success flag (if present) and read audio_src
# The convert response includes the MP3 URL in audio_src.
success = payload.get("success", True) # Some envelopes include 'success'
if not success:
# Prefer a vendor-provided error field if present; fall back to generic
msg = payload.get("message") or payload.get("error") or "Synthesis failed"
raise RuntimeError(f"Woord convert failed: {msg}")
audio_src = None
# audio_src may live at top-level or inside a data object, depending on envelope.
if "audio_src" in payload:
audio_src = payload["audio_src"]
elif isinstance(payload.get("data"), dict):
audio_src = payload["data"].get("audio_src")
if not audio_src:
raise RuntimeError("No audio_src in response. Check request or quota.")
print("MP3 URL:", audio_src)
# You can stream or download the MP3 using 'audio_src' now.
Field-by-field: what you’ll use and what to check
The convert response contains the “official convert envelope” for Woord. You’ll rely on:
- audio_src: A URL string pointing to the generated MP3. This is the value you stream, download, or cache.
- success (if present): Boolean indicating whether the conversion completed as requested. Always check it before reading audio_src.
- message or error (if present): Human-readable context when success is false or when fields are missing.
Operational guidance:
- Missing values: If audio_src is null, empty, or absent, treat the request as failed and log the associated error field if present.
- Retries: Only retry idempotently when the response indicates a transient issue. Avoid blind retry loops that could duplicate traffic.
- Caching: Cache audio_src results keyed by a stable hash of (language, text) if your content is repeated. This saves quota and improves latency.
- Content size: Your trial includes 20k characters. If you handle large strings, consider splitting text into logical chunks and concatenating audio on your side if needed.
Go-live checklist
- Register (8-day trial).
- Copy the Bearer key from your account dashboard.
- POST convert with language=sv_SE and your text content.
- Read audio_src from the response and use it as the MP3 URL in your app.
Production tips that save time
- Error surfaces: Always surface vendor messages in logs when success=false so you can quickly diagnose authentication issues, exhausted characters, or invalid parameters.
- Timeouts: Pick a reasonable client timeout. Synthesis time scales with text length; don’t set an overly aggressive timeout that aborts legitimate work.
- MP3 handling: Treat audio_src as a regular HTTPS resource. If you download and store the MP3, persist a content hash to avoid duplicate storage for identical text.
- Observability: Record the language and text length with each request so you can correlate spikes in usage to specific workloads.
Frequently asked questions
How do I request Swedish specifically?
Set the form field language=sv_SE in your convert call.
Do I need a paid plan to call convert?
The free tier cannot call convert. Use the 8-day trial (20k characters) or a paid plan.
Where is the MP3 in the response?
Read the audio_src field from the convert response envelope. That URL is your MP3.
What if the official sample shows a different language?
Keep everything else the same and change language to sv_SE. The endpoint and response structure remain the same.
How should I handle failures?
Check a success flag if present. If success=false or audio_src is missing, read the message/error field, log it, and return an appropriate error to callers. Retry only on transient errors.
Next steps
Spin up your trial and ship a Swedish voice in minutes. Start here to get your key and run the convert sample: Register. For deeper details on parameters and the convert envelope, see the Documentation.
