We provide comprehensive documentation, including API specifications, libraries, code samples for all the main languages, and details on the operation of services. We want to ensure you have whatever helps you make best use of our services.
If you have any questions, please email support@melroselabs.com or submit a support request.
Tools to help you develop, test and integrate.
SMPP SMSC simulator to test SMS messaging applications. Generate MO SMS using Inbound MO SMS Tool or SMPP.
Tools for developers and operations teams building, deploying and maintaining applications that support RCS.
SMPP client for testing with SMS gateways and SMSCs from a web browser. Supports SMPP v3.3, v3.4 and v5.
Simulate RCS messaging between a chatbot and a chatbot server, and between a chatbot and a user's mobile.
SMPP compliance and performance testing of SMSCs, SMS gateways and apps. Includes testing SMPP version support and performing load testing.
Melrose Labs command-line tool for use with our voice, messaging, video and identity APIs. (MelroseLabs-CLI on NPM )
Others: Compression, Notification Gateway, Identity
Get an API key for use with our voice, messaging, video and identity APIs.
SIGN-UP | LOGIN TO GET API KEYOur service documentation for developers provides indepth documentation on each of our services, including quickstart guides, tutorials, code samples, configuration examples and technical descriptions.
REST API documentation can be found at Rich Messaging API - Cards
Create a card using a template and get URL of new card.
Request:
curl https://api.melroselabs.com/richmessaging/card/ \
--header 'x-api-key: [API_KEY]' --header 'Content-Type: application/json' \
--data-raw '{"templateref":"10","data":{"propertyname":"Santorini Escape","urlimage":"https://richmsg.io/media/images/seaview-apartments.png","propertysummary":"A luxurious two-bedroom apartment with the best views over Santorini.","urldetails":"https://melroselabs.com/services/rich-messaging/","urlbooknow":"https://melroselabs.com/services/rich-messaging/"},"userref":"","callback":"","expires":""}'
Response:
{ "messageID": "lpB", "shortURL": "https://richmsg.io/lpB" }
Request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.melroselabs.com/richmessaging/card/',
'headers': {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({"templateref":"10","data":{"propertyname":"Santorini Escape","urlimage":"https://richmsg.io/media/images/seaview-apartments.png","propertysummary":"A luxurious two-bedroom apartment with the best views over Santorini.","urldetails":"https://melroselabs.com/services/rich-messaging/","urlbooknow":"https://melroselabs.com/services/rich-messaging/"},"userref":"","callback":"","expires":""})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type application/json
});
Response:
{ "messageID": "lpB", "shortURL": "https://richmsg.io/lpB" }
Request:
import requests
import json
url = "https://api.melroselabs.com/richmessaging/card/"
payload = {
{"templateref":"10","data":{"propertyname":"Santorini Escape","urlimage":"https://richmsg.io/media/images/seaview-apartments.png","propertysummary":"A luxurious two-bedroom apartment with the best views over Santorini.","urldetails":"https://melroselabs.com/services/rich-messaging/","urlbooknow":"https://melroselabs.com/services/rich-messaging/"},"userref":"","callback":"","expires":""}
}
headers = {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = json.dumps(payload))
# response is of type application/json
print(response.text.encode('utf8'))
Response:
{ "messageID": "lpB", "shortURL": "https://richmsg.io/lpB" }
Request:
<?php
$data = {"templateref":"10","data":{"propertyname":"Santorini Escape","urlimage":"https://richmsg.io/media/images/seaview-apartments.png","propertysummary":"A luxurious two-bedroom apartment with the best views over Santorini.","urldetails":"https://melroselabs.com/services/rich-messaging/","urlbooknow":"https://melroselabs.com/services/rich-messaging/"},"userref":"","callback":"","expires":""}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/richmessaging/card/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]",
"Content-Type: application/json"
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type application/json
?>
Response:
{ "messageID": "lpB", "shortURL": "https://richmsg.io/lpB" }
The following card templates can be used with Rich Messaging API - Cards
Property lettings card used to promote a property.
propertyname
Name of the property being let.
urlimage
URL of the image to be displayed on the card. Image should be under 2MB.
propertysummary
A brief description of the property.
urldetails
URL of web page with more details on the property.
urlbooknow
URL of web page where property can be booked.
{
"propertyname": "Santorini Escape",
"urlimage": "https://richmsg.io/media/images/seaview-apartments.png",
"propertysummary": "A luxurious two-bedroom apartment with the best views over Santorini.",
"urldetails": "https://melroselabs.com/services/rich-messaging/",
"urlbooknow": "https://melroselabs.com/services/rich-messaging/"
}
Property for sale card.
status
Status of the property sale (e.g. FOR SALE).
propertyname
Name of the property being sold.
urlimage
URL of image of the property.
price
Sale price of property
propertysummary
A brief description of the property.
propertydescription
A long description of the property.
urldetails
URL of web page with more details on the property.
urlarrangeviewing
URL of web page where property viewing can be arranged.
{
"status": "FOR SALE",
"urlimage": "https://richmsg.io/media/images/propertyforsale.jpeg",
"urlarrangeviewing": "https://abc.com",
"urldetails": "https://abc.com",
"propertyname": "Caldergrove Gardens, EH11",
"price": "\u00a3292,000",
"propertysummary": "3 bedrooms. New development.",
"propertydescription": "Caldergrove Gardens is an innovative and stylish development of 55, 3, 4 & 5 bedroom detached homes, offering seven contemporary house styles. Show home open Thursday - Monday."
}
Promotion for use in retail by consumer.
urllogo
URL of the logo to be displayed on the card. Image should be under 2MB.
promotitle
Title of the promotion.
subtitle
Subtitle of the promotion.
urlimage
URL of the image to be displayed on the card. Image should be under 2MB.
details
A brief description of the promotion.
actiontext
Text on button that user clicks to order, book or find out more.
urlaction
URL of web page where user can order, book or find out more.
additionaltext
Any additional details regarding the promotion.
{
"urllogo": "https://richmsg.io/media/images/pizza-logo.png",
"promotitle": "Pizza Tuesday",
"subtitle": "Buy one and get one free!",
"urlimage": "https://richmsg.io/media/images/pizza.jpeg",
"details": "When you order one large pizza on Tuesdays, we will give you another large pizza of your choice for free. Terms and conditions apply.",
"actiontext": "Order Now",
"urlaction": "https://abc.com",
"additionaltext": "Terms and Conditions Apply"
}
Ticket card for an event.
event
Name of the event for the ticket.
subtitle
Subtitle of the event for the ticket.
urlimage
URL of the image to be displayed on the ticket.
datetime
Date and time of the event.
venue
Where the event is taking place.
seat
Seat allocated to this ticket.
instructions
Instructions associated with ticket and event.
{
"event": "Strictly Dancing",
"subtitle": "Christmas Tour",
"urlimage": "https://melroselabs.com/phpqrcode/qrimg.php?qr=abc",
"datetime": "23 Jan 2020, 7pm",
"venue": "Dome, Glasgow, G1 1AB",
"instructions": "Arrive 30 minutes prior to the performance for security checks.",
"seat": "Q32",
"urlaction": "https://abc.com"
}
Coupon card for use in retail with consumers.
logo
URL of the logo image to be displayed on the coupon.
coupontitle
Title to show on the coupon.
subtitle
Subtitle of the coupon.
couponnumber
Text showing coupon number. Can contain letters and numbers.
validuntildatetime
Date and time the the coupon is valid until.
validlocations
Locations at which the coupon is valid.
details
Details on the use of this coupon for the holder of the coupon.
{
"logo": "https://richmsg.io/media/images/sf-logo.png",
"coupontitle": "Sainsfield Coupon",
"subtitle": "Use this coupon to receive 5% discount on your next shop!",
"couponnumber": "9823782738213",
"validuntildatetime": "23 Jan 2020, 7pm",
"validlocations": "All UK stores",
"details": "Show this coupon when you go to the checkout to receive your discount."
}
Card template to encourage customers to make reservations.
topImage
URL of the image to be displayed.
restaurantName
Name of restaurant.
ratingValue
Average rating from reviewers
reviewCount
Number of reviews
message
Message to show encouraging patron to book.
timeWhenAvailability
Title showing when times are available (e.g. "Tonight's availability")
timeSlotA
Time for slot (e.g. "5:00")
timeSlotB
Time for slot (e.g. "5:00")
timeSlotC
Time for slot (e.g. "5:00")
timeSlotD
Time for slot (e.g. "5:00")
timeSlotE
Time for slot (e.g. "5:00")
timeSlotF
Time for slot (e.g. "5:00")
urlActionA
Website link (URL) that user is taken to when they click on the button for this time slot.
urlActionB
Website link (URL) that user is taken to when they click on the button for this time slot.
urlActionC
Website link (URL) that user is taken to when they click on the button for this time slot.
urlActionD
Website link (URL) that user is taken to when they click on the button for this time slot.
urlActionE
Website link (URL) that user is taken to when they click on the button for this time slot.
urlActionF
Website link (URL) that user is taken to when they click on the button for this time slot.
{
"restaurantName": "Benedicts restaurant",
"topImage": "https://richmsg.io/media/images/restaurant-burger-meal.jpg",
"ratingValue": 4.5,
"reviewCount": 319,
"message": "We're open tonight and all burger meals have 10% discount. Book a table before they go!",
"timeWhenAvailability": "Tonight's availability",
"timeSlotA": "5:30",
"urlActionA": "https://abc.com/A",
"timeSlotB": "7:30",
"urlActionB": "https://abc.com/B",
"timeSlotC": "8:00",
"urlActionC": "https://abc.com/C",
"timeSlotD": "8.30",
"urlActionD": "https://abc.com/D",
"timeSlotE": "9:00",
"urlActionE": "https://abc.com/E",
"timeSlotF": "other",
"urlActionF": "https://abc.com/F"
}
Create a message for delivery and get transaction ID for submission.
JSON request:
{
"account": {
"accountid": "abcd-abcd0123-abcd"
},
"message": {
"variants": [
{
"channel": "twitter",
"content": [
{
"ctype": "text",
"cdata": "Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."
},
{
"ctype": "image",
"cdata": "https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"
}
]
},
{
"channel": "sms",
"content": [
{
"ctype": "text",
"cdata": "Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."
}
]
},
{
"channel": "mms",
"content": [
{
"ctype": "text",
"cdata": "Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."
},
{
"ctype": "image",
"cdata": "https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"
}
]
}
]
},
"recipients": [
"twitter:melroselabs",
"sms:+447968847040",
"mms:+447720334455"
]
}
Request:
curl https://api.melroselabs.com/notification/ \
--header 'x-api-key: [API_KEY]' --header 'Content-Type: application/json' \
--data-raw '{"account":{"accountid":"abcd-abcd0123-abcd"},"message":{"variants":[{"channel":"twitter","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]},{"channel":"sms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."}]},{"channel":"mms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]}]},"recipients":["twitter:melroselabs","sms:+447968847040","mms:+447720334455"]}'
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f" }
Request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.melroselabs.com/notification/',
'headers': {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({"account":{"accountid":"abcd-abcd0123-abcd"},"message":{"variants":[{"channel":"twitter","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]},{"channel":"sms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."}]},{"channel":"mms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]}]},"recipients":["twitter:melroselabs","sms:+447968847040","mms:+447720334455"]})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type application/json
});
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f" }
Request:
import requests
import json
url = "https://api.melroselabs.com/notification/"
payload = {
{"account":{"accountid":"abcd-abcd0123-abcd"},"message":{"variants":[{"channel":"twitter","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]},{"channel":"sms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."}]},{"channel":"mms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]}]},"recipients":["twitter:melroselabs","sms:+447968847040","mms:+447720334455"]}
}
headers = {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = json.dumps(payload))
# response is of type application/json
print(response.text.encode('utf8'))
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f" }
Request:
<?php
$data = {"account":{"accountid":"abcd-abcd0123-abcd"},"message":{"variants":[{"channel":"twitter","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]},{"channel":"sms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."}]},{"channel":"mms","content":[{"ctype":"text","cdata":"Nicola Sturgeon says she will not hesitate to use the law to enforce group sizes and travel distances after traffic around beauty spots and a five-fold rise in police dispersal orders is seen."},{"ctype":"image","cdata":"https://blogs.gov.scot/fairer-scotland/wp-content/uploads/sites/32/2017/04/22847857088_b1c3f67f4a_z.jpg"}]}]},"recipients":["twitter:melroselabs","sms:+447968847040","mms:+447720334455"]}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/notification/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]",
"Content-Type: application/json"
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type application/json
?>
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f" }
Submit message for delivery and get transaction ID for submission. This request submits a message for delivery to three mobile numbers (up to 250,000 mobile numbers can be submitted in one request). The submit window size is set to 10 messages and the number of binds that will be used is set to 1.
This request will result in:
smpp.sms.melroselabs.com:8775
using a TLS connection.JSON request:
{
"smpp_account_config": {
"host": "smpp.sms.melroselabs.com",
"port": 8775,
"use_tls": true,
"smpp_version": 5,
"system_id": "SYSTEMID",
"password": "PASSWORD"
},
"submit_options": {
"windowSizeSubmitSM": 10,
"quantityBindSessions": 1
},
"message": {
"source_addr": "MelroseLabs",
"source_addr_ton": 5,
"source_addr_npi": 0,
"registered_delivery": 1,
"short_message": {
"text": "Melrose Labs engineer great communication services."
}
},
"destinations": [
"447968847040",
"15005552361",
"390611100000"
]
}
Request:
curl https://api.melroselabs.com/restsmpp/message/ \
--header 'x-api-key: [API_KEY]' --header 'Content-Type: application/json' \
--data-raw '{"smpp_account_config":{"host":"smpp.sms.melroselabs.com","port":8775,"use_tls":true,"smpp_version":5,"system_id":"SYSTEMID","password":"PASSWORD"},"submit_options":{"windowSizeSubmitSM":10,"quantityBindSessions":1},"message":{"source_addr":"MelroseLabs","source_addr_ton":5,"source_addr_npi":0,"registered_delivery":1,"short_message":{"text":"Melrose Labs engineer great communication services."}},"destinations":["447968847040","15005552361","390611100000"]}'
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f", "messageID":["abcd0001","abcd0002","abcd0003"] }
Request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.melroselabs.com/restsmpp/message/',
'headers': {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({"smpp_account_config":{"host":"smpp.sms.melroselabs.com","port":8775,"use_tls":true,"smpp_version":5,"system_id":"SYSTEMID","password":"PASSWORD"},"submit_options":{"windowSizeSubmitSM":10,"quantityBindSessions":1},"message":{"source_addr":"MelroseLabs","source_addr_ton":5,"source_addr_npi":0,"registered_delivery":1,"short_message":{"text":"Melrose Labs engineer great communication services."}},"destinations":["447968847040","15005552361","390611100000"]})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type application/json
});
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f", "messageID":["abcd0001","abcd0002","abcd0003"] }
Request:
import requests
import json
url = "https://api.melroselabs.com/restsmpp/message/"
payload = {
{"smpp_account_config":{"host":"smpp.sms.melroselabs.com","port":8775,"use_tls":true,"smpp_version":5,"system_id":"SYSTEMID","password":"PASSWORD"},"submit_options":{"windowSizeSubmitSM":10,"quantityBindSessions":1},"message":{"source_addr":"MelroseLabs","source_addr_ton":5,"source_addr_npi":0,"registered_delivery":1,"short_message":{"text":"Melrose Labs engineer great communication services."}},"destinations":["447968847040","15005552361","390611100000"]}
}
headers = {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = json.dumps(payload))
# response is of type application/json
print(response.text.encode('utf8'))
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f", "messageID":["abcd0001","abcd0002","abcd0003"] }
Request:
<?php
$data = {"smpp_account_config":{"host":"smpp.sms.melroselabs.com","port":8775,"use_tls":true,"smpp_version":5,"system_id":"SYSTEMID","password":"PASSWORD"},"submit_options":{"windowSizeSubmitSM":10,"quantityBindSessions":1},"message":{"source_addr":"MelroseLabs","source_addr_ton":5,"source_addr_npi":0,"registered_delivery":1,"short_message":{"text":"Melrose Labs engineer great communication services."}},"destinations":["447968847040","15005552361","390611100000"]}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/restsmpp/message/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]",
"Content-Type: application/json"
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type application/json
?>
Response:
{ "transactionID": "41123b82-9f43-4ff8-8c01-0b4ce2bced6f", "messageID":["abcd0001","abcd0002","abcd0003"] }
REST API documentation can be found at Voice API - Text-to-Speech
Submit conversion request and retrieve resulting speech.
Request:
curl https://api.melroselabs.com/voice/tts/ \
--header 'x-api-key: [API_KEY]' --header 'Content-Type: application/json' \
--data-raw '{"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"}'
Response:
MP3 file
Request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.melroselabs.com/voice/tts/',
'headers': {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type audio/mp3
});
Response:
MP3 file
Request:
import requests
import json
url = "https://api.melroselabs.com/voice/tts/"
payload = {
{"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"}
}
headers = {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = json.dumps(payload))
# response is of type audio/mp3
print(response.content)
Response:
MP3 file
Request:
<?php
$data = {"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/voice/tts/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]",
"Content-Type: application/json"
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type audio/mp3
?>
Response:
MP3 file
The asyncronous method is a two step process involving the submitting of the conversion request and then the retrieval of the result.
1. Submit conversion request.
Request:
curl https://api.melroselabs.com/voice/texttospeech/ \
--header 'x-api-key: [API_KEY]' --header 'Content-Type: application/json' \
--data-raw '{"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"}'
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.melroselabs.com/voice/texttospeech/',
'headers': {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type application/json
});
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Request:
import requests
import json
url = "https://api.melroselabs.com/voice/texttospeech/"
payload = {
{"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"}
}
headers = {
'x-api-key': '[API_KEY]',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = json.dumps(payload))
# response is of type application/json
print(response.text.encode('utf8'))
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Request:
<?php
$data = {"voiceText": "Welcome Allan. The event for today will begin at 9.30am in room H32.", "voice": "Emma"}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/voice/texttospeech/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]",
"Content-Type: application/json"
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type application/json
?>
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
2. Retrieve resulting speech.
Request:
curl --location --request GET https://api.melroselabs.com/voice/texttospeech/1ccead78-6550-4aac-a6b4-a4942b908659 \
--header 'x-api-key: [API_KEY]'
Response:
MP3 file
Request:
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.melroselabs.com/voice/texttospeech/1ccead78-6550-4aac-a6b4-a4942b908659',
'headers': {
'x-api-key': '[API_KEY]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type audio/mp3
});
Response:
MP3 file
Request:
import requests
import json
url = "https://api.melroselabs.com/voice/texttospeech/1ccead78-6550-4aac-a6b4-a4942b908659"
headers = {
'x-api-key': '[API_KEY]'
}
response = requests.request("GET", url, headers=headers)
# response is of type audio/mp3
print(response.content)
Response:
MP3 file
Request:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/voice/texttospeech/1ccead78-6550-4aac-a6b4-a4942b908659",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]" )
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type audio/mp3
?>
Response:
MP3 file
Email can be used to easily and quickly perform a text-to-speech (TTS) conversion as an alternative to using REST HTTPS calls to the Voice API. Send an email to the Text-to-Speech service at voice@api.melroselabs.com and use the subject field to contain the text you wish converted. After a number of seconds, you will receive an email back from the service with an MP3 file containing the converted speech.
Various voices and corresponding languages are available using email addresses specific to each voice. The format of each email address is voice.language.voice@api.melroselabs.com
and the options for voice and language are shown in the list of available languages and voices.
An API key is currently not required when using email.
The following languages and voices are available using the Text-to-Speech service:
Language | Voice | Sample | Email (example) |
---|---|---|---|
Arabic (arb) | Zeina (f) | zeina.arb.voice@api.melroselabs.com | |
Chinese, Mandarin (cmn-CN) | Zhiyu (f) | zhiyu.cmn-cn.voice@api.melroselabs.com | |
Danish (da-dk) | Mads (m) Naja (f) | mads.da-dk.voice@api.melroselabs.com | |
Dutch (nl-nl) | Lotte (f) Ruben (m) | lotte.nl-nl.voice@api.melroselabs.com | |
English, Australian (en-AU) | Russell (m) Nicole (f) | russell.en-au.voice@api.melroselabs.com | |
English (en-GB)² | Emma (f) Amy (f) Brian (m) | emma.en-gb.voice@api.melroselabs.com | |
English, Indian (en-IN) | Aditi (f) Raveena (f) | aditi.en-in.voice@api.melroselabs.com | |
English (en-US)² | Salli (f)¹ Ivy (f) Joanna (f) Kendra (f) Kimberly (f) Joey (m) Justin (m) Matthew (m) | salli.en-us.voice@api.melroselabs.com | |
English, Welsh (en-GB-WLS) | Geraint (m) | geraint.en-gb-wls.voice@api.melroselabs.com | |
French (fr-FR) | Céline/Celine (f) Léa/Lea (f) Mathieu (m) | celine.fr-fr.voice@api.melroselabs.com | |
French, Canadian (fr-CA) | Chantal (f) | chantal.fr-ca.voice@api.melroselabs.com | |
Germany (de-DE) | Vicki (f) Marlene (f) Hans (m) | vicki.de-de.voice@api.melroselabs.com | |
Hindi (hi-IN) | Aditi (f) | aditi.hi-in.voice@api.melroselabs.com | |
Icelandic (is-IS) | Karl (m) Dóra/Dora (f) | karl.is-is.voice@api.melroselabs.com | |
Italian (it-IT) | Bianca (f) Carla (f) Giorgio (m) | bianca.it-it.voice@api.melroselabs.com | |
Japanese (ja-JP) | Mizuki (f) Takumi (m) | mizuki.ja-jp.voice@api.melroselabs.com | |
Korean (ko-KR) | Seoyeon (f) | seoyeon.ko-kr.voice@api.melroselabs.com | |
Norwegian (nb-NO) | Liv (f) | liv.nb-no.voice@api.melroselabs.com | |
Polish (pl-PL) | Jan (m) Ewa (f) Maja (f) Jacek (m) | jan.pl-pl.voice@api.melroselabs.com | |
Portuguese (pt-BR) | Camila² (f) Vitória/Vitoria (f) Ricardo (m) | vitoria.pt-br.voice@api.melroselabs.com | |
Portuguese (pt-PT) | Cristiano (m) Inês/Ines (f) | cristiano.pt-pt.voice@api.melroselabs.com | |
Romanian (ro-RO) | Carmen (f) | carmen.ro-ro.voice@api.melroselabs.com | |
Russian (ru-RU) | Tatyana (f) Maxim (m) | tatyana.ru-ru.voice@api.melroselabs.com | |
Spanish (es-ES) | Enrique (m) Lucia (f) Conchita (f) | enrique.es-es.voice@api.melroselabs.com | |
Spanish (es-MX) | Mia (f) | mia.es-mx.voice@api.melroselabs.com | |
Spanish (es-US) | Lupe² (f) Penélope/Penelope (f) Miguel (m) | penelope.es-us.voice@api.melroselabs.com | |
Swedish (sv-SE) | Astrid (f) | astrid.sv-se.voice@api.melroselabs.com | |
Turkish (tr-TR) | Filiz (f) | filiz.tr-tr.voice@api.melroselabs.com | |
Welsh (cy-GB) | Gwyneth (f) | gwyneth.cy-gb.voice@api.melroselabs.com |
¹ Default voice. Used for voice@api.melroselabs.com
or when no voice is specified during a Voice API REST call.
² Will use neural engine unless standard engine is requested.
REST API documentation can be found at Voice API - Speech-to-Text
Submit conversion request.
Request:
curl https://api.melroselabs.com/voice/speechtotext/ \
--header 'x-api-key: [API_KEY]' --header 'Content-Type: audio/mp3' \
--data-binary 'MP3-FILE'
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.melroselabs.com/voice/speechtotext/',
'headers': {
'x-api-key': '[API_KEY]',
'Content-Type': 'audio/mp3'
},
body: JSON.stringify(MP3-FILE)
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type application/json
});
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Request:
import requests
import json
url = "https://api.melroselabs.com/voice/speechtotext/"
payload = {
MP3-FILE
}
headers = {
'x-api-key': '[API_KEY]',
'Content-Type': 'audio/mp3'
}
response = requests.request("POST", url, headers=headers, data = json.dumps(payload))
# response is of type application/json
print(response.text.encode('utf8'))
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Request:
<?php
$data = array("name"=>"file","file"=>"@FILE")
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/voice/speechtotext/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_SAFE_UPLOAD => FALSE,
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]",
"Content-Type: audio/mp3"
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type application/json
?>
Response:
{"transactionID": "1ccead78-6550-4aac-a6b4-a4942b908659"}
Retrieve text of speech.
Request:
curl --location --request GET https://api.melroselabs.com/voice/speechtotext/1ccead78-6550-4aac-a6b4-a4942b908659 \
--header 'x-api-key: [API_KEY]'
Response:
{"text": "Alice was beginning to get very tired of sitting by her sister on the bank and of having nothing to do."}
Request:
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.melroselabs.com/voice/speechtotext/1ccead78-6550-4aac-a6b4-a4942b908659',
'headers': {
'x-api-key': '[API_KEY]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body); // response is of type application/json
});
Response:
{"text": "Alice was beginning to get very tired of sitting by her sister on the bank and of having nothing to do."}
Request:
import requests
import json
url = "https://api.melroselabs.com/voice/speechtotext/1ccead78-6550-4aac-a6b4-a4942b908659"
headers = {
'x-api-key': '[API_KEY]'
}
response = requests.request("GET", url, headers=headers)
# response is of type application/json
print(response.text.encode('utf8'))
Response:
{"text": "Alice was beginning to get very tired of sitting by her sister on the bank and of having nothing to do."}
Request:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.melroselabs.com/voice/speechtotext/1ccead78-6550-4aac-a6b4-a4942b908659",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-api-key: [API_KEY]" )
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; // response is of type application/json
?>
Response:
{"text": "Alice was beginning to get very tired of sitting by her sister on the bank and of having nothing to do."}
Repositories available: