Exporting a Transcription
π€ Export API
The Transkriptor Export API facilitates the retrieval of transcription results with customizable formats and metadata settings. Tailor your transcript exports to your needs by selecting from various output formats and specifying optional metadata enhancements.
- π TXT: Simple text format, easy to handle in any editor.
- π₯π¬ SRT: Time-stamped subtitles for videos.
- π PDF: Formatted for cross-platform consistency.
- π DOCX: Editable Microsoft Word document.
Parameter Guidelines
- 'orderId': Specific order number for the transcription request.
- 'exportType': Desired format of the transcript: txt, srt, pdf, docx.
- 'includeSpeakerNames': Boolean ('True'/'False') to include speaker identification.
- 'includeTimestamps': Boolean ('True'/'False') to add timestamps showing when each text segment was spoken.
- 'mergeSameSpeakerSegments': Boolean ('True'/'False') to merge segments from the same speaker into one paragraph.
- 'isSingleParagraph': Boolean ('True'/'False') to output the transcript as a single paragraph.
- 'paragraphSize': Control the size of paragraphs: 1, 2, 4, 8.
These settings ensure that your transcription exports are perfectly tailored to meet the specific needs of your applications and workflows.
In relation to the sample code, please note the following parameter specifications:
- 'orderId': Refers to the specific order number associated with the transcription.
- 'exportType': Refers to the file format of exported transcription. It can be one of the following: txt, pdf, docx, srt..
- 'includeSpeakerNames': Takes a Boolean value - True to include speaker identification and False to exclude it.
- 'includeTimestamps': Takes a Boolean value - True to incorporate time references in the transcription, and False to exclude them.
- 'mergeSameSpeakerSegments': Takes a Boolean value - True to merge the segments spoken by the same speaker.
- 'isSingleParagraph': Takes a Boolean value - True to export the whole transcription as a single paragraph.
- 'paragraphSize':Can take one of these values: 1, 2, 4, 8.
These parameters offer customization options to better align with your individual transcription needs.
import requests
url = "https://api.tor.app/export/transcription"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
}
#adjust your parameters
body = {
"orderId" : "123456789",
"exportType" : "pdf",
"includeSpeakerNames" : True,
"includeTimestamps" : True,
"mergeSameSpeakerSegments" : False,
"isSingleParagraph" : False,
"paragraphSize" : 4
}
response = requests.post(url, json=body, headers=headers)
#you will receive the presigned url and the content
print(response.text)
const axios = require('axios');
const url = 'https://api.tor.app/export/transcription';
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
};
const body = {
orderId: '123456789',
exportType: 'pdf',
includeSpeakerNames: true,
includeTimestamps: true,
mergeSameSpeakerSegments: false,
isSingleParagraph: false,
paragraphSize: 4
};
axios.post(url, body, { headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
URL url = new URL("https://api.tor.app/export/transcription");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", "Bearer YOUR_API_KEY");
connection.setRequestProperty("Content-Type", "application/json");
connection.setDoOutput(true);
String jsonInputString = "{\"orderId\": \"123456789\", \"exportType\": \"pdf\", \"includeSpeakerNames\": true, \"includeTimestamps\": true, \"mergeSameSpeakerSegments\": false, \"isSingleParagraph\": false, \"paragraphSize\": 4}";
try(OutputStream os = connection.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int code = connection.getResponseCode();
System.out.println("Response Code: " + code);
} catch (Exception e) {
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var requestBody = new
{
orderId = "123456789",
exportType = "pdf",
includeSpeakerNames = true,
includeTimestamps = true,
mergeSameSpeakerSegments = false,
isSingleParagraph = false,
paragraphSize = 4
};
var json = Newtonsoft.Json.JsonConvert.SerializeObject(reques
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.tor.app/export/transcription"
bearer := "Bearer YOUR_API_KEY"
body := map[string]interface{}{
"orderId": "123456789",
"exportType": "pdf",
"includeSpeakerNames": true,
"includeTimestamps": true,
"mergeSameSpeakerSegments": false,
"isSingleParagraph": false,
"paragraphSize": 4,
}
jsonData, _ := json.Marshal(body)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", bearer)
req.Header.Add("Content-Type", "application/json")
client
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://api.tor.app/export/transcription")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
request.content_type = "application/json"
request.body = JSON.dump({
"orderId" => "123456789",
"exportType" => "pdf",
"includeSpeakerNames" => true,
"includeTimestamps" => true,
"mergeSameSpeakerSegments" => false,
"isSingleParagraph" => false,
"paragraphSize" => 4
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts response.body
<?php
$url = 'https://api.tor.app/export/transcription';
$apiKey = 'YOUR_API_KEY';
$body = array(
"orderId" => "123456789",
"exportType" => "pdf",
"includeSpeakerNames" => true,
"includeTimestamps" => true,
"mergeSameSpeakerSegments" => false,
"isSingleParagraph" => false,
"paragraphSize" => 4
);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n" .
"Authorization: Bearer $apiKey\r\n",
'method' => 'POST',
'content' => json_encode($body),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
?>
import java.net.HttpURLConnection
import java.net.URL
import java.io.OutputStreamWriter
fun main() {
val url = URL("https://api.tor.app/export/transcription")
val connection = url.openConnection() as HttpURLConnection
connection.requestMethod = "POST"
connection.setRequestProperty("Authorization", "Bearer YOUR_API_KEY")
connection.setRequestProperty("Content-Type", "application/json")
connection.doOutput = true
val jsonInputString = """
{
"orderId": "123456789",
"exportType": "pdf",
"includeSpeakerNames": true,
"includeTimestamps": true,
"mergeSameSpeakerSegments": false,
"isSingleParagraph": false,
"paragraphSize": 4
}
""".trimIndent()
OutputStreamWriter(connection.outputStream).use { it.write(jsonInputString) }
val responseCode = connection.responseCode
println("Response Code: $responseCode")
}
import Foundation
let url = URL(string: "https://api.tor.app/export/transcription")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = [
"orderId": "123456789",
"exportType": "pdf",
"includeSpeakerNames": true,
"includeTimestamps": true,
"mergeSameSpeakerSegments": false,
"isSingleParagraph": false,
"paragraphSize": 4
]
let jsonData = try! JSONSerialization.data(withJSONObject: body, options: [])
request.httpBody = jsonData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
print("Error: \(String(describing: error))")
return
}
let responseString = String(data: data, encoding: .utf8)
print("Response: \(responseString ?? "")")
}
task.resume()
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
final url = 'https://api.tor.app/export/transcription';
final headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
};
final body = jsonEncode({
'orderId': '123456789',
'exportType': 'pdf',
'includeSpeakerNames': true,
'includeTimestamps': true,
'mergeSameSpeakerSegments': false,
'isSingleParagraph': false,
'paragraphSize': 4,
});
final response = await http.post(url, headers: headers, body: body);
if (response.statusCode == 200) {
print('Response data: ${response.body}');
} else {
print('Request failed with status: ${response.statusCode}.');
}
}
Updated 2 months ago