{"swagger": "2.0", "info": {"title": "CereVoice Cloud API Docs", "description": "The CereVoice Cloud is a text-to-speech (TTS) web service. It can be used to speech enable internet-connected applications via a C/C++, C#, Objective-C, PHP, Java or Python interface, or any other language or technology that supports REST requests. The CereVoice Cloud User Guide describes the CereVoice Cloud API for use by developers, and a set of example programs.", "termsOfService": "https://www.cereproc.com/files/CEREVOICE_CLOUD_SERVICE_COMMERCIAL.pdf", "version": "2.0.0"}, "host": "api.cerevoice.com/v2", "securityDefinitions": {"BasicAuth": {"type": "basic"}, "BearerAuth": {"in": "header", "name": "Authorization", "type": "apiKey"}}, "paths": {"/auth": {"get": {"summary": "Authorize user", "description": "Authorizes a user and returns access and refresh tokens. The endpoint expects encoded credentials to be provided in the Authorization header (as Basic authentication). Follow <a href=\"https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side\"> this article</a> for information on how to encode your credentials.<br> The encoded credentials should consist of your email address and password used when registering on the CereProc website, please note that your username will not work.<br> The returned access token is required in all other endpoints. It expires after 3 hours.<br> The refresh token can be used to get a new access token using <code>/auth/refresh</code> endpoint. Token expires 30 days after last refresh request. Therefore, as long as the token is being refreshed up to every 30 days, the refresh token won't expire unless it is manually expired. Below is an example on how to check if the token has expired:</p> <p id=\"token-validation-py-example-extend\" class=\"extend-el\">Access token expiry check Python example <span class=\"extend\"></span></p> <pre id=\"token-validation-py-example\" class=\"hidden\"></pre><p id=\"token-validation-js-example-extend\" class=\"extend-el\"> Access token expiry check JavaScript example <span class=\"extend\"></span></p> <pre id=\"token-validation-js-example\" class=\"hidden\"></pre>", "security": [{"BasicAuth": []}], "responses": {"200": {"examples": {"application/json": {"access_token": "eyJ0eXAiOiJKV1QiLCJhbG...", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhb..."}}, "description": "OK"}, "400": {"description": "Could not verify the user <br> User could not be logged in: (reason code)"}, "401": {"description": "Bad Authorization header. Expected value 'Basic \\<credentials\\>'"}}, "produces": ["application/json"]}}, "/auth/expire": {"get": {"summary": "Expire tokens", "description": "Manually expires the provided access token and related refresh token. When succeeds, both of the tokens become invalid.", "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"message": "The token has been manually expired"}}, "description": "OK"}, "400": {"description": "The token could not expire"}, "401": {"description": "Bad Authorization header. Expected value 'Bearer \\<JWT\\>' <br> No access token found <br> Access token has expired <br> Access token is invalid"}}, "produces": ["application/json"]}}, "/auth/refresh": {"get": {"summary": "Refresh token", "description": "Provides a new access token using provided refresh token unless it has expired.<br> The refresh token can be received using <code>/auth</code> endpoint.", "parameters": [{"in": "query", "name": "refresh_token", "description": "refresh token provided during initial authorization", "type": "string", "required": true}], "responses": {"200": {"examples": {"application/json": {"access_token": "eyJ0eXAiOiJKV1QiLCJhbG..."}}, "description": "OK"}, "400": {"description": "The refresh token has expired"}}, "produces": ["application/json"]}}, "/speak": {"post": {"summary": "Speak text", "description": "Synthesises input text with the selected voice parameters into speech.<br>CereProc recommends the use of XML input documents,especially the W3C standard <a href=\"https://www.w3.org/TR/speech-synthesis/\"> Speech Synthesis Markup Language</a> (SSML). SSML includes tags for modifying pitch, rate, and pronunciation. It also supports inserting audio, markers, and breaks. XML markup is required for some functionality, such as markers and emotional synthesis. Plain text input is also supported (mixing XML markup within an invalid text document is not recommended).<br><br> <b>Supported SSML Tags:</b> <ul> <li>audio - supported (sample rate should match text-to-speech output setting)</li> <li>break - supported (break strength of \"none\" is not supported)</li> <li>emphasis - supported</li> <li>lexicon - supported (CereProc format)</li> <li>mark - supported</li> <li>meta - ignored</li> <li>metadata - ignored</li> <li>p - supported</li> <li>phoneme - supported (CereProc phone set only)</li> <li>prosody - supported (semitone values are not supported)</li> <li>say-as - supported (VoiceXML builtins are supported, allowing interaction with the output of a VXML recogniser)</li> <li>sub - supported</li> <li>s - supported</li> <li>voice - supported</li> <li>xml:lang - not supported</li> </ul> <p>Go to <a href=\"#post-content\">Additional Input Usage</a> section for more information on using multiple voices and CereProc tag set</p> <br><p><b>Using Metadata</b><br> To obtain the metadata associated with the synthesised input, set the metadata parameter of the endpoint to true. Contained within the response from the CereVoice Cloud, will be a header <code>X-CereVoice-Metadata</code>. This will contain a link to an xml file with speech metadata. Below is an example of the metadata output.</p> <pre>\\<trans\\> <br>    \\<phone name=\"sil\" start=\"0.000\" end=\"0.015\"/\\> <br>    \\<mark name=\"cptk_0_0_5_5\" start=\"0.015\" end=\"0.015\"/\\> <br>    \\<word name=\"hello\" start=\"0.015\" end=\"0.015\"/\\> <br>    \\<phone name=\"h\" start=\"0.015\" end=\"0.183\"/\\> <br>    \\<phone name=\"@\" start=\"0.183\" end=\"0.250\"/\\> <br>    \\<phone name=\"l\" start=\"0.250\" end=\"0.414\"/\\> <br>    \\<phone name=\"ou\" start=\"0.414\" end=\"0.565\"/\\> <br>    \\<mark name=\"cptk_6_6_6_6\" start=\"0.565\" end=\"0.565\"/\\> <br>    \\<word name=\"world\" start=\"0.565\" end=\"0.565\"/\\> <br>    \\<phone name=\"w\" start=\"0.565\" end=\"0.728\"/\\> <br>    \\<phone name=\"@@\" start=\"0.728\" end=\"0.895\"/\\> <br>    \\<phone name=\"l\" start=\"0.895\" end=\"1.088\"/\\> <br>    \\<phone name=\"d\" start=\"1.088\" end=\"1.205\"/\\> <br>    \\<phone name=\"sil\" start=\"1.205\" end=\"1.757\"/\\> <br>    \\<phone name=\"sil\" start=\"1.757\" end=\"1.773\"/\\> <br>    \\<mark name=\"cprc_final\" start=\"1.757\" end=\"1.757\"/\\> <br>\\</trans\\></pre> <p id=\"streaming-example-extend\" class=\"extend-el\">Streaming JavaScript example <span class=\"extend\"></span></p> <pre id=\"streaming-example\" class=\"hidden\"></pre>", "parameters": [{"in": "query", "name": "voice", "description": "Name of the voice to be used for synthesis.", "type": "string", "required": false}, {"in": "query", "name": "audio_format", "description": "The audio format encoding of the returned synthesis. Valid format wav|ogg|mp3, default=wav.", "type": "string", "required": false}, {"in": "query", "name": "sample_rate", "description": "The sample rate to be used for the output audio. When requesting a sample rate that is not available, the audio will be upsampled/downsampled.", "type": "integer", "required": false}, {"in": "query", "name": "metadata", "description": "A boolean value to which can be set to retrieve the metadata associated with the speech.", "type": "boolean", "required": false}, {"in": "query", "name": "language", "description": "language code in iso format", "type": "string", "required": false}, {"in": "query", "name": "accent", "description": "The two-letter CereProc accent code associated with the lexicon file", "type": "string", "required": false}, {"in": "query", "name": "streaming", "description": "A boolean value which when set to false sends a url to the audio file instead of streaming it, default=true", "type": "boolean", "required": false}, {"in": "body", "name": "file", "description": "XML or text input string to synthesise ", "required": true, "schema": {"type": "string", "example": "Text input to synthesise.", "xml": {"wrapped": true, "name": "speak", "namespace": "http://www.w3.org/2001/10/synthesis"}}}], "consumes": ["text/xml", "text/plain"], "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"audio/wav": "audio file", "audio/mpeg": "audio file", "audio/ogg": "audio file", "application/json": {"url": "https://url.to.audio/file"}}, "description": "OK", "headers": {"X-CereVoice-CharCount": {"type": "number", "description": "number of characters used in request"}, "X-CereVoice-Metadata": {"type": "string", "description": "url to synthesis metadata"}}}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["audio/wav", "audio/mpeg", "audio/ogg", "application/json"]}}, "/sing": {"post": {"summary": "Sing text", "description": "Synthesises a song from a music sheet file containing a singing part. The file needs to be in MusicXML format. It will use the tempo marking in bpm provided as one of the parameters if available, otherwise it will default to one specified in the music xml. The singing output can also be transposed by a particular number of half steps. If no part parameter is provided, the default singing part will be identified as one containing most lyrics.", "parameters": [{"in": "query", "name": "voice", "description": "Name of the voice to be used for synthesis.", "type": "string", "required": false}, {"in": "query", "name": "audio_format", "description": "The audio format encoding of the returned synthesis. Valid format wav|ogg|mp3, default=wav.", "type": "string", "required": false}, {"in": "query", "name": "sample_rate", "description": "The sample rate to be used for the output audio. When requesting a sample rate that is not available, the audio will be upsampled/downsampled.", "type": "integer", "required": false}, {"in": "query", "name": "metadata", "description": "A boolean value to which can be set to retrieve the metadata associated with the speech.", "type": "boolean", "required": false}, {"in": "query", "name": "language", "description": "language code in iso format", "type": "string", "required": false}, {"in": "query", "name": "accent", "description": "The two-letter CereProc accent code associated with the lexicon file", "type": "string", "required": false}, {"in": "query", "name": "tempo", "description": "Tempo in BPM. If not specified, defaults to tempo specified in  MusicXML. If that is not available, defaults to 120.", "type": "integer", "required": false}, {"in": "query", "name": "transpose", "description": "Transpose input music by specified number of half steps. Defaults to 0 (no transposition).", "type": "integer", "required": false}, {"in": "query", "name": "part", "description": "Index of part to be synthesised. Defaults to the part containing the most lyrics.", "type": "integer", "required": false}, {"in": "query", "name": "streaming", "description": "A boolean value which when set to false sends a url to the audio file instead of streaming it, default=true", "type": "boolean", "required": false}, {"in": "body", "name": "file", "description": "XML or text input string to synthesise", "required": true, "schema": {"type": "string"}}], "consumes": ["text/xml"], "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"audio/wav": "audio file", "audio/mpeg": "audio file", "audio/ogg": "audio file", "application/json": {"url": "https://url.to.audio/file"}}, "description": "OK", "headers": {"X-CereVoice-CharCount": {"type": "number", "description": "number of characters used in request"}, "X-CereVoice-Metadata": {"type": "string", "description": "url to synthesis metadata"}}}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["audio/wav", "audio/mpeg", "audio/ogg", "application/json"]}}, "/voices": {"get": {"summary": "Get a list of available voices", "description": "Outputs information about the voices available on the Cloud.<br> <b>Voice parameters:</b> <ul> <li>name - name of the voice</li> <li>sample_rate - available sample rates</li> <li>language_iso - the two-letter classification code of the language used by the voice (ISO 639), required for uploading user lexicons and abbreviations</li> <li>country_iso - the two-letter country code for the voice</li> <li>accent_code - the two-letter CereProc accent code for the voice, required for uploading user lexicons</li> <li>gender - the gender of the voice</li> <li>language_ms - the corresponding Microsoft code to the country code</li> <li>country - the country of the voice</li> <li>region - the region of the voice</li> <li>accent - the accent of the voice</li> <li>language - the language of the voice</li> </ul>", "parameters": [{"in": "query", "name": "language", "description": "language code in iso format", "type": "string", "required": false}, {"in": "query", "name": "accent", "description": "The two-letter CereProc accent code associated with the lexicon file", "type": "string", "required": false}, {"in": "query", "name": "gender", "description": "The gender of the voice", "type": "string", "required": false}], "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"voices": [{"name": "Heather", "sample_rate": [16000], "language_iso": "en", "country_iso": "GB", "accent_code": "sc", "gender": "female", "language_ms": "809", "country": "Great Britain", "region": "Scotland", "accent": "Scottish", "language": "English"}]}}, "description": "OK"}, "400": {"description": "No voices have been found"}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["application/json"]}}, "/lexicon": {"get": {"summary": "List available lexicon files", "description": "Lists the custom lexicon files available for synthesis on the CereVoice Cloud.", "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"lexicons": [{"url": "https://url.to.lexicon/file", "language": "en", "accent": "ga", "last_modified": "2019-12-20 09:37:45", "size": 250}]}}, "description": "OK"}, "401": {"description": "Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["application/json"]}, "post": {"summary": "Upload lexicon file", "description": "Uploads and stores a custom lexicon file, to be used with <code>/speak</code></a> endpoint during synthesis. A custom lexicon can be used to add or overridenew pronunciations to the TTS output. Once a user lexicon has been uploaded, it will be used in synthesis withvoices in the specified language and accent. The user lexicon is not shared with other accounts.<br><br> <b>User Lexicon Format</b><br> The user lexicon format consists of a headword and pronunciation, one per line. Example lexicon line (EnglishRP): <br><pre>mourinho m_@@0_r_ii1_n_y_ou2</pre><br><p> The headword should be lower case, and consist of alphabetic characters only (to process a string that includes non-alphabetic characters, use an abbreviations file). Vowel phonemes, such as @@, ii and ou in the example pronunciation, can have stress levels specified. The stress levels are 1 for primary stress, 2 for secondary stress, and 0 for no stress.<br><br>Each accent has a different phone set. Different user lexicons are required for British and American voices, for example. However, the same user lexicon could be used between voices with the same accent, for example the Sarah and William English RP voices. See the <a href=\"https://www.cereproc.com/files/CereVoicePhoneSets.pdf\"> CereVoice Phone Sets</a> document for example pronunciations.", "parameters": [{"in": "query", "name": "language", "description": "language code in iso format", "type": "string", "required": true}, {"in": "query", "name": "accent", "description": "The two-letter CereProc accent code associated with the lexicon file", "type": "string", "required": true}, {"in": "body", "name": "file", "description": "Custom user lexicon ", "required": true, "schema": {"type": "string", "example": "mourinho m_@@0_r_ii1_n_y_ou2"}}], "consumes": ["text/plain"], "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"message": "The lexicon file has been uploaded successfully"}}, "description": "OK"}, "400": {"description": "The lexicon file could not be uploaded"}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["application/json"]}}, "/abbreviations": {"get": {"summary": "List available abbreviation files", "description": "Lists the custom abbreviation files that are available for synthesis on the CereVoice Cloud.", "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"abbreviations": [{"url": "https://url.to.abbreviation/file", "language": "en", "last_modified": "2019-12-20 09:37:43", "size": 250}]}}, "description": "OK"}, "401": {"description": "Access token has expired <br> Access token is invalid"}}, "produces": ["application/json"]}, "post": {"summary": "Upload abbreviation file", "description": "Uploads and stores a custom abbreviation file, to be used with <code>/speak</code> endpoint during synthesis. User abbreviations can be used to expand mixed case tokens, or tokens including digits, into words. Once a custom abbreviation file has been uploaded, it will be used in synthesis with voices in the specified language.<br><br><b>User Abbreviations Format</b><br> The user lexicon format consists of a token, no break flag, and replacement text, line-by-line. Example entries (taken from the current CereProc abbreviation list): <pre>3G      0    three g <br>7/11    0    seven eleven <br>Dr      1    doctor <br>FAQ     0    f a:letter q</pre><br><p> The first column is a whitespace-delimited token in the input text. The second column, the no break flag, describes the handling of punctuation following the token. When set to 1, following punctuation is ignored. In the examples, this would cause \"Dr. Johnson\" to be read without a pause between the words.<br> Some languages, such as English, have single letters that can be pronounced differently in an acronym compared to free text. The letter pronunciation can be ensured by adding :letter after the letter (see the example for FAQ).</p>", "parameters": [{"in": "query", "name": "language", "description": "language in iso format", "type": "string", "required": true}, {"in": "body", "name": "file", "description": "Custom user abbreviations ", "required": true, "schema": {"type": "string", "example": "3G      0    three g"}}], "consumes": ["text/plain"], "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"message": "The abbreviations file has been uploaded successfully"}}, "description": "OK"}, "400": {"description": "The abbreviations file could not be uploaded"}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid"}}, "produces": ["application/json"]}}, "/credit": {"get": {"summary": "Get credit", "description": "Retrieves the credit information for the given account. 1 credit = 1 character of text input.<br><br> Free credit is deducted first, until there is no free credit remaining, at which point the paid credit will be deducted for subsequent synthesis requests. The free credit amount is reset at the start of each month.", "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"free_credit": 1000, "paid_credit": 1000, "total": 2000}}, "description": "OK"}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["application/json"]}}, "/credit-threshold": {"get": {"summary": "Get credit threshold", "description": "Retrieves the credit threshold, which specifies at which amount of credits email alerts will be sent out. Amount will be equal to 0 if none was set.", "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"credit_threshold": 100}}, "description": "OK"}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["application/json"]}, "post": {"summary": "Set credit threshold", "description": "Sets the credit threshold, which specifies at which amount of credits email alerts will be sent out. To remove the alert, set the threshold to 0.", "parameters": [{"in": "query", "name": "amount", "description": "credit threshold", "type": "integer", "required": false}], "security": [{"BearerAuth": []}], "responses": {"200": {"examples": {"application/json": {"message": "The credit threshold was set successfully"}}, "description": "OK"}, "400": {"description": "The credit threshold could not be set"}, "401": {"description": "No access token found <br> Access token has expired <br> Access token is invalid <br> Bad Authorization header. Expected value 'Bearer \\<JWT\\>'"}}, "produces": ["application/json"]}}}}
