Get File Content
π Get Transcription Content by Order ID
This endpoint allows you to retrieve the content of a completed transcription by providing an order_id
. Use this to access the transcription text and any related data.
π Request Parameters
- order_id (string): The unique identifier for the transcription order whose content you want to retrieve.
π Response
The response will include the transcription content associated with the provided order_id
.
β οΈ Ensure the order_id
is valid.
import requests
order_id = "example_order_id" # Replace with your order id
api_key = 'your_api_key_here' # Replace with your actual API key
# Set up the headers, including the API key
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {api_key}',
'Accept': 'application/json'
}
url = f"https://api.tor.app/developer/files/{order_id}/content"
response = requests.get(url, headers=headers)
response_json = response.json()
print(response_json)
const axios = require('axios');
const orderId = "example_order_id"; // Replace with your order id
const apiKey = 'your_api_key_here'; // Replace with your actual API key
// Set up the headers, including the API key
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`,
'Accept': 'application/json'
};
const url = `https://api.tor.app/developer/files/${orderId}/content`;
axios.get(url, { headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response ? error.response.data : error.message);
});
java
Copy code
import okhttp3.*;
import org.json.JSONObject;
public class GetFileContent {
private static final String API_KEY = "your_api_key_here"; // Replace with your actual API key
private static final String ORDER_ID = "example_order_id"; // Replace with your order id
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
String url = "https://api.tor.app/developer/files/" + ORDER_ID + "/content";
Request request = new Request.Builder()
.url(url)
.addHeader("Authorization", "Bearer " + API_KEY)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
String responseData = response.body().string();
JSONObject json = new JSONObject(responseData);
System.out.println(json.toString(2));
} else {
System.out.println("Request failed: " + response.code());
}
}
}
}
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
public class Program
{
private static readonly string apiKey = "your_api_key_here"; // Replace with your actual API key
private static readonly string orderId = "example_order_id"; // Replace with your order id
public static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var url = $"https://api.tor.app/developer/files/{orderId}/content";
var response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
var responseJson = await response.Content.ReadAsStringAsync();
var data = JsonSerializer.Deserialize<JsonDocument>(responseJson);
Console.WriteLine(data.RootElement.ToString());
}
else
{
Console.WriteLine($"Request failed with status: {response.StatusCode}");
}
}
}
package main
import (
"encoding/json"
"fmt"
"net/http"
)
const (
apiKey = "your_api_key_here" // Replace with your actual API key
orderId = "example_order_id" // Replace with your order id
)
func main() {
url := fmt.Sprintf("https://api.tor.app/developer/files/%s/content", orderId)
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer "+apiKey)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} else {
fmt.Printf("Request failed with status: %d\n", resp.StatusCode)
}
}
require 'net/http'
require 'json'
require 'uri'
order_id = "example_order_id" # Replace with your order id
api_key = "your_api_key_here" # Replace with your actual API key
url = URI("https://api.tor.app/developer/files/#{order_id}/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
response = http.request(request)
if response.code.to_i == 200
response_json = JSON.parse(response.body)
puts response_json
else
puts "Request failed with status: #{response.code}"
end
<?php
$orderId = "example_order_id"; // Replace with your order id
$apiKey = "your_api_key_here"; // Replace with your actual API key
$url = "https://api.tor.app/developer/files/$orderId/content";
$headers = [
"Authorization: Bearer $apiKey",
"Content-Type: application/json",
"Accept: application/json"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200) {
$responseJson = json_decode($response, true);
print_r($responseJson);
} else {
echo "Request failed with status: $httpCode\n";
}
?>
import okhttp3.OkHttpClient
import okhttp3.Request
fun main() {
val apiKey = "your_api_key_here" // Replace with your actual API key
val orderId = "example_order_id" // Replace with your order id
val client = OkHttpClient()
val url = "https://api.tor.app/developer/files/$orderId/content"
val request = Request.Builder()
.url(url)
.addHeader("Authorization", "Bearer $apiKey")
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build()
client.newCall(request).execute().use { response ->
if (response.isSuccessful) {
println(response.body()?.string())
} else {
println("Request failed with status: ${response.code()}")
}
}
}
import Foundation
let orderId = "example_order_id" // Replace with your order id
let apiKey = "your_api_key_here" // Replace with your actual API key
let url = URL(string: "https://api.tor.app/developer/files/\(orderId)/content")!
var request = URLRequest(url: url)
request.addValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
print("Request failed:", error ?? "Unknown error")
return
}
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 {
let responseJson = try? JSONSerialization.jsonObject(with: data, options: [])
print(responseJson ?? "Failed to parse response")
} else {
print("Request failed with status:", (response as? HTTPURLResponse)?.statusCode ?? 0)
}
}
task.resume()
import 'dart:convert';
import 'dart:io';
void main() async {
const orderId = "example_order_id"; // Replace with your order id
const apiKey = "your_api_key_here"; // Replace with your actual API key
final url = Uri.parse("https://api.tor.app/developer/files/$orderId/content");
final request = await HttpClient().getUrl(url)
..headers.set("Authorization", "Bearer $apiKey")
..headers.set("Content-Type", "application/json")
..headers.set("Accept", "application/json");
final response = await request.close();
if (response.statusCode == 200) {
final responseBody = await response.transform(utf8.decoder).join();
final responseJson = jsonDecode(responseBody);
print(responseJson);
} else {
print("Request failed with status: ${response.statusCode}");
}
}
200 OK - Completed
{
"statusCode": 200,
"body": {
"status": "Completed",
"service": "Standard",
"file_name": "file_name",
"language": "en-US",
"feature_name": "local_transcription",
"tid": "#Transkription#01JC5Y7JW7VYFP5A3H03JF0AHR",
"folder_id": "User#01J4788HH1AAQ6XBCR3JNWMV67",
"order_id": "1731071292249369289",
"date": 1731071300031,
"ai_chat_session_id": "",
"summary_id": "",
"is_trial": false,
"mp3_file": "https://mp3buckets.s3.eu-central-1.amazonaws.com/539efa405cb97009e25fba82cba5390fc8719c6df56f94d885fb8c6ee5acc552b56a85d2d6bf3cbaca20179366d176b02ddbffcc9e26a63082c01899ba8886d0.mp3",
"content": [
{
"text": "Transcription content",
"StartTime": 19000,
"EndTime": 43661,
"VoiceStart": 19000,
"VoiceEnd": 43661,
"Speaker": "SPK_1"
}
]
}
}
}
200 OK - Processing
{
"statusCode": 200,
"body": {
"status": "Processing",
"service": "Standard",
"file_name": "file_name",
"language": "en-US",
"feature_name": "youtube_transcription",
"tid": "#Transkription#01JC5Y7JW7VYFP5A3H03JF0AHR",
"folder_id": "User#01J4788HH1AAQ6XBCR3JNWMV67",
"order_id": "1731071292249369289",
"date": 1731071300031,
"ai_chat_session_id": "",
"summary_id": "",
"is_trial": false
}
}
400 Missing Parameters
{
"statusCode": 400,
"body": {
'message': "Missing parameters: "
}
}
404 Not Found
{
"statusCode": 404,
"body": {
'message': "File not found. "
}
}
500 Internal Server Error
{
"statusCode": 500,
"body": "Internal server error"
}
Updated 10 days ago