Skip to main content

Audio

Text-to-speech for long content, voice and voice style (optional).

Request

POSThttps://api.fliki.ai/v1/generate/audio

Headers

{
"Content-type": "application/json",
"Authorization": "Bearer API_KEY"
}
KeyValueDescription
Content-Typeapplication/jsonSpecifies that the request body format is JSON, allowing the server to parse the data correctly.
AuthorizationBearer YOUR_API_KEYGenerate your API Key in the account/api. section and replace YOUR_API_KEY with your actual key.

Body

{
"webhook": String,
"content": String,
"voiceId": String,
"voiceStyleId": String | null,
"playbackRate": Number,
"format": "mp3" | "wav",
"pronunciations": Array<{ original: String, replace: String }> | undefined
}
KeyTypeDescriptionRequiredDefault
contentstringThe content to be converted, typically text. Must not exceed the 10000 character limit.YesN/A
voiceIdstringThe identifier for the voice to be used for the output.YesN/A
voiceStyleIdstringThe identifier for the style of the voice.-N/A
playbackRatenumberThe playback rate for the audio. Must be between 0.5 and 2.0.-1.0
formatstringThe format of the audio file. Must be one of "mp3" or "wav".-"mp3"
pronunciationsarrayAn optional array of objects containing original and replace strings for pronunciation adjustments.-N/A
webhookstringThe webhook is a public URL from your server that Fliki will call after your content has been generated. It should be a POST method endpoint to receive responses.-N/A

Obtain voiceId and voiceStyleId via the voices endpoint, or copy them from the app. See Finding your IDs.

Response

{
"fileId": String
}
KeyTypeDescription
fileIdstringUnique identifier of the file created

Getting the result

Audio generation is asynchronous. The response above only confirms the job was accepted; it does not contain the audio URL. There are two ways to obtain the finished file:

Poll the status endpoint with the returned fileId:

GET https://api.fliki.ai/v1/generate/status?fileId=<fileId>

Poll every few seconds until status is success, then read the download URL. See Status for the full response shape.

Or use the webhook. If you pass a webhook URL in the request body, Fliki sends a POST to it when the job finishes, so you don't have to poll:

// On success
{
"success": true,
"data": {
"id": String, // the fileId
"file": String // CDN URL of the exported audio
}
}

// On failure
{
"success": false,
"data": {
"id": String // the fileId
}
}

Example

cURL Request
curl \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"content": "...", "voiceId": "...", "voiceStyleId": "..."}' \
-X POST https://api.fliki.ai/v1/generate/audio