v1
This version will be supported until 01.02.2025
Speech to text
POST
/stt
Submit a speech-to-text transcription request.
Headers
Content-Type
multipart/form-data
Body
keyId
string
Your API key
audio
file
The content of the audio to be transcribed
callback_url
url
URL to be called once status
changes
callback_info_only
boolean
Weather to return just the callbackID
and status
to callback_url
word_timestamps
boolean
Weather to include timestamps for each word
Response
{
"callbackID": "ID of the callback"
}
Example
const axios = require('axios');
const fs = require('fs');
const apiPrefix = process.env.NEURA_API_PREFIX;
const apiKey = process.env.NEURA_API_KEY;
const url = `${apiPrefix}/stt`;
const audioFile = fs.createReadStream('path/to/audio/file');
const formData = new FormData();
formData.append('audio', audioFile);
formData.append('keyId', apiKey);
formData.append('callback_url', 'https://example.com/callback');
formData.append('callback_info_only', true);
formData.append('word_timestamps', true);
axios.post(url, formData)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Text to speech
POST
/tts
Submit a text-to-speech request
Headers
Content-Type
application/json
Body
keyId
string
Your API key
text
string
The text you want to convert to speech
speaker
ENUM ['f1', f2', 'f3', 'f4', 'm1', 'm2', 'm3', 'm4']
The speaker you want to use
callback_url
url
URL to be called once status
changes
callback_info_only
boolean
Weather to return just the callbackID
and status
to callback_url
Response
{
"callbackID": "ID of the callback"
}
Example
const axios = require('axios');
const apiPrefix = process.env.NEURA_API_PREFIX;
const apiKey = process.env.NEURA_API_KEY;
const url = `${apiPrefix}/tts`;
const data = {
keyId: apiKey,
text: 'The text you want to convert to speech',
speaker: 'f1',
callback_url: 'https://example.com/callback',
callback_info_only: true
};
axios.post(url, data)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Callback status
POST
/callback/status
Check the result of a specific callback
Headers
Content-Type
application/json
Body
keyId
string
Your API key
callbackId
string
Callback ID to be checked
result_as
ENUM ["json", "txt","srt", "srt_words"]
How to format the response for Speech to text:
“json”
→ returns a json element
“txt”
→ returns a txt element
“srt”
→ returns a srt compatible file with segments
“srt_words”
→ returns a srt compatible file with each word as a segment
Response
{
"status": ENUM["done","processing","failed"],
"data": "response if status is done"
}
Example
const axios = require('axios');
const apiPrefix = process.env.NEURA_API_PREFIX;
const apiKey = process.env.NEURA_API_KEY;
const callbackId = 'your_callback_id';
const url = `${apiPrefix}/callback/status`;
const data = {
keyId: apiKey,
callbackId: callbackId
};
axios.post(url, data)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
List
POST
/list
List the operations performed in the API
Headers
Content-Type
application/json
Body
keyId
string
Your API key
count
number
Number of elements to retrieve
status
ENUM ["processing", "success", "failed"]
Filter by status of the requests
type
ENUM ["stt-api", "tts-api"]
Filter by type of request
include_body
boolean
Weather to return the response (Default = False
)
Response
[
{
"id": "callbackId",
"type": "tts-api",
"status": 1
},
...
{
"id": "callbackId",
"type": "stt-api",
"status": 0
},
]
Example
const axios = require('axios');
const apiPrefix = process.env.NEURA_API_PREFIX;
const apiKey = process.env.NEURA_API_KEY;
const includeBody = true; // Set to true or false based on your requirement
const url = `${apiPrefix}/list`;
const data = {
keyId: apiKey,
count: 10, // Optional: Number of elements to retrieve
status: 'success', // Optional: Filter by status of the requests
type: 'stt-api', // Optional: Filter by type of request
include_body: includeBody
};
axios.post(url, data)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Last updated
Was this helpful?