Create Record API
This API also allows you to Create a record.
Root
xxxxxxxxxx
https://api.ttskit.com/v1
Route
xxxxxxxxxx
/record
Request Type
xxxxxxxxxx
POST
Request Headers
Below are the list of Accepted Request Headers if you are trying to Create Project.
Request Header | Value | Required |
---|---|---|
X-Master-Key | <API_KEY> | Yes |
X-Master-Key Required
You will need this Key to access mostly any API end-point on TTSKit. You could find the key on the API Key page.
Query String Parameters
Query String Parameter | Value | Required |
---|---|---|
projectId | <Project Id> | Yes |
name | <Record Name> | Yes |
contents | <Record Content> | Yes |
projectId Required
You can add a record to a specific Project. This is helpful when you want to group these records in a specific folder.
You can pass the above parameter along with the Project Id which you could retrieve once you Create a Project.
name Required
Set the Name for the Record. You cannot set a name more than 200 characters.
NoteThe name is unique within the project.
contents Required
The content you want to convert to voice. The content must follow the following format:
xxxxxxxxxx
[
{
"text": "<YOUR CONTENT HERE>",
"blockVolume": "<Volume is a number from zero to 100 where 100 is the maximum value for a voice. It is a linear progression and a value of 50 represents half of the loudest permitted>",
"blockRate": "<The value can range from -10 to +10. A value of zero sets a voice to speak at its default rate. A value of -10 sets a voice to speak at one-third of its default rate. A value of +10 sets a voice to speak at three times its default rate.>",
"blockPitch": "<The value can range from -10 to +10. A value of zero sets a voice to speak at its default pitch. A value of -10 sets a voice to speak at three-fourths of its default pitch. A value of +10 sets a voice to speak at four-thirds of its default pitch.>",
"shortName": "<The voice you want to use to read your content.>"
},
]
Code Samples
- cURL
- Java
- JavaScript (ES6)
- Python 3
- Ruby
xxxxxxxxxx
curl -v\
-H 'X-Master-key: <YOUR_API_KEY>' \
-d '{\
"projectId": "<PROJECT_ID>",\
"name":"Test Record",\
"contents": [\
{\
"text": "Hello, my name is Jenny, I\'m one of the voices that you can use to speech. When I\'m reading your text it sounds like this.",\
"blockVolume": 50,\
"blockRate": 1.0,\
"blockPitch": 1.0,\
"shortName": "en-US-JennyNeural"\
},\
{\
"text": "Hello, my name is Guy, I\'m one of the voices that you can use to speech. When I\'m reading your text it sounds like this.",\
"blockVolume": 50,\
"blockRate": 1.0,\
"blockPitch": 1.0,\
"shortName": "en-US-GuyNeural"\
},\
]}' \
--request POST \
https://api.ttskit.com/v1/record
"text": "Hello, my name is Jenny, I'm one of the voices that you can use to speech. When I'm reading your text it sounds like this.",
"text": "Hello, my name is Jenny, I'm one of the voices that you can use to speech. When I'm reading your text it sounds like this.",
"text": "Hello, my name is Jenny, I'm one of the voices that you can use to speech. When I'm reading your text it sounds like this.",
"text": "Hello, my name is Jenny, I'm one of the voices that you can use to speech. When I'm reading your text it sounds like this.",
Request Response
Success Status Code: 200
xxxxxxxxxx
{
"code": 200,
"message": "Success.",
"status": "success",
"record": {
"id": <ID>,
"name": "Record Name",
"projectId": <PROJECT_ID>,
}
}
Error Status Code: 400, 401, 402, 403, 500
xxxxxxxxxx
{
"code": 400,
"message": "<Error Message>",
"subMessage": "<Error Message Detail>",
"status": "error"
}
For more information on the error codes & errors you might possibly encounter, refer to the below section.
Error Reference
- 400 Bad Request
- 401 UnAuthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
Invalid Route
To solve this issue, simply provide the correct Route.
Ensure your data complies with data constraints
You can refer to "subMessage" for more details.
You need to pass X-Master-Key in the header
You'll encounter this error if you are not passing the X-Master-Key header which is required to authenticate your request. In-order to fix this, pass the X-Master-Key header with a value of the API Key which you can find on the API Keys page.
X-Master-Key passed does not have permission to read the project.
Check if you are passing the right Project Id or the Id is valid but it does not belong to your account.
Currently, The API is only supported for premium users. Upgrade to Premium plan https://ttskit.com/pricing to use these features
You need to upgrade your account to the Premium Plan to use these features.
You are making requests too fast.
Approximately 1 request every 2 seconds.
The Project was not found.
No projects found with matching ID.
InfoText to speech takes a while, you can check the conversion status via Check Record Status