Exporting a Transcription

πŸ“€ Export API

Our Export API offers flexibility in how you receive your transcription results. You can choose the format that best suits your needs and whether you want additional metadata such as timestamps and speaker names.

  • πŸ“ TXT: A simple text format that's easy to work with in any text editor.
  • πŸŽ₯πŸ’¬ SRT: A time-stamped format that's perfect for creating subtitles for videos.

In addition, you can include:

  • ⏰ Timestamps: Provides the time in the audio or video where each segment of text was spoken.
  • πŸ‘₯ Speaker Names: Identifies different speakers in the transcription, ideal for interviews and multi-speaker recordings.

Please use the following sample code to export a transcription:

In relation to the sample code, please note the following parameter specifications:

  • 'order': Refers to the specific order number associated with the user.
  • 'type': Can either be 'txt' for plain text format or 'srt' for time-stamped subtitle format.
  • 'speaker': Takes a Boolean value - True to include speaker identification and False to exclude it.
  • 'timestamp': Also takes a Boolean value - True to incorporate time references in the transcription, and False to exclude them.

These parameters offer customization options to better align with your individual transcription needs.

import requests

url = "https://api.transkriptor.com/6/Export-File"

#adjust your parameters
parameters = {
  "orderid" : 123456789,
  "type" : "txt",
  "speaker" : True,
  "timestamp" : True
}

response = requests.get(url, params = parameters)

#you will receive the download link as a response
print(response.text)
const axios = require('axios');

const url = 'https://api.transkriptor.com/6/Export-File';

const parameters = {
  orderid: 123456789,
  type: 'txt',
  speaker: true,
  timestamp: true
};

axios.get(url, { params: parameters })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });

import java.io.IOException;
import java.net.URL;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Main {
    public static void main(String[] args) throws IOException {
        String url = "https://api.transkriptor.com/6/Export-File";
        Map<String, Object> parameters = Map.of(
            "orderid", 123456789,
            "type", "txt",
            "speaker", true,
            "timestamp", true
        );

        URL requestUrl = new URL(url + "?" + encodeParams(parameters));
        String response = new String(requestUrl.openStream().readAllBytes());

        System.out.println(response);
    }

    private static String encodeParams(Map<String, Object> params) throws IOException {
        StringBuilder result = new StringBuilder();
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            if (result.length() > 0) {
                result.append("&");
            }
            result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
            result.append("=");
            result.append(URLEncoder.encode(String.valueOf(entry.getValue()), "UTF-8"));
        }
        return result.toString();
    }
}

using System;
using System.Net;
using Newtonsoft.Json;

class Program
{
    static void Main()
    {
        string url = "https://api.transkriptor.com/6/Export-File";

        var parameters = new
        {
            orderid = 123456789,
            type = "txt",
            speaker = true,
            timestamp = true
        };

        string response = new WebClient().DownloadString($"{url}?{EncodeParams(parameters)}");

        Console.WriteLine(response);
    }

    private static string EncodeParams(object parameters)
    {
        var properties = parameters.GetType().GetProperties();
        var keyValuePairs = Array.ConvertAll(properties, p => $"{p.Name}={Uri.EscapeDataString(p.GetValue(parameters)?.ToString() ?? string.Empty)}");
        return string.Join("&", keyValuePairs);
    }
}

package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {
	url := "https://api.transkriptor.com/6/Export-File"

	parameters := map[string]string{
		"orderid": "123456789",
		"type": "txt",
		"speaker": "true",
		"timestamp": "true",
	}

	res, err := http.Get(url + "?" + encodeParams(parameters))
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}

func encodeParams(params map[string]string) string {
	values := make([]string, 0, len(params))
	for key, value := range params {
		values = append(values, fmt.Sprintf("%s=%s", key, value))
	}
	return strings.Join(values, "&")
}

require 'net/http'
require 'json'

url = URI.parse('https://api.transkriptor.com/6/Export-File')
parameters = {
  'orderid' => 123456789,
  'type' => 'txt',
  'speaker' => true,
  'timestamp' => true
}

url.query = URI.encode_www_form(parameters)

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

response = http.get(url)

puts response.body

<?php
$url = "https://api.transkriptor.com/6/Export-File";

$parameters = array(
    "orderid" => 123456789,
    "type" => "txt",
    "speaker" => true,
    "timestamp" => true
);

$response = file_get_contents($url . '?' . http_build_query($parameters));

echo $response;
?>

import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response

fun main() {
    val url = "https://api.transkriptor.com/6/Export-File"

    val parameters = mapOf(
        "orderid" to 123456789,
        "type" to "txt",
        "speaker" to true,
        "timestamp" to true
    )

    val requestUrl = url + "?" + encodeParams(parameters)

    val client = OkHttpClient()
    val request = Request.Builder()
        .url(requestUrl)
        .build()

    val response: Response = client.newCall(request).execute()
    println(response.body()?.string())
}

fun encodeParams(params: Map<String, Any>): String {
    val encodedParams = StringBuilder()
    params.forEach { (key, value) ->
        encodedParams.append(key).append("=").append(value).append("&")
    }
    return encodedParams.toString().dropLast(1)
}

import Foundation

let url = URL(string: "https://api.transkriptor.com/6/Export-File")!

var components = URLComponents(url: url, resolvingAgainstBaseURL: false)!
components.queryItems = [
    URLQueryItem(name: "orderid", value: "123456789"),
    URLQueryItem(name: "type", value: "txt"),
    URLQueryItem(name: "speaker", value: "true"),
    URLQueryItem(name: "timestamp", value: "true")
]

let request = URLRequest(url: components.url!)

let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
    if let error = error {
        print("Error: \(error.localizedDescription)")
        return
    }
    
    if let data = data {
        if let str = String(data: data, encoding: .utf8) {
            print(str)
        }
    }
}

task.resume()

import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
  final url = Uri.parse('https://api.transkriptor.com/6/Export-File');

  final parameters = {
    'orderid': '123456789',
    'type': 'txt',
    'speaker': 'true',
    'timestamp': 'true',
  };

  final uri = Uri.parse(url.toString() + '?' + Uri(queryParameters: parameters).query);

  final response = await http.get(uri);

  print(response.body);
}