POST /api/speak/resource

Upload an audio file to clone a voice.

Caution

To use this feature, please contact sales.

Request

Headers

Parameters

  • None

Body as JSON Object

Key

Type

Required

Description

audio_format

string

Yes

Format of audio file. Available audio formats are [‘wav’, ‘mp3’, ‘m4a’].

Example with cURL
    curl --request POST \
        --url https://typecast.ai/api/speak/resource \
        --header "Content-Type: application/json" \
        --header "Authorization: Bearer $API_TOKEN" \
        --data '{
            "audio_format": "wav",
        }'

Response

Status Code

Status Code

Description

401

Authorization Error

400

JSON object representing an error. See how the error looks.

200

JSON object containing the result.

result consists of the following

Key

Description

speak_resource_id

The ID of the upload URL request API. When making a request to the POST Speak API, it should be included if the tts_mode is set to audio_file.

presigned_url

A URL for uploading an audio file.

Example
{
  "result": {
    "speak_resource_id": "63ee55f00000000000000000",
    "presigned_url": "https://cdn.typecast.ai..."
  }
}

error_codes in 400 response

Error Code

Description

app/param/not-enough

Some required fields are not included in the request body.

app/param/type-mismatch

When field types are mismatched.

app/invalid/audio_format

audio_format is incorrect or disallowed.

Example
{
  "message": {
    "msg": "invalid audio_format",
    "error_code": "app/invalid/audio_format"
  }
}