Insert a segment
curl --request POST \
--url https://api.rask.ai/v3/projects/{project_id}/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"start_seconds": 9.7,
"end_seconds": 9.95,
"speaker_id": "SPEAKER_01",
"source_text": "Thanks!"
}
'import requests
url = "https://api.rask.ai/v3/projects/{project_id}/segments"
payload = {
"start_seconds": 9.7,
"end_seconds": 9.95,
"speaker_id": "SPEAKER_01",
"source_text": "Thanks!"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_seconds: 9.7,
end_seconds: 9.95,
speaker_id: 'SPEAKER_01',
source_text: 'Thanks!'
})
};
fetch('https://api.rask.ai/v3/projects/{project_id}/segments', 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",
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([
'start_seconds' => 9.7,
'end_seconds' => 9.95,
'speaker_id' => 'SPEAKER_01',
'source_text' => 'Thanks!'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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"
payload := strings.NewReader("{\n \"start_seconds\": 9.7,\n \"end_seconds\": 9.95,\n \"speaker_id\": \"SPEAKER_01\",\n \"source_text\": \"Thanks!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_seconds\": 9.7,\n \"end_seconds\": 9.95,\n \"speaker_id\": \"SPEAKER_01\",\n \"source_text\": \"Thanks!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rask.ai/v3/projects/{project_id}/segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_seconds\": 9.7,\n \"end_seconds\": 9.95,\n \"speaker_id\": \"SPEAKER_01\",\n \"source_text\": \"Thanks!\"\n}"
response = http.request(request)
puts response.read_body{
"object": "transcript_edit_result",
"segments": [
{
"object": "segment",
"id": "7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44",
"project_id": "6f1c2b7e-8a4d-4e3f-9b5c-1d0a7e2f3c58",
"start_seconds": 9.7,
"end_seconds": 9.95,
"speaker_id": "SPEAKER_01",
"speaker_label": "Speaker 2",
"source": {
"text": "Thanks!",
"language": "en"
},
"translation": {
"text": "",
"language": "es-es"
},
"words": null,
"needs_attention": false,
"status": "translating",
"dub_state": "outdated",
"audio": null,
"selected_variant_id": null,
"translation_variants": null,
"processing_started_at": null,
"etag": "\"s-7be62984f0f8c54c\""
}
],
"deleted_segment_ids": [],
"operations": [
{
"index": 0,
"segment_ids": [
"7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44"
]
}
],
"effects": {
"needs_redub_segment_ids": [
"7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44"
],
"audio_dropped_segment_ids": [],
"retranslation": {
"job_id": "5a9c2e7f-3b6d-4a1e-8c4f-7e0b3d6a9c21",
"segment_ids": [
"7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44"
]
},
"speakers_pending_voice": [],
"instant_clone_settings_reset": [],
"restore_point_version": null,
"project_needs_redub": true
},
"warnings": [
{
"code": "translation_empty",
"detail": "The segment has no translation yet.",
"segment_id": "7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44",
"related_segment_id": null
}
]
}Segments
Insert a segment
Inserts a segment (speaker required); works on an empty transcript.
POST
/
projects
/
{project_id}
/
segments
Insert a segment
curl --request POST \
--url https://api.rask.ai/v3/projects/{project_id}/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"start_seconds": 9.7,
"end_seconds": 9.95,
"speaker_id": "SPEAKER_01",
"source_text": "Thanks!"
}
'import requests
url = "https://api.rask.ai/v3/projects/{project_id}/segments"
payload = {
"start_seconds": 9.7,
"end_seconds": 9.95,
"speaker_id": "SPEAKER_01",
"source_text": "Thanks!"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_seconds: 9.7,
end_seconds: 9.95,
speaker_id: 'SPEAKER_01',
source_text: 'Thanks!'
})
};
fetch('https://api.rask.ai/v3/projects/{project_id}/segments', 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",
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([
'start_seconds' => 9.7,
'end_seconds' => 9.95,
'speaker_id' => 'SPEAKER_01',
'source_text' => 'Thanks!'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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"
payload := strings.NewReader("{\n \"start_seconds\": 9.7,\n \"end_seconds\": 9.95,\n \"speaker_id\": \"SPEAKER_01\",\n \"source_text\": \"Thanks!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_seconds\": 9.7,\n \"end_seconds\": 9.95,\n \"speaker_id\": \"SPEAKER_01\",\n \"source_text\": \"Thanks!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rask.ai/v3/projects/{project_id}/segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_seconds\": 9.7,\n \"end_seconds\": 9.95,\n \"speaker_id\": \"SPEAKER_01\",\n \"source_text\": \"Thanks!\"\n}"
response = http.request(request)
puts response.read_body{
"object": "transcript_edit_result",
"segments": [
{
"object": "segment",
"id": "7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44",
"project_id": "6f1c2b7e-8a4d-4e3f-9b5c-1d0a7e2f3c58",
"start_seconds": 9.7,
"end_seconds": 9.95,
"speaker_id": "SPEAKER_01",
"speaker_label": "Speaker 2",
"source": {
"text": "Thanks!",
"language": "en"
},
"translation": {
"text": "",
"language": "es-es"
},
"words": null,
"needs_attention": false,
"status": "translating",
"dub_state": "outdated",
"audio": null,
"selected_variant_id": null,
"translation_variants": null,
"processing_started_at": null,
"etag": "\"s-7be62984f0f8c54c\""
}
],
"deleted_segment_ids": [],
"operations": [
{
"index": 0,
"segment_ids": [
"7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44"
]
}
],
"effects": {
"needs_redub_segment_ids": [
"7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44"
],
"audio_dropped_segment_ids": [],
"retranslation": {
"job_id": "5a9c2e7f-3b6d-4a1e-8c4f-7e0b3d6a9c21",
"segment_ids": [
"7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44"
]
},
"speakers_pending_voice": [],
"instant_clone_settings_reset": [],
"restore_point_version": null,
"project_needs_redub": true
},
"warnings": [
{
"code": "translation_empty",
"detail": "The segment has no translation yet.",
"segment_id": "7d4f1b8e-5c2a-4e9d-b3f6-1a8c4e7b2d44",
"related_segment_id": null
}
]
}Source text without a translation starts a translation. An unknown speaker gets a suggested voice.
When to use: to add missing speech.
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. An edit that starts a translation counts against the payer’s translation budget (429 rate_limited, policy translation-hour) and its 5 concurrent translation jobs (429 too_many_concurrent_jobs); then nothing is written.
Idempotency: Idempotency-Key required (an insert has no ETag); a same-key retry within 24 h replays the first response (Idempotent-Replayed: true).
Concurrency: no ETag. 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), project_not_ready (409), dub_in_progress (409), transcript_busy (409), too_many_concurrent_jobs (429), dub_payment_required (409)Authorizations
Headers
Path Parameters
Body
application/json
Body of createSegment.
Response
Created: TranscriptEditResult.
Result of a segment or transcript mutation. Transient (no id).