Developer API key
Tích hợp public dùng API key do user tự tạo trong Dashboard Settings. Secret chỉ hiển thị một lần, backend chỉ lưu hash và prefix.
Developer docs
Danh sách endpoint dành cho người dùng thông thường và tích hợp bằng Developer API key: realtime transcript, call room, audio/video transcript, tạo giọng đọc, OCR ảnh và cloud transcript. Free account chỉ test key/quota; API tính năng yêu cầu tài khoản đã trả phí và sử dụng quota của tài khoản đó.
Tích hợp public dùng API key do user tự tạo trong Dashboard Settings. Secret chỉ hiển thị một lần, backend chỉ lưu hash và prefix.
Mỗi request /api/v1/* map về user sở hữu key, kiểm scope, rate limit theo key và dùng quota hiện có của tài khoản đó.
Tài khoản free chỉ dùng API key để test /api/v1/me và /api/v1/quota. Các API tính năng yêu cầu tài khoản đã trả phí và còn thời lượng.
Key có thể giới hạn theo realtime, call, media, image, tts và transcript. Endpoint thiếu scope sẽ trả 403.
Realtime và call không dùng API key trực tiếp trên URL. Client gọi /api/v1/realtime/ws-ticket để lấy ticket ngắn hạn rồi mở WebSocket.
Integration flow
User vào Dashboard Settings, tạo Developer API key, chọn scope cần thiết và lưu secret ngay khi được hiển thị.
Gửi Authorization: Bearer aud_sk_... hoặc X-API-Key: aud_sk_... cho REST API. Dùng multipart/form-data cho upload file.
Gọi GET /api/v1/quota để đọc developerApi.access, developerApi.featureApiAvailable, remainingSeconds và activeSubscription trước khi chạy realtime, tạo giọng đọc hoặc xử lý file lớn.
Gọi POST /api/v1/realtime/ws-ticket bằng API key có scope realtime, sau đó mở /ws/proxy bằng ticket ngắn hạn.
Tôn trọng 401 khi thiếu key, 402 khi tài khoản free chưa được dùng API tính năng, 403 khi thiếu scope/hết quota, 409 khi job chưa xong, 413 khi file quá lớn và 429 khi vượt giới hạn.
Không hard-code API key trong browser bundle. Nếu web frontend cần gọi API, đặt backend trung gian để giữ key và kiểm quyền người dùng cuối.
Security baseline
Examples
Ví dụ dùng Developer API key. Không hard-code key trong browser bundle hoặc ứng dụng public.
const API_KEY = process.env.AUDIODICH_API_KEY;
async function getQuota() {
const res = await fetch('https://audiodich.io.vn/api/v1/quota', {
headers: { Authorization: `Bearer ${API_KEY}` }
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}const API_KEY = process.env.AUDIODICH_API_KEY;
async function openRealtimeSocket() {
const ticketRes = await fetch('https://audiodich.io.vn/api/v1/realtime/ws-ticket', {
method: 'POST',
headers: { Authorization: `Bearer ${API_KEY}` }
});
if (!ticketRes.ok) throw new Error(await ticketRes.text());
const { ticket } = await ticketRes.json();
const ws = new WebSocket(`wss://audiodich.io.vn/ws/proxy?token=${encodeURIComponent(ticket)}`);
ws.addEventListener('open', () => {
ws.send(JSON.stringify({
audio_format: 'pcm_s16le',
sample_rate: 16000,
num_channels: 1,
language_hints: ['vi', 'en'],
translation: { type: 'one_way', target_language: 'vi' }
}));
});
return ws;
}const API_KEY = process.env.AUDIODICH_API_KEY;
async function createTtsJob(text) {
const res = await fetch('https://audiodich.io.vn/api/v1/tts/jobs', {
method: 'POST',
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ text, voiceId: 'vi-female-1', speed: 1 })
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}const API_KEY = process.env.AUDIODICH_API_KEY;
async function uploadMedia(file) {
const form = new FormData();
form.append('file', file);
form.append('sourceLanguage', 'auto');
form.append('targetLanguage', 'vi');
form.append('processingMode', 'translate');
const res = await fetch('https://audiodich.io.vn/api/v1/media-transcripts/upload', {
method: 'POST',
headers: { Authorization: `Bearer ${API_KEY}` },
body: form
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}API list
Endpoint bên dưới mặc định ghép với REST base URL. Các dòng method WS dùng WebSocket base URL.
developer-access
User đã đăng nhập quản lý API key để tích hợp. Các endpoint này dùng web session của chính user, không dùng API key.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| GET | /account/api-credentials | Web session | none | Danh sách key metadata, không trả secret |
| POST | /account/api-credentials | Web session | name, scopes? | apiKey một lần và credential metadata |
| DELETE | /account/api-credentials/:id | Web session owner | none | Credential đã revoke |
identity-quota
Xác định user sở hữu API key và đọc quyền Developer API/quota còn lại trước khi chạy tác vụ.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| GET | /v1/me | API key | none | user, apiCredential |
| GET | /v1/quota | API key | none | remainingSeconds, activeSubscription, developerApi access state |
realtime
Cấp ticket ngắn hạn cho luồng transcript/dịch realtime bằng WebSocket.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| POST | /v1/realtime/ws-ticket | Paid API key scope realtime + quota | none | short-lived WebSocket ticket |
| WS | /ws/proxy?token=<ticket> | WS ticket | JSON config đầu phiên, sau đó binary audio PCM | partial/final transcript, translation, quota/session events |
call
API hỗ trợ phòng gọi, invite, lịch sử, transcript và recording theo quyền user sở hữu API key.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| WS | /ws/call?token=<ticket> | WS ticket | JSON create_room/join_room/leave_room + binary audio | room events, transcript, translated audio/text |
| POST | /v1/calls/invite | Paid API key scope call | roomCode, expiresIn | inviteToken, inviteUrl, roomCode |
| GET | /v1/calls/validate-invite?token=<inviteToken> | Paid API key scope call | none | valid, roomCode, roomActive |
| GET | /v1/calls/active | Paid API key scope call | none | active rooms for user |
| GET | /v1/calls | Paid API key scope call | none | call history |
| GET | /v1/calls/:id | Paid API key scope call | none | call detail |
| DELETE | /v1/calls/:id | Paid API key scope call | none | ok |
| POST | /v1/calls/:id/share | Paid API key scope call | email/options | share status |
| GET | /v1/calls/:id/transcript/download | Paid API key scope call | query format | transcript file |
| GET | /v1/calls/:id/recording | Paid API key scope call | none | recording file |
media-transcripts
Upload audio/video, xử lý transcript/dịch, xem lịch sử, tải file gốc và export nhiều định dạng.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| GET | /v1/media-transcripts | Paid API key scope media | query: limit | jobs |
| POST | /v1/media-transcripts/upload | Paid API key scope media + quota | multipart file, sourceLanguage?, targetLanguage?, processingMode?, speakerDiarization? | job |
| POST | /v1/media-transcripts/uploads/chunked | Paid API key scope media + quota | originalFilename, totalSize, totalChunks, mimeType? | uploadId |
| POST | /v1/media-transcripts/uploads/chunked/:uploadId/chunks | Paid API key scope media | multipart chunk, index | ok, index |
| POST | /v1/media-transcripts/uploads/chunked/:uploadId/complete | Paid API key scope media + quota | sourceLanguage?, targetLanguage?, processingMode? | job |
| GET | /v1/media-transcripts/:id | Paid API key scope media | none | job + transcript |
| DELETE | /v1/media-transcripts/:id | Paid API key scope media | none | ok |
| GET | /v1/media-transcripts/:id/audio | Paid API key scope media | none | original media stream |
| GET | /v1/media-transcripts/:id/export?format=txt|srt|vtt|json|docx|xlsx|pdf | Paid API key scope media | none | export file |
tts
Danh sách giọng đọc, tạo file giọng đọc theo quota và tải audio theo quyền user.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| GET | /v1/tts/voices | Paid API key scope tts | none | voices and limits |
| GET | /v1/tts/jobs | Paid API key scope tts | query: page, limit | jobs, pagination |
| POST | /v1/tts/jobs | Paid API key scope tts + quota | text, language?, voiceId, speed? | job |
| GET | /v1/tts/jobs/:id | Paid API key scope tts | none | job detail |
| GET | /v1/tts/jobs/:id/audio | Paid API key scope tts | none | audio/mpeg attachment |
| DELETE | /v1/tts/jobs/:id | Paid API key scope tts | none | ok |
image-translation
Upload ảnh để OCR, dịch text, lưu lịch sử mã hóa và tải lại ảnh theo quyền user.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| POST | /v1/image-translate/process | Paid API key scope image + quota | multipart image, sourceLanguage?, targetLanguage? | recognized blocks, translatedText, jobId |
| POST | /v1/image-translate/translate-text | Paid API key scope image + quota | text/blocks, sourceLanguage?, targetLanguage? | translated blocks/text |
| GET | /v1/image-translate/history | Paid API key scope image | query: limit | jobs |
| GET | /v1/image-translate/history/:id | Paid API key scope image | none | job + result |
| GET | /v1/image-translate/history/:id/image | Paid API key scope image | none | stored original image |
| DELETE | /v1/image-translate/history/:id | Paid API key scope image | none | ok |
cloud-transcripts
Lưu transcript cloud, xem/sửa/xóa, export và tạo share link theo quyền user.
| Method | Endpoint | Quyền | Input chính | Kết quả |
|---|---|---|---|---|
| POST | /v1/transcripts | Paid API key scope transcript | title?, sourceLanguage, targetLanguage?, durationSeconds?, transcript[], deviceId?, source? | id, title, retainUntil, lineCount |
| GET | /v1/transcripts?limit=50&offset=0 | Paid API key scope transcript | none | transcripts, total |
| GET | /v1/transcripts/:id | Paid API key scope transcript | none | transcript detail |
| PATCH | /v1/transcripts/:id | Paid API key scope transcript | title?, transcript? | updated transcript |
| GET | /v1/transcripts/:id/export?format=txt|json|srt|vtt|docx|pdf | Paid API key scope transcript | none | export file |
| POST | /v1/transcripts/:id/share-link | Paid API key scope transcript | none | shareUrl with token |
| DELETE | /v1/transcripts/:id | Paid API key scope transcript | none | success |
Need access?
Developer API tính năng chỉ mở cho tài khoản đã trả phí và dùng quota của tài khoản hiện tại. Nếu cần hạn mức doanh nghiệp, hãy liên hệ để cấu hình gói phù hợp trước khi đưa vào production.