Voice API documentations

Language List

    METHOD: GET
    URL: http://voice.testv1/language/get-language-list
    Params: Authorization: Bearer XhnwT9qQAJMRXK-VISOpOn6p7VpZLC7d
    Example request using PHP:

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => 'http://voice.testv1/language/get-language-list',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer XhbwK9qQAJMRdK-VSXYEOn6p7VpZLC9d',
        ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
    echo $response;

    Example response:
    {
        "status": "success",
        "code": 200,
        "message": "Language list",
        "data": {
            "language_list": {
                "af": "Afrikaans",
                "ar": "Arabic",
                "bg": "Bulgarian",
                "bn": "Bengali",
                "bs": "Bosnian",
                "ca": "Catalan",
                "cs": "Czech",
                "da": "Danish",
                "de": "German",
                "el": "Greek",
                "en": "English",
                "es": "Spanish",
        ..............
    }

Convert text to mp3

    METHOD: POST
    URL: http://voice.testv1/convert/to-mp3
    Params: Authorization: Bearer XhnwT9qQAJMRXK-VISOpOn6p7VpZLC7d
    Post fields:
        [
            'lang': 'en',
            'text': 'I can speak!,

            // options fields
            'is_file': 1 // means will get response as file
            'file_extension': '.mp3' // default value is .mp3
        ]
    Example request using PHP:

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => 'http://voice.testv1/convert/to-mp3',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => array('text' => 'Hello! How are you?','lang' => 'en'),
        CURLOPT_HTTPHEADER => array(
            'Authorization: Bearer XhnwT9qQAJMRXK-VISOpOn6p7VpZLC7d',
        ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
    echo $response;

    Example response:
    {
        "status": "success",
        "code": 200,
        "message": "Text was successfully converted to mp3",
        "data": {
            "host": "http://voice.test",
            "path_to_file": "/voices/19466/b6bftvq2saogdy.mp3",
            "full_path": "http://voice.testvoices/19466/b6bftvq2saogdy.mp3"
            "file_name": "b6bftvq2saogdy.mp3"
        }
    }

Multiple convert text to mp3

    METHOD: POST
    URL: http://voice.testv1/convert/batch-convert
    Params: Authorization: Bearer XhnwT9qQAJMRXK-VISOpOn6p7VpZLC7d
    Post fields:
        [
            [
                'text' => 'some text',
                'lang' => 'en',
            ],
            [
                'text' => 'more some text',
                'lang' => 'en',
            ],
        ]
    Example request using PHP:

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => 'http://voice.testv1/convert/batch-convert',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => array(
            'data[0][text]' => 'Some text',
            'data[0][lang]' => 'en',
            'data[1][text]' => 'Some text 2',
            'data[1][lang]' => 'en',
            'data[2][text]' => 'Some text 3',
            'data[2][lang]' => 'en',
            'data[4][text]' => 'Some text 4',
            'data[4][lang]' => 'en',
            'data[5][text]' => 'Some text 5',
            'data[5][lang]' => 'en'
            ),
        CURLOPT_HTTPHEADER => array(
            'Authorization: Bearer XhnwT9qQAJMRXK-VISOpOn6p7VpZLC7d',
        ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
    echo $response;

    Example response:
    {
        "status": "success",
    "code": 200,
    "message": "Text was successfully converted to mp3",
    "data": [
        {
            "host": "http://voice.test",
            "path_to_file": "voices/2/2023032913/vew6i--_0nojzhof.mp3",
            "full_path": "http://voice.testvoices/2/2023032913/vew6i--_0nojzhof.mp3",
            "text": "Some text",
            "lang": "en"
        },
        {
            "host": "http://voice.test",
            "path_to_file": "voices/2/2023032913/hcwlw7znz-i_istn.mp3",
            "full_path": "http://voice.testvoices/2/2023032913/hcwlw7znz-i_istn.mp3",
            "text": "Some text 2",
            "lang": "en"
        },
        {
            "host": "http://voice.test",
            "path_to_file": "voices/2/2023032913/zpbpfaokyh6f3jfm.mp3",
            "full_path": "http://voice.testvoices/2/2023032913/zpbpfaokyh6f3jfm.mp3",
            "text": "Some text 3",
            "lang": "en"
        },
        {
            "host": "http://voice.test",
            "path_to_file": "voices/2/2023032913/kesfzxcnblzntuwu.mp3",
            "full_path": "http://voice.testvoices/2/2023032913/kesfzxcnblzntuwu.mp3",
            "text": "Some text 4",
            "lang": "en"
        },
        *******
    }