Select a translation variant for a segment
curl --request POST \
--url https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"variant_id": "v-8b3d1e9f-1"
}
'import requests
url = "https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant"
payload = { "variant_id": "v-8b3d1e9f-1" }
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({variant_id: 'v-8b3d1e9f-1'})
};
fetch('https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant', 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.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'variant_id' => 'v-8b3d1e9f-1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$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.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant"
payload := strings.NewReader("{\n \"variant_id\": \"v-8b3d1e9f-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("If-Match", "<if-match>")
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.post("https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant_id\": \"v-8b3d1e9f-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant_id\": \"v-8b3d1e9f-1\"\n}"
response = http.request(request)
puts response.read_body{
"object": "transcript_edit_result",
"segments": [
{
"object": "segment",
"id": "8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22",
"project_id": "6f1c2b7e-8a4d-4e3f-9b5c-1d0a7e2f3c58",
"start_seconds": 3.4,
"end_seconds": 6.8,
"speaker_id": "SPEAKER_01",
"speaker_label": "Speaker 2",
"source": {
"text": "Today we cover the new dubbing features.",
"language": "en"
},
"translation": {
"text": "Hoy veremos las novedades de doblaje.",
"language": "es-es"
},
"words": null,
"needs_attention": false,
"status": "ready",
"dub_state": "outdated",
"audio": null,
"selected_variant_id": "v-8b3d1e9f-1",
"translation_variants": null,
"processing_started_at": null,
"etag": "\"s-a417e9824d09b346\""
}
],
"deleted_segment_ids": [],
"operations": [
{
"index": 0,
"segment_ids": [
"8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22"
]
}
],
"effects": {
"needs_redub_segment_ids": [
"8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22"
],
"audio_dropped_segment_ids": [
"8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22"
],
"retranslation": null,
"speakers_pending_voice": [],
"instant_clone_settings_reset": [],
"restore_point_version": null,
"project_needs_redub": true
},
"warnings": []
}Segments
Select a translation variant for a segment
Sets the segment’s translation to one of its translation_variants (see include=variants) and records the selection; the audio is dropped.
POST
/
projects
/
{project_id}
/
segments
/
{segment_id}
/
select-variant
Select a translation variant for a segment
curl --request POST \
--url https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"variant_id": "v-8b3d1e9f-1"
}
'import requests
url = "https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant"
payload = { "variant_id": "v-8b3d1e9f-1" }
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({variant_id: 'v-8b3d1e9f-1'})
};
fetch('https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant', 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.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'variant_id' => 'v-8b3d1e9f-1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$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.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant"
payload := strings.NewReader("{\n \"variant_id\": \"v-8b3d1e9f-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("If-Match", "<if-match>")
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.post("https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant_id\": \"v-8b3d1e9f-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rask.ai/v3/projects/{project_id}/segments/{segment_id}/select-variant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant_id\": \"v-8b3d1e9f-1\"\n}"
response = http.request(request)
puts response.read_body{
"object": "transcript_edit_result",
"segments": [
{
"object": "segment",
"id": "8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22",
"project_id": "6f1c2b7e-8a4d-4e3f-9b5c-1d0a7e2f3c58",
"start_seconds": 3.4,
"end_seconds": 6.8,
"speaker_id": "SPEAKER_01",
"speaker_label": "Speaker 2",
"source": {
"text": "Today we cover the new dubbing features.",
"language": "en"
},
"translation": {
"text": "Hoy veremos las novedades de doblaje.",
"language": "es-es"
},
"words": null,
"needs_attention": false,
"status": "ready",
"dub_state": "outdated",
"audio": null,
"selected_variant_id": "v-8b3d1e9f-1",
"translation_variants": null,
"processing_started_at": null,
"etag": "\"s-a417e9824d09b346\""
}
],
"deleted_segment_ids": [],
"operations": [
{
"index": 0,
"segment_ids": [
"8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22"
]
}
],
"effects": {
"needs_redub_segment_ids": [
"8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22"
],
"audio_dropped_segment_ids": [
"8b3d1e9f-6a2c-4d7e-b5f1-3c9e7a1d5b22"
],
"retranslation": null,
"speakers_pending_voice": [],
"instant_clone_settings_reset": [],
"restore_point_version": null,
"project_needs_redub": true
},
"warnings": []
}When to use: to pick a shorter or more natural alternative before a redub.
Side effects: Commits atomically: the project’s
pipeline_status becomes transcript_edited, segment ETags change, affected segments become outdated (listed in the response’s effects) and their audio may be dropped.
Cost: Free.
Idempotency: Idempotency-Key accepted (SDKs send one); retries within 24 h replay the first response.
Concurrency: If-Match with the current segment ETag is required (428 if missing or *, 412 with current_etag if stale). On 412 re-read, re-apply once and retry. Refused during processing (409 project_not_ready) and while a dub runs, from its start until its merge ends or it fails (409 dub_in_progress); 409 transcript_busy means concurrent writes kept conflicting: retry after Retry-After.
Paid text: on a project created through v3, 409 dub_payment_required until a dub of that project is charged.
Required scopes: transcripts:write
Errors: transcript_not_ready (409), segment_busy (409), project_not_ready (409), dub_in_progress (409), transcript_busy (409), dub_payment_required (409)Authorizations
Headers
Path Parameters
Body
application/json
Response
OK: TranscriptEditResult.
Result of a segment or transcript mutation. Transient (no id).