Voice API v2020-08-15T00:09:00Z
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
- API Key (api_key)
- Parameter Name: x-api-key, in: header.
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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'
const fetch = require('node-fetch');
const inputBody = '{
"telNo": "string",
"sipEndpoint": "string"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 | Successfully converted speech-to-text. | Empty |
| 400 | Bad Request | Failed to perform TTS 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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering/available/{country}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering/available/{country}/{prefix}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering/{telno}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering/{telno}',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/numbering/{telno}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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'
const fetch = require('node-fetch');
const inputBody = '{}';
const headers = {
'Content-Type':'audio/mp3',
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/speechtotext',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 with sample rate of 22050 Hz. |
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 |
Convert speech-to-text (pt-BR)
Code samples
# You can also use wget
curl -X POST https://api.melroselabs.com/voice/speechtotext/pt-br \
-H 'Content-Type: audio/mp3' \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
const fetch = require('node-fetch');
const inputBody = '{}';
const headers = {
'Content-Type':'audio/mp3',
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/speechtotext/pt-br',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'audio/mp3',
'Accept': 'application/json',
'x-api-key': 'API_KEY'
}
r = requests.post('https://api.melroselabs.com/voice/speechtotext/pt-br', params={
}, headers = headers)
print r.json()
<?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/pt-br', 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/pt-br");
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/pt-br',
params: {
}, headers: headers
p JSON.parse(result)
POST /speechtotext/pt-br
Submit speech in pt-BR language to be converted to text. Store as text file.
Body parameter
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | Empty | true | Speech audio file in pt-BR language to be transcribed to text. File in MP3 format with sample rate of 22050 Hz. |
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/speechtotext/{transactionid}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 TTS asyncronously
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'
const fetch = require('node-fetch');
const inputBody = '{
"voiceText": "string",
"voice": "Zeina",
"email": "string",
"engine": "standard"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/texttospeech',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
POST /texttospeech
Submit text to be converted to speech. Store as MP3 audio file.
Body parameter
{
"voiceText": "string",
"voice": "Zeina",
"email": "string",
"engine": "standard"
}
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. |
| body | string | false | Email address to where speech MP3 audio file to be sent (optional) | |
| » engine | body | string | false | Engine to be used for voice (optional) |
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 |
| » engine | standard |
| » engine | neural |
Example responses
200 Response
{
"transactionID": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Successfully converted speech-to-text. | SuccessTTSSubmit |
| 400 | Bad Request | Failed to perform TTS 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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/texttospeech/{transactionid}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 |
Convert TTS synchronously
Code samples
# You can also use wget
curl -X POST https://api.melroselabs.com/voice/tts \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
const fetch = require('node-fetch');
const inputBody = '{
"voiceText": "string",
"voice": "Zeina",
"email": "string",
"engine": "standard"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/voice/tts',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'API_KEY'
}
r = requests.post('https://api.melroselabs.com/voice/tts', params={
}, headers = headers)
print r.json()
<?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/tts', 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/tts");
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/tts',
params: {
}, headers: headers
p JSON.parse(result)
POST /tts
Submit text to be converted to speech and return MP3 audio file.
Body parameter
{
"voiceText": "string",
"voice": "Zeina",
"email": "string",
"engine": "standard"
}
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. |
| body | string | false | Email address to where speech MP3 audio file to be sent (optional) | |
| » engine | body | string | false | Engine to be used for voice (optional) |
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 |
| » engine | standard |
| » engine | neural |
Example responses
200 Response
{}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Successfully converted speech-to-text. | Empty |
| 400 | Bad Request | Failed to perform TTS request | 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",
"email": "string",
"engine": "standard"
}
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. |
| string | false | none | Email address to where speech MP3 audio file to be sent (optional) | |
| engine | string | false | none | Engine to be used for voice (optional) |
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 |
| engine | standard |
| engine | neural |
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 |