Get Custom Vocabulary

📖 Get Custom Vocabulary

Retrieve your existing custom vocabulary for a specific language. Returns the list of words and phrases you have previously saved.


💡 Note: If no custom vocabulary exists for the specified language, an empty list will be returned.

import requests

url = "https://api.tor.app/developer/custom_vocabulary"
api_key = "your_api_key"  # Replace with your actual API key

params = {
    "language": "en"  # Supported: en, es, fr, de, it, pt
}

headers = {
    "Authorization": f"Bearer {api_key}"
}

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

if response.status_code == 200:
    data = response.json()
    print("Language:", data["language"])
    print("Words:", data["words"])
    print("Word Count:", data["word_count"])
else:
    print("Failed:", response.status_code, response.text)
const axios = require('axios');

const apiKey = 'your_api_key'; // Replace with your actual API key
const url = 'https://api.tor.app/developer/custom_vocabulary';

const params = {
    language: 'en' // Supported: en, es, fr, de, it, pt
};

const headers = {
    'Authorization': `Bearer ${apiKey}`
};

axios.get(url, { params, headers })
    .then(response => {
        console.log('Language:', response.data.language);
        console.log('Words:', response.data.words);
        console.log('Word Count:', response.data.word_count);
    })
    .catch(error => {
        console.error('Failed:', error.response ? error.response.data : error.message);
    });
import okhttp3.*;
import org.json.JSONObject;
import org.json.JSONArray;

public class GetCustomVocabulary {
    private static final String API_KEY = "your_api_key";

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

        Request request = new Request.Builder()
            .url(url)
            .get()
            .addHeader("Authorization", "Bearer " + API_KEY)
            .build();

        try (Response response = client.newCall(request).execute()) {
            if (response.isSuccessful()) {
                JSONObject data = new JSONObject(response.body().string());
                System.out.println("Language: " + data.getString("language"));
                System.out.println("Words: " + data.getJSONArray("words"));
                System.out.println("Word Count: " + data.getInt("word_count"));
            } else {
                System.out.println("Failed: " + response.body().string());
            }
        }
    }
}
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

public class GetCustomVocabulary
{
    private static readonly string apiKey = "your_api_key";

    public static async Task Main()
    {
        var client = new HttpClient();
        var url = "https://api.tor.app/developer/custom_vocabulary?language=en";

        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");

        var response = await client.GetAsync(url);
        var responseContent = await response.Content.ReadAsStringAsync();

        if (response.IsSuccessStatusCode)
        {
            var data = JsonDocument.Parse(responseContent).RootElement;
            Console.WriteLine("Language: " + data.GetProperty("language").GetString());
            Console.WriteLine("Words: " + data.GetProperty("words").ToString());
            Console.WriteLine("Word Count: " + data.GetProperty("word_count").GetInt32());
        }
        else
        {
            Console.WriteLine("Failed: " + responseContent);
        }
    }
}
package main

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

const apiKey = "your_api_key"

func main() {
	url := "https://api.tor.app/developer/custom_vocabulary?language=en"

	req, _ := http.NewRequest("GET", url, nil)
	req.Header.Set("Authorization", "Bearer "+apiKey)

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

	body, _ := ioutil.ReadAll(resp.Body)

	if resp.StatusCode == 200 {
		var data map[string]interface{}
		json.Unmarshal(body, &data)
		fmt.Println("Language:", data["language"])
		fmt.Println("Words:", data["words"])
		fmt.Println("Word Count:", data["word_count"])
	} else {
		fmt.Println("Failed:", string(body))
	}
}
<?php
$apiKey = "your_api_key";
$url = "https://api.tor.app/developer/custom_vocabulary?language=en";

$headers = [
    "Authorization: Bearer $apiKey"
];

$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) {
    $data = json_decode($response, true);
    echo "Language: " . $data["language"] . "\n";
    echo "Words: " . implode(", ", $data["words"]) . "\n";
    echo "Word Count: " . $data["word_count"] . "\n";
} else {
    echo "Failed: " . $response . "\n";
}
?>
require 'net/http'
require 'json'
require 'uri'

api_key = "your_api_key"
url = URI("https://api.tor.app/developer/custom_vocabulary?language=en")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer #{api_key}"

response = http.request(request)

if response.code.to_i == 200
  data = JSON.parse(response.body)
  puts "Language: #{data['language']}"
  puts "Words: #{data['words'].join(', ')}"
  puts "Word Count: #{data['word_count']}"
else
  puts "Failed: #{response.body}"
end
import okhttp3.*
import org.json.JSONObject

fun main() {
    val apiKey = "your_api_key"
    val url = "https://api.tor.app/developer/custom_vocabulary?language=en"

    val client = OkHttpClient()

    val request = Request.Builder()
        .url(url)
        .get()
        .addHeader("Authorization", "Bearer $apiKey")
        .build()

    client.newCall(request).execute().use { response ->
        if (response.isSuccessful) {
            val data = JSONObject(response.body()?.string())
            println("Language: ${data.getString("language")}")
            println("Words: ${data.getJSONArray("words")}")
            println("Word Count: ${data.getInt("word_count")}")
        } else {
            println("Failed: ${response.body()?.string()}")
        }
    }
}
import Foundation

let apiKey = "your_api_key"
let url = URL(string: "https://api.tor.app/developer/custom_vocabulary?language=en")!

var request = URLRequest(url: url)
request.httpMethod = "GET"
request.addValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let httpResponse = response as? HTTPURLResponse {
        if let data = data {
            if httpResponse.statusCode == 200 {
                if let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
                    print("Language: \(json["language"] ?? "")")
                    print("Words: \(json["words"] ?? [])")
                    print("Word Count: \(json["word_count"] ?? 0)")
                }
            } else {
                print("Failed: \(String(data: data, encoding: .utf8) ?? "")")
            }
        }
    }
}
task.resume()

RunLoop.main.run()
import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
  const apiKey = 'your_api_key';
  final url = Uri.parse('https://api.tor.app/developer/custom_vocabulary?language=en');

  final response = await http.get(
    url,
    headers: {
      'Authorization': 'Bearer $apiKey'
    },
  );

  if (response.statusCode == 200) {
    final data = jsonDecode(response.body);
    print('Language: ${data["language"]}');
    print('Words: ${data["words"]}');
    print('Word Count: ${data["word_count"]}');
  } else {
    print('Failed: ${response.body}');
  }
}

Query Parameters


ParameterTypeRequiredDescription
languagestringNoLanguage code. Supported: en, es, fr, de, it, pt. Default: en

Response


200 OK - Custom Vocabulary Retrieved Successfully
{
    "language": "en",
    "words": [
        "Transkriptor",
        "Meetingtor",
        "Speaktor",
        "Kelly Byrne-Donoghue",
        "Xanthippe Przybylski"
    ],
    "word_count": 5
}

200 OK - No Custom Vocabulary Found (Empty List)
{
    "language": "en",
    "words": [],
    "word_count": 0
}

400 Bad Request - Language Not Supported
{
    "message": "Language not supported. Supported languages: en, es, fr, de, it, pt"
}

401 Unauthorized
{
    "message": "Unauthorized"
}

500 Internal Server Error
{
    "message": "Error retrieving custom vocabulary"
}