Save transcript, translation and pronunciation edits
curl --request PATCH \
--url https://api.pyai.com/v1/dub/jobs/{job_id}/editor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"revision": 2,
"edits": [
{
"id": "<string>",
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>"
}
]
}
'import requests
url = "https://api.pyai.com/v1/dub/jobs/{job_id}/editor"
payload = {
"revision": 2,
"edits": [
{
"id": "<string>",
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
revision: 2,
edits: [
{
id: '<string>',
source_text: '<string>',
translated_text: '<string>',
pronunciation_text: '<string>'
}
]
})
};
fetch('https://api.pyai.com/v1/dub/jobs/{job_id}/editor', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pyai.com/v1/dub/jobs/{job_id}/editor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'revision' => 2,
'edits' => [
[
'id' => '<string>',
'source_text' => '<string>',
'translated_text' => '<string>',
'pronunciation_text' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pyai.com/v1/dub/jobs/{job_id}/editor"
payload := strings.NewReader("{\n \"revision\": 2,\n \"edits\": [\n {\n \"id\": \"<string>\",\n \"source_text\": \"<string>\",\n \"translated_text\": \"<string>\",\n \"pronunciation_text\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.pyai.com/v1/dub/jobs/{job_id}/editor")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"revision\": 2,\n \"edits\": [\n {\n \"id\": \"<string>\",\n \"source_text\": \"<string>\",\n \"translated_text\": \"<string>\",\n \"pronunciation_text\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/dub/jobs/{job_id}/editor")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"revision\": 2,\n \"edits\": [\n {\n \"id\": \"<string>\",\n \"source_text\": \"<string>\",\n \"translated_text\": \"<string>\",\n \"pronunciation_text\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"revision": 2,
"parent_job_id": "<string>",
"segments": [
{
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>",
"id": "<string>",
"speaker": "<string>",
"start": 1,
"end": 1,
"output_start": 1,
"output_end": 1,
"rendered": {
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>"
},
"changed": true
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}Dub
Save transcript, translation and pronunciation edits
Save draft text without generating audio or changing current subtitles. Include the latest revision to prevent overwriting another tab. A revision mismatch returns 409 dub_edit_conflict. No delivery units are charged.
PATCH
/
v1
/
dub
/
jobs
/
{job_id}
/
editor
Save transcript, translation and pronunciation edits
curl --request PATCH \
--url https://api.pyai.com/v1/dub/jobs/{job_id}/editor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"revision": 2,
"edits": [
{
"id": "<string>",
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>"
}
]
}
'import requests
url = "https://api.pyai.com/v1/dub/jobs/{job_id}/editor"
payload = {
"revision": 2,
"edits": [
{
"id": "<string>",
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
revision: 2,
edits: [
{
id: '<string>',
source_text: '<string>',
translated_text: '<string>',
pronunciation_text: '<string>'
}
]
})
};
fetch('https://api.pyai.com/v1/dub/jobs/{job_id}/editor', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pyai.com/v1/dub/jobs/{job_id}/editor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'revision' => 2,
'edits' => [
[
'id' => '<string>',
'source_text' => '<string>',
'translated_text' => '<string>',
'pronunciation_text' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pyai.com/v1/dub/jobs/{job_id}/editor"
payload := strings.NewReader("{\n \"revision\": 2,\n \"edits\": [\n {\n \"id\": \"<string>\",\n \"source_text\": \"<string>\",\n \"translated_text\": \"<string>\",\n \"pronunciation_text\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.pyai.com/v1/dub/jobs/{job_id}/editor")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"revision\": 2,\n \"edits\": [\n {\n \"id\": \"<string>\",\n \"source_text\": \"<string>\",\n \"translated_text\": \"<string>\",\n \"pronunciation_text\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/dub/jobs/{job_id}/editor")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"revision\": 2,\n \"edits\": [\n {\n \"id\": \"<string>\",\n \"source_text\": \"<string>\",\n \"translated_text\": \"<string>\",\n \"pronunciation_text\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"revision": 2,
"parent_job_id": "<string>",
"segments": [
{
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>",
"id": "<string>",
"speaker": "<string>",
"start": 1,
"end": 1,
"output_start": 1,
"output_end": 1,
"rendered": {
"source_text": "<string>",
"translated_text": "<string>",
"pronunciation_text": "<string>"
},
"changed": true
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}Authorizations
apiKeyxApiKey
Use Authorization: Bearer pyai_live_... (or pyai_test_...).
Path Parameters
Body
application/json