NAV Navbar
cURL PHP Java Ruby Python

Voice API v2019-07-27T15:04:25Z

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

The Voice API is used for text-to-speech, speech-to-text and inbound/outbound voice routing. API keys for including as the x-api-key header in requests can be obtained at https://melroselabs.com. The Voice API is part of the Voice Gateway from Melrose Labs.

Numbering

The Inbound Voice service allows voice calls from landlines and mobiles to be received by a telephone number and routed to a VoIP SIP endpoint of your choice. You can allocate to your account, and receive calls on, telephone numbers from supported countries.

Speech-to-Text

The Speech-to-Text service allows an application to have a speech-to-text (STT) conversion performed on a long or short voice stream and for the speech to be transcribed as text.

Text-to-Speech

The Text-to-Speech service allows an application to have a text-to-speech (TTS) conversion performed on a long or short text and for the resulting voice stream to be delivered via a number of different channels.

Base URLs:

Email: Melrose Labs - Technical Support

Authentication

Numbering

List allocated numbers

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/voice/numbering \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/voice/numbering', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/voice/numbering',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/voice/numbering', params={

}, headers = headers)

print r.json()

GET /numbering

Get list of allocated numbers

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK List of allocated numbers Empty

Allocate number

Code samples

# You can also use wget
curl -X POST https://api.melroselabs.com/voice/numbering \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.melroselabs.com/voice/numbering', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.post 'https://api.melroselabs.com/voice/numbering',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.post('https://api.melroselabs.com/voice/numbering', params={

}, headers = headers)

print r.json()

POST /numbering

Allocate a telephone number to your account and optionally set SIP endpoint.

Body parameter

{
  "telNo": "string",
  "sipEndpoint": "string"
}

Parameters

Name In Type Required Description
body body NumberingAllocationRequest true Request for a number and optionally set endpoint
» telNo body string true Telephone number to be allocated. Normally in full international format, beginning with '+'. For example, '+441310001111'.
» sipEndpoint body string false The SIP endpoint URI to where incoming calls to the telephone number (telNo) should be routed.

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK Successful allocation Empty
400 Bad Request Failed to fulfil allocation request Error

List available numbers for a country

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/voice/numbering/available/{country} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/voice/numbering/available/{country}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering/available/{country}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/voice/numbering/available/{country}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/voice/numbering/available/{country}', params={

}, headers = headers)

print r.json()

GET /numbering/available/{country}

Get list of available telephone numbers for a country

Parameters

Name In Type Required Description
country path string true Country for which querying for available numbers

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK List of available numbers for country Empty

List available numbers for a country/prefix

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/voice/numbering/available/{country}/{prefix} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/voice/numbering/available/{country}/{prefix}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering/available/{country}/{prefix}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/voice/numbering/available/{country}/{prefix}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/voice/numbering/available/{country}/{prefix}', params={

}, headers = headers)

print r.json()

GET /numbering/available/{country}/{prefix}

Get list of available telephone numbers for a country and given prefix

Parameters

Name In Type Required Description
country path string true Country for which querying for available numbers
prefix path string true Prefix within country for which query for available numbers

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK List of available numbers for country and prefix Empty

Get endpoint

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/voice/numbering/{telno} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/voice/numbering/{telno}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering/{telno}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/voice/numbering/{telno}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/voice/numbering/{telno}', params={

}, headers = headers)

print r.json()

GET /numbering/{telno}

Get endpoint for a number

Parameters

Name In Type Required Description
telno path string true Get current endpoint for telephone number

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK Endpoint for number Empty

Update number

Code samples

# You can also use wget
curl -X PUT https://api.melroselabs.com/voice/numbering/{telno} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://api.melroselabs.com/voice/numbering/{telno}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering/{telno}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.put 'https://api.melroselabs.com/voice/numbering/{telno}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.put('https://api.melroselabs.com/voice/numbering/{telno}', params={

}, headers = headers)

print r.json()

PUT /numbering/{telno}

Update endpoint for a number

Parameters

Name In Type Required Description
telno path string true Update current endpoint for a number

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK Endpoint updated for number Empty

Release telephone number

Code samples

# You can also use wget
curl -X DELETE https://api.melroselabs.com/voice/numbering/{telno} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.melroselabs.com/voice/numbering/{telno}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/numbering/{telno}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.delete 'https://api.melroselabs.com/voice/numbering/{telno}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.delete('https://api.melroselabs.com/voice/numbering/{telno}', params={

}, headers = headers)

print r.json()

DELETE /numbering/{telno}

Release a telephone number from your account.

Parameters

Name In Type Required Description
telno path string true Telephone number to delete

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK Telephone number released Empty

Speech-to-Text

Convert speech-to-text

Code samples

# You can also use wget
curl -X POST https://api.melroselabs.com/voice/speechtotext \
  -H 'Content-Type: audio/mp3' \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'audio/mp3',
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.melroselabs.com/voice/speechtotext', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/speechtotext");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'audio/mp3',
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.post 'https://api.melroselabs.com/voice/speechtotext',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'audio/mp3',
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.post('https://api.melroselabs.com/voice/speechtotext', params={

}, headers = headers)

print r.json()

POST /speechtotext

Submit speech to be converted to text. Store as text file.

Body parameter

Parameters

Name In Type Required Description
body body Empty true Speech audio file to be transcribed to text. File in MP3 format.

Example responses

200 Response

{
  "transactionID": "string"
}

Responses

Status Meaning Description Schema
200 OK Speech-to-text request successfully submitted SuccessSubmit
400 Bad Request Failed to submit speech-to-text request Empty

Retrieve text

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/voice/speechtotext/{transactionid} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/voice/speechtotext/{transactionid}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/speechtotext/{transactionid}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/voice/speechtotext/{transactionid}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/voice/speechtotext/{transactionid}', params={

}, headers = headers)

print r.json()

GET /speechtotext/{transactionid}

Retrieve text from previously converted speech-to-text.

Parameters

Name In Type Required Description
transactionid path string true ID of speech-to-text transaction

Example responses

200 Response

{
  "text": "string"
}

Responses

Status Meaning Description Schema
200 OK Successfully retrieved text STTRetrieval
400 Bad Request Unsuccessful retrieving text Error
404 Not Found Text transcribing not complete Error

Text-to-Speech

Convert text-to-speech

Code samples

# You can also use wget
curl -X POST https://api.melroselabs.com/voice/texttospeech \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.melroselabs.com/voice/texttospeech', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/texttospeech");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.post 'https://api.melroselabs.com/voice/texttospeech',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.post('https://api.melroselabs.com/voice/texttospeech', params={

}, headers = headers)

print r.json()

POST /texttospeech

Submit text to be converted to speech. Store as MP3 audio file.

Body parameter

{
  "voiceText": "string",
  "voice": "Zeina"
}

Parameters

Name In Type Required Description
body body SubmitTTSRequest true Text to be converted to speech
» voiceText body string true Text (ASCII) to be converted to speech MP3 audio file
» voice body string false Voice to be used for text-to-speech. Default is Salli (f) and is an English (en-US) language voice. Other choices include: Zeina (f), Arabic (arb); Celine (f), French (fr-FR). See https://melroselabs.com/services/voice-gateway/ for a full list of voices.

Enumerated Values

Parameter Value
» voice Zeina
» voice Zhiyu
» voice Mads
» voice Naja
» voice Lotte
» voice Ruben
» voice Russell
» voice Nicole
» voice Emma
» voice Amy
» voice Brian
» voice Aditi
» voice Raveena
» voice Salli
» voice Ivy
» voice Joanna
» voice Kendra
» voice Kimberly
» voice Joey
» voice Justin
» voice Matthew
» voice Geraint
» voice Celine
» voice Lea
» voice Mathieu
» voice Chantal
» voice Vicki
» voice Marlene
» voice Hans
» voice Karl
» voice Dora
» voice Bianca
» voice Carla
» voice Giogio
» voice Mizuki
» voice Takumi
» voice Seoyeon
» voice Liv
» voice Jan
» voice Ewa
» voice Maja
» voice Jacek
» voice Vitoria
» voice Ricardo
» voice Cristiano
» voice Ines
» voice Carmen
» voice Tatyana
» voice Maxim
» voice Enrique
» voice Lucia
» voice Conchita
» voice Mia
» voice Penelope
» voice Miguel
» voice Astrid
» voice Filiz
» voice Gwyneth

Example responses

200 Response

{
  "transactionID": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful allocation SuccessTTSSubmit
400 Bad Request Failed to fulfil allocation request Error

Retrieve audio file

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/voice/texttospeech/{transactionid} \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/voice/texttospeech/{transactionid}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/voice/texttospeech/{transactionid}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/voice/texttospeech/{transactionid}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/voice/texttospeech/{transactionid}', params={

}, headers = headers)

print r.json()

GET /texttospeech/{transactionid}

Retrieve audio file from previously converted text-to-speech. File is in MP3 format.

Parameters

Name In Type Required Description
transactionid path string true Transaction ID for previously submitted text-to-speech conversion.

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK Successfully retrieved audio file Empty
400 Bad Request Retrieve request failed Error
404 Not Found Audio file not found or not yet ready. Conversion should be available shortly. Error

Schemas

STTRetrieval

{
  "text": "string"
}

STTRetrieval Schema

Properties

Name Type Required Restrictions Description
text string true none Text transcription of the speech-to-text conversion

Empty

{}

Empty Schema

Properties

None

SubmitTTSRequest

{
  "voiceText": "string",
  "voice": "Zeina"
}

SubmitTTSRequest Schema

Properties

Name Type Required Restrictions Description
voiceText string true none Text (ASCII) to be converted to speech MP3 audio file
voice string false none Voice to be used for text-to-speech. Default is Salli (f) and is an English (en-US) language voice. Other choices include: Zeina (f), Arabic (arb); Celine (f), French (fr-FR). See https://melroselabs.com/services/voice-gateway/ for a full list of voices.

Enumerated Values

Property Value
voice Zeina
voice Zhiyu
voice Mads
voice Naja
voice Lotte
voice Ruben
voice Russell
voice Nicole
voice Emma
voice Amy
voice Brian
voice Aditi
voice Raveena
voice Salli
voice Ivy
voice Joanna
voice Kendra
voice Kimberly
voice Joey
voice Justin
voice Matthew
voice Geraint
voice Celine
voice Lea
voice Mathieu
voice Chantal
voice Vicki
voice Marlene
voice Hans
voice Karl
voice Dora
voice Bianca
voice Carla
voice Giogio
voice Mizuki
voice Takumi
voice Seoyeon
voice Liv
voice Jan
voice Ewa
voice Maja
voice Jacek
voice Vitoria
voice Ricardo
voice Cristiano
voice Ines
voice Carmen
voice Tatyana
voice Maxim
voice Enrique
voice Lucia
voice Conchita
voice Mia
voice Penelope
voice Miguel
voice Astrid
voice Filiz
voice Gwyneth

SuccessSubmit

{
  "transactionID": "string"
}

SuccessSubmit Schema

Properties

Name Type Required Restrictions Description
transactionID string true none Transaction ID for text-to-speech conversion

NumberingAllocationRequest

{
  "telNo": "string",
  "sipEndpoint": "string"
}

NumberingAllocationRequest Schema

Properties

Name Type Required Restrictions Description
telNo string true none Telephone number to be allocated. Normally in full international format, beginning with '+'. For example, '+441310001111'.
sipEndpoint string false none The SIP endpoint URI to where incoming calls to the telephone number (telNo) should be routed.

SuccessTTSSubmit

{
  "transactionID": "string"
}

SuccessTTSSubmit Schema

Properties

Name Type Required Restrictions Description
transactionID string true none Transaction ID for text-to-speech conversion

Error

{
  "message": "string"
}

Error Schema

Properties

Name Type Required Restrictions Description
message string true none Will indicate error associate with failed request