Contents
On this page
Translate Subtitles - Plugixa Stream
POST /plugixa-stream/v1/admin/ai/episodes/{id}/translate
Translate an episode’s subtitles into one language and save them as a new track, replacing an earlier track in that language. One language and one episode per call: loop for a whole series.
Needs a user with the plugixa_stream_edit capability (signed in with an Application Password or the login cookie). Administrators hold it; other roles only when you grant it. Uses your Anthropic key; the subtitle text is sent to Anthropic.
Request
POST https://your-site.example/wp-json/plugixa-stream/v1/admin/ai/episodes/2815/translate
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The episode’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
to |
string |
Yes | The target language, such as fr or pt-BR. |
from |
string |
No | The source track’s language. Defaults to the title’s spoken language, else the first uploaded track. |
{
"to": "fr"
}
Responses
201 Created. data is the new track.
{
"success": true,
"data": {
"lang": "fr",
"label": "",
"attachment_id": 3120,
"source": "ai",
"from": "en",
"url": "https://your-site.example/wp-content/uploads/2026/10/flash-gordon-ep-1.fr.vtt"
}
}
| Field | Type | Meaning |
|---|---|---|
data.lang |
string |
The track’s language |
data.attachment_id |
integer |
The WebVTT file in the Media Library |
data.source |
string |
ai |
data.from |
string |
The language it was translated from; empty for a transcription |
data.url |
string |
The file’s URL |
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
plugixa_stream_forbidden |
The caller lacks the capability. |
404 |
plugixa_stream_not_found |
No episode with that id. |
422 |
plugixa_stream_invalid |
to is missing, or it is the source’s language. |
422 |
plugixa_stream_ai_source |
The episode has no subtitles to translate from, or the file has no readable lines. |
400 |
plugixa_stream_ai_setup |
No Anthropic key is saved. |
422 |
plugixa_stream_ai_refused |
Claude declined to translate. |
502 |
plugixa_stream_ai_truncated |
The translation was cut off. Also plugixa_stream_ai_mismatch (lines missing) and plugixa_stream_ai (Anthropic could not be reached). Nothing was saved. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/admin/ai/episodes/2815/translate" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"to":"fr"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/ai/episodes/2815/translate');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'to' => 'fr',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/admin/ai/episodes/2815/translate', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ to: 'fr' }),
});
const { data } = await response.json();
Quick Links
Share