Rename File

✏️ Update Transcription File Name

Use this endpoint to update the file name of an existing transcription. Just provide the order ID and the new file name you want to assign to it.


import requests
import json


#order id to get content
order_id = "example_order_id" # Replace with your order id

# Define the API key as a variable
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}',  # Use the variable here
    'Accept': 'application/json'
}

url = f"https://api.tor.app/developer/files/{order_id}"

file_name = "new_file_name"

response = requests.put(url, headers=headers, json={'file_name': file_name})

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

const headers = {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${apiKey}`,
    'Accept': 'application/json'
};

const url = `https://api.tor.app/developer/files/${orderId}`;

const fileName = 'new_file_name';

axios.put(url, { file_name: fileName }, { headers })
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error("Error:", error.response ? error.response.data : error.message);
    });


import okhttp3.*;
import org.json.JSONObject;

public class UpdateFileName {
    private static final String API_KEY = "your_api_key_here";
    private static final String ORDER_ID = "example_order_id";

    public static void main(String[] args) throws Exception {
        OkHttpClient client = new OkHttpClient();
        String url = "https://api.tor.app/developer/files/" + ORDER_ID;

        JSONObject payload = new JSONObject();
        payload.put("file_name", "new_file_name");

        RequestBody body = RequestBody.create(payload.toString(), MediaType.parse("application/json"));

        Request request = new Request.Builder()
                .url(url)
                .put(body)
                .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()) {
                System.out.println("Response: " + response.body().string());
            } else {
                System.out.println("Request failed: " + response.code());
                System.out.println("Response Body: " + response.body().string());
            }
        }
    }
}


using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

public class Program
{
    private static readonly string apiKey = "your_api_key_here";
    private static readonly string orderId = "example_order_id";

    public static async Task Main()
    {
        var client = new HttpClient();
        var url = $"https://api.tor.app/developer/files/{orderId}";

        var payload = new { file_name = "new_file_name" };

        var jsonPayload = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");

        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
        client.DefaultRequestHeaders.Add("Accept", "application/json");

        var response = await client.PutAsync(url, jsonPayload);

        if (response.IsSuccessStatusCode)
        {
            var responseData = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseData);
        }
        else
        {
            Console.WriteLine("Request failed with status: " + response.StatusCode);
            Console.WriteLine("Response Body: " + await response.Content.ReadAsStringAsync());
        }
    }
}


package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
)

const (
	apiKey  = "your_api_key_here"
	orderId = "example_order_id"
)

func main() {
	url := fmt.Sprintf("https://api.tor.app/developer/files/%s", orderId)

	payload := map[string]string{
		"file_name": "new_file_name",
	}

	payloadBytes, _ := json.Marshal(payload)
	req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(payloadBytes))
	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Accept", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}
	defer resp.Body.Close()

	var response map[string]interface{}
	if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
		fmt.Println("Error decoding response:", err)
		return
	}
	fmt.Println(response)
}


require 'net/http'
require 'json'
require 'uri'

api_key = "your_api_key_here"
order_id = "example_order_id"

url = URI("https://api.tor.app/developer/files/#{order_id}")
file_name = "new_file_name"

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request.body = { "file_name" => file_name }.to_json

response = http.request(request)
puts JSON.parse(response.body)


<?php
$apiKey = "your_api_key_here";
$orderId = "example_order_id";

$url = "https://api.tor.app/developer/files/$orderId";
$fileName = "new_file_name";

$headers = [
    "Authorization: Bearer $apiKey",
    "Content-Type: application/json",
    "Accept: application/json"
];

$payload = json_encode(["file_name" => $fileName]);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>


import okhttp3.*
import org.json.JSONObject

fun main() {
    val apiKey = "your_api_key_here"
    val orderId = "example_order_id"
    val url = "https://api.tor.app/developer/files/$orderId"

    val payload = JSONObject().put("file_name", "new_file_name")

    val client = OkHttpClient()
    val body = RequestBody.create(MediaType.parse("application/json"), payload.toString())
    val request = Request.Builder()
        .url(url)
        .put(body)
        .addHeader("Authorization", "Bearer $apiKey")
        .addHeader("Content-Type", "application/json")
        .addHeader("Accept", "application/json")
        .build()

    client.newCall(request).execute().use { response ->
        println(response.body()?.string())
    }
}


import Foundation

let apiKey = "your_api_key_here"
let orderId = "example_order_id"
let url = URL(string: "https://api.tor.app/developer/files/\(orderId)")!

var request = URLRequest(url: url)
request.httpMethod = "PUT"
request.addValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")

let payload: [String: Any] = [
    "file_name": "new_file_name"
]

request.httpBody = try! JSONSerialization.data(withJSONObject: payload, options: [])

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: [])
        print(jsonResponse ?? "Failed to parse response")
    }
}

task.resume()

import 'dart:convert';
import 'dart:io';

void main() async {
  const apiKey = 'your_api_key_here';
  const orderId = 'example_order_id';

  final url = Uri.parse('https://api.tor.app/developer/files/$orderId');

  final payload = jsonEncode({
    "file_name": "new_file_name",
  });

  final request = await HttpClient().putUrl(url)
    ..headers.set('Authorization', 'Bearer $apiKey')
    ..headers.set('Content-Type', 'application/json')
    ..headers.set('Accept', 'application/json')
    ..write(payload);

  final response = await request.close();

  if (response.statusCode == 200) {
    final responseBody = await response.transform(utf8.decoder).join();
    print(responseBody);
  } else {
    print("Request failed with status: ${response.statusCode}");
    final responseBody = await response.transform(utf8.decoder).join();
    print("Response Body: $responseBody");
  }
}