RESTful API for AI-powered subtitle translation
← Back to Homehttps://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1
All upload requests require an authorization code. For testing, you can use:
demo-code-2026
Contact your admin to get a production authorization code.
Upload an SRT file and start translation
| Parameter | Type | Required | Description |
|---|---|---|---|
srt_file |
File | Yes | SRT subtitle file to translate |
target_language |
String | Yes | Target language code (e.g., "zh", "en") |
auth_code |
String | Yes | Authorization code |
const file = document.querySelector('input[type="file"]').files[0];
const formData = new FormData();
formData.append('srt_file', file);
formData.append('target_language', 'zh');
formData.append('auth_code', 'demo-code-2026');
const response = await fetch('https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/upload', {
method: 'POST',
body: formData
});
const data = await response.json();
console.log('Task ID:', data.task_id);
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"message": "Translation task created successfully"
}
Check translation task status and progress
| Parameter | Type | Required | Description |
|---|---|---|---|
task_id |
String | Yes | Task ID returned from upload |
const taskId = 'your-task-id';
const response = await fetch(
`https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/status?task_id=${taskId}`
);
const status = await response.json();
console.log('Status:', status.status);
console.log('Progress:', status.progress + '%');
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"progress": 65,
"created_at": "2026-02-05T12:00:00Z",
"updated_at": "2026-02-05T12:05:30Z"
}
Download translated SRT file
| Parameter | Type | Required | Description |
|---|---|---|---|
task_id |
String | Yes | Task ID of completed translation |
const taskId = 'your-task-id';
const response = await fetch(
`https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/download?task_id=${taskId}`
);
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'translated.srt';
a.click();
Returns the translated SRT file as binary data with appropriate headers.
en
zh
zh-TW
es
fr
de
ja
ko
ar
ru
pt
it
| Status | Description |
|---|---|
pending |
Task created, waiting to start |
processing |
Translation in progress |
completed |
Translation finished successfully |
failed |
Translation failed (check error_message) |
| Code | Description |
|---|---|
200 |
Success |
400 |
Bad request (missing or invalid parameters) |
401 |
Unauthorized (invalid authorization code) |
404 |
Task not found |
500 |
Server error |
# Step 1: Upload
TASK_ID=$(curl -X POST https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/upload \
-F "[email protected]" \
-F "target_language=zh" \
-F "auth_code=demo-code-2026" \
| jq -r '.task_id')
echo "Task ID: $TASK_ID"
# Step 2: Check status (poll until completed)
while true; do
STATUS=$(curl -s "https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/status?task_id=$TASK_ID" | jq -r '.status')
PROGRESS=$(curl -s "https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/status?task_id=$TASK_ID" | jq -r '.progress')
echo "Status: $STATUS, Progress: $PROGRESS%"
if [ "$STATUS" = "completed" ]; then
break
fi
sleep 2
done
# Step 3: Download
curl "https://aeijpbqlgikpdsqpebqa.supabase.co/functions/v1/api/download?task_id=$TASK_ID" \
-o translated.srt
echo "Translation completed and saved to translated.srt"