01 — Quick Start

Make Your First API Call

Copy this curl command, swap in your API key and target language, and you have a fully dubbed audio file in under two seconds.

Request — cURL
curl -X POST https://neximedia.ai/api/dub \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "text": "Hello world",
    "source_lang": "EN",
    "target_lang": "ES"
  }'
Response — 200 OK
{
  "translated_text": "Hola mundo",
  "audio":           "<base64-encoded MP3>",
  "duration_seconds": 1.2,
  "voice_cloned":    false,
  "used":            1,
  "limit":           60,
  "plan":            "pro"
}
No key yet? Demo mode allows 3 requests/day without authentication — just omit the Authorization header. See rate limits by plan.
02 — Endpoint Reference

Endpoints

POST /api/dub

Translate text to a target language, synthesize speech, and optionally clone a provided voice — all in one request. Returns translated text and a base64-encoded MP3.

Request Body
Parameter Type Required Description
text string required Source text to translate and dub. Max 2,000 characters.
source_lang string optional Source language code. Default: EN. One of: EN FR ES DE PT AR HI ZH ID JA
target_lang string required Target language code. Same options as source_lang.
audio_b64 string optional Base64-encoded audio for voice cloning. WebM/Opus format. Record 5–10 seconds of clear speech. When provided, the response will use your voice for synthesis and return "voice_cloned": true.
GET /health

Health check. Returns pipeline status and current API version. No authentication required.

{ "status": "ok", "version": "1.0.0" }
02b — Error Codes

HTTP Error Reference

StatusMeaningAction
200 OK Request successful. Read audio, play or save the MP3.
422 Unprocessable text is empty, exceeds 2,000 chars, or an invalid language code was supplied. Validate input before sending. Check the detail field in the response body.
429 Rate Limited Request quota exceeded for your plan. Check response headers: X-RateLimit-Limit and X-RateLimit-Reset (Unix timestamp). Retry after reset.
503 Quota Reached Monthly synthesis quota exhausted. Contact our team to upgrade your plan.
500 Pipeline Error Temporary failure in translation or synthesis backend. Retry after 5 seconds with exponential backoff. Usually self-resolves.
03 — Voice Cloning

Cloning Your Voice in the Browser

Use the MediaRecorder API to capture 5–10 seconds of audio, convert it to base64, then pass it as audio_b64. The pipeline will clone your voice and synthesize the dubbed audio in your timbre.

Format requirement: WebM with Opus codec (audio/webm;codecs=opus). Most Chromium-based browsers support this natively. Safari uses AAC — convert server-side if needed.
JavaScript — MediaRecorder Voice Capture
// 1. Request mic access
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });

// 2. Set up recorder (WebM/Opus)
const recorder = new MediaRecorder(stream, {
  mimeType: 'audio/webm;codecs=opus'
});
const chunks = [];

recorder.ondataavailable = e => chunks.push(e.data);

// 3. When done — build base64 and send
recorder.onstop = async () => {
  const blob = new Blob(chunks, { type: 'audio/webm' });
  const b64  = await blobToBase64(blob);

  // Include as audio_b64 in your /api/dub request
  const res = await fetch('https://neximedia.ai/api/dub', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${YOUR_API_KEY}`
    },
    body: JSON.stringify({
      text: 'Hello world',
      source_lang: 'EN',
      target_lang: 'ES',
      audio_b64: b64
    })
  });
  const data = await res.json();
};

// 4. Record for 8 seconds
recorder.start();
setTimeout(() => recorder.stop(), 8000);

// Helper
function blobToBase64(blob) {
  return new Promise(r => {
    const fr = new FileReader();
    fr.onload = () => r(fr.result.split(',')[1]);
    fr.readAsDataURL(blob);
  });
}
04 — Audio Playback

Playing Back the Dubbed Audio

The audio field in the response is a base64-encoded MP3. Play it directly in the browser or write it to disk in Node.js.

Browser — Play inline
const audio = new Audio('data:audio/mpeg;base64,' + data.audio);
audio.play();
Node.js — Save to disk
import fs from 'fs';

const audioBuffer = Buffer.from(data.audio, 'base64');
fs.writeFileSync('output.mp3', audioBuffer);
// output.mp3 is now a valid MP3 file
05 — Rate Limits

Rate Limits by Plan

All limits are enforced server-side. Remaining quota is returned in every response as used and limit fields.

Plan Limit Window API Key Voice Cloning
Demo free 3 requests Per day, per IP Not required Not included
Free free 3 requests Per day Required Not included
Pro $29/mo 60 requests Per month Required Included
Business $99/mo 300 requests Per month Required Included + priority queue
Rate limit headers: When you hit a 429, check X-RateLimit-Limit (your plan ceiling) and X-RateLimit-Reset (Unix timestamp for when the window resets).

API key required for Free, Pro, and Business plans. Apply for early access to receive your key.

06 — Languages

Supported Languages

Ten languages at launch, expanding to 30 in Q2 2026. Each language has a dedicated ElevenLabs voice model tuned for naturalness.

Code Language Native Name ElevenLabs Voice
ENEnglishEnglishRachel (multilingual)
FRFrenchFrançaisCharlotte (multilingual)
ESSpanishEspañolMatilda (multilingual)
DEGermanDeutschCallum (multilingual)
PTPortuguesePortuguêsBella (multilingual)
ARArabicالعربيةAria (multilingual)
HIHindiहिन्दीDomi (multilingual)
ZHChinese (Mandarin)中文Elli (multilingual)
IDIndonesianBahasa IndonesiaJosh (multilingual)
JAJapanese日本語Drew (multilingual)
07 — Authentication

API Keys & Authentication

All authenticated requests use Bearer token authentication. Tokens are Supabase JWTs issued when your account is approved.

Authorization Header
Authorization: Bearer YOUR_API_KEY
Early access: API keys are issued manually during our controlled launch. Apply at the waitlist and select "Developer access" — approved accounts receive their key within 24 hours.
Apply for Early API Access
08 — Changelog

API Changelog

v1.0.0 2026-03-11 Initial public launch. 10 languages (EN, FR, ES, DE, PT, AR, HI, ZH, ID, JA). Voice cloning via audio_b64. Three-tier synthesis fallback (ElevenLabs → gTTS → silent). Full rate limit headers. Demo mode (no key, 3/day).