Skip to content

TTS REST APIs

List all available TTS models

1
GET https://api.prosa.ai/v2/speech/tts/models

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[
  {
    "name": "tts-dimas-formal",
    "label": "TTS Dimas Formal",
    "language": "Bahasa Indonesia",
    "domain": "formal",
    "voice": "Dimas",
    "gender": "male",
    "channels": 1,
    "samplerate": 48000
  }
]

Responses

Status Meaning Description Schema
200 OK Successful Response TtsModelList
401 Unauthorized Unauthorized
403 Forbidden Forbidden ForbiddenError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError

Retrieve TTS jobs

1
GET https://api.prosa.ai/v2/speech/tts

Retrieve overview of all TTS jobs. Results are not included in the response.

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console
page query integer false Index of the pagination to return
per_page query integer false Number of elements per page
from_date query string(date) false Filter jobs that are created from the date onward
until_date query string(date) false Filter jobs that are created until the date (the date itself is included)
query_text query string false Find a job with corresponding request text
sort_by query any false Sort the result based on the field
sort_ascend query boolean false Sort the result in ascending order

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "pagination": {
    "page": 1,
    "per_page": 10,
    "page_count": 1
  },
  "length": 1,
  "data": [
    {
      "job_id": "2fec34e1efb146f7a7431cb35b64550d",
      "status": "complete",
      "created_at": "2019-08-24T14:15:22Z",
      "modified_at": "2019-08-24T14:15:22Z",
      "request": {
        "label": "string",
        "text": "Hasil akhir dari pekerjaan ini cukup memuaskan"
      },
      "result": {
        "format": "opus",
        "duration": 3.7973333333333334,
        "samplerate": 48000,
        "channels": 1
      },
      "job_config": {
        "model": "tts-dimas-formal",
        "wait": false,
        "pitch": 0,
        "tempo": 1,
        "audio_format": "opus"
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Successful Response TtsJobsList
401 Unauthorized Unauthorized
403 Forbidden Forbidden ForbiddenError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError

Submit a TTS request

1
POST https://api.prosa.ai/v2/speech/tts

Submit a TTS request. The processing duration depends largely on the length of the text to synthesize.

For short TTS requests, the client is expected to wait for the result to be returned in the response. However, if the job cannot be completed in the allotted timeframe, it is instead queued and only the job ID is returned. For long TTS requests, the client can instead set the wait to false and poll Retrieve an TTS job endpoint for the result using the returned job ID. Refer to the schema for further details.

Body parameter

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "config": {
    "model": "tts-dimas-formal",
    "wait": false,
    "pitch": 0,
    "tempo": 1,
    "audio_format": "opus"
  },
  "request": {
    "label": "string",
    "text": "Hasil akhir dari pekerjaan ini cukup memuaskan"
  }
}

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console
as_signed_url query boolean false If config.wait is set to true, the audio data is returned as signed url under result.path instead. Otherwise, this parameter is ignored. Signed urls expire in 2 hours.
body body TtsJobRequest true -

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  "job_id": "2fec34e1efb146f7a7431cb35b64550d",
  "status": "created",
  "created_at": "2019-08-24T14:15:22Z",
  "modified_at": "2019-08-24T14:15:22Z",
  "request": {
    "label": "string",
    "text": "Hasil akhir dari pekerjaan ini cukup memuaskan"
  },
  "job_config": {
    "model": "tts-dimas-formal",
    "wait": false,
    "pitch": 0,
    "tempo": 1,
    "audio_format": "opus"
  },
  "model": {
    "name": "tts-dimas-formal",
    "label": "TTS Dimas Formal",
    "language": "Bahasa Indonesia",
    "domain": "formal",
    "voice": "Dimas",
    "gender": "male",
    "channels": 1,
    "samplerate": 48000
  }
}

400 Response

1
2
3
4
5
6
7
{
  "status": "tts_model_not_found",
  "message": "TTS model 'tts-dimas-formal' not found",
  "context": {
    "model": "tts-dimas-formal"
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response TtsResponse
400 Bad Request Bad Request
401 Unauthorized Unauthorized
403 Forbidden Forbidden ForbiddenError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError

Retrieve a TTS job

1
GET https://api.prosa.ai/v2/speech/tts/{job_id}

Get job details by Job ID. Returns result and status if the job has been completed.

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console
job_id path string true -
as_signed_url query boolean false If set to true, audio data is returned as signed url under result.path instead. Signed urls expire in 2 hours.

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  "job_id": "2fec34e1efb146f7a7431cb35b64550d",
  "status": "complete",
  "created_at": "2019-08-24T14:15:22Z",
  "modified_at": "2019-08-24T14:15:22Z",
  "request": {
    "label": "string",
    "text": "Hasil akhir dari pekerjaan ini cukup memuaskan"
  },
  "result": {
    "data": "<audio data in base64 encoding>",
    "format": "opus",
    "duration": 3.7973333333333334,
    "samplerate": 48000,
    "channels": 1
  },
  "job_config": {
    "model": "tts-dimas-formal",
    "wait": false,
    "pitch": 0,
    "tempo": 1,
    "audio_format": "opus"
  },
  "model": {
    "name": "tts-dimas-formal",
    "label": "TTS Dimas Formal",
    "language": "Bahasa Indonesia",
    "domain": "formal",
    "voice": "Dimas",
    "gender": "male",
    "channels": 1,
    "samplerate": 48000
  }
}
as_signed_url == true

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "job_id": "2fec34e1efb146f7a7431cb35b64550d",
  "status": "complete",
  "created_at": "2019-08-24T14:15:22Z",
  "modified_at": "2019-08-24T14:15:22Z",
  "request": {
    "label": "string",
    "text": "Hasil akhir dari pekerjaan ini cukup memuaskan",
    "as_data": false
  },
  "result": {
    "path": "https://...",
    "format": "opus",
    "duration": 3.7973333333333334,
    "samplerate": 48000,
    "channels": 1
  },
  "job_config": {
    "model": "tts-dimas-formal",
    "wait": false,
    "pitch": 0,
    "tempo": 1,
    "audio_format": "opus"
  },
  "model": {
    "name": "tts-dimas-formal",
    "label": "TTS Dimas Formal",
    "language": "Bahasa Indonesia",
    "domain": "formal",
    "voice": "Dimas",
    "gender": "male",
    "channels": 1,
    "samplerate": 48000
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response TtsResponse
401 Unauthorized Unauthorized
403 Forbidden Forbidden ForbiddenError
404 Not Found Not Found JobNotFoundError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError

Archive a TTS job

1
DELETE https://api.prosa.ai/v2/speech/tts/{job_id}

Archive a TTS job. Archived jobs are soft-deleted rather than deleted from the database entirely. Hence, job details and results are still stored. The behavior differs based on the job status:

  • HTTP 404 is returned if the job is not found or is already archived.
  • HTTP 404 is returned if the given ID does not belong to the user.
  • HTTP 403 is returned if the job is currently in progress. Archiving jobs in progress is problematic because the underlying job cannot be cancelled, as the compute resources have already been expended. This behavior may change in the future.
  • If the job has completed, the job is soft-deleted and the job details returned.
  • If the job is currently queued or deferred, the job is first cancelled before being soft-deleted, and details returned. No quota is subtracted in this case.

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console
job_id path string true -

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  "job_id": "2fec34e1efb146f7a7431cb35b64550d",
  "status": "complete",
  "created_at": "2019-08-24T14:15:22Z",
  "modified_at": "2019-08-24T14:15:22Z",
  "request": {
    "label": "string",
    "text": "Hasil akhir dari pekerjaan ini cukup memuaskan"
  },
  "result": {
    "error": "string"
  },
  "job_config": {
    "model": "tts-dimas-formal",
    "wait": false,
    "pitch": 0,
    "tempo": 1,
    "audio_format": "opus"
  },
  "model": {
    "name": "tts-dimas-formal",
    "label": "TTS Dimas Formal",
    "language": "Bahasa Indonesia",
    "domain": "formal",
    "voice": "Dimas",
    "gender": "male",
    "channels": 1,
    "samplerate": 48000
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response TtsResponse
401 Unauthorized Unauthorized
403 Forbidden Forbidden JobCancellationError
404 Not Found Not Found JobNotFoundError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError

Retrieve a TTS job status

1
GET https://api.prosa.ai/v2/speech/tts/{job_id}/status

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console
job_id path string true -

Example responses

200 Response

1
2
3
4
5
6
{
  "job_id": "2fec34e1efb146f7a7431cb35b64550d",
  "status": "complete",
  "created_at": "2019-08-24T14:15:22Z",
  "modified_at": "2019-08-24T14:15:22Z"
}

Responses

Status Meaning Description Schema
200 OK Successful Response JobStatusResponse
401 Unauthorized Unauthorized
403 Forbidden Forbidden ForbiddenError
404 Not Found Not Found JobNotFoundError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError

Count TTS jobs

1
GET https://api.prosa.ai/v2/speech/tts/count

Count the number of TTS jobs matching the query.

Parameters

Name In Type Required Description
x-api-key header string true API Key received from Prosa API Console
from_date query string(date) false Filter jobs that are created from the date onward
until_date query string(date) false Filter jobs that are created until the date (the date itself is included)
query_text query string false Find a job with corresponding request text

Example responses

200 Response

1
0

Responses

Status Meaning Description Schema
200 OK Successful Response integer
401 Unauthorized Unauthorized
403 Forbidden Forbidden ForbiddenError
422 Unprocessable Entity Validation Error RequestValidationError
500 Internal Server Error Internal Server Error InternalServerError