# **POST** /api/speak/resource Upload an audio file to clone a voice. ```{caution} To use this feature, please contact sales. ``` ## Request ### Headers * [Required headers](reference/request.md#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 ```bash 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](reference/error.md#error-codes) | | 400 | JSON object representing an error. [See how the error looks](reference/error.md#structure). | | 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](post_api_speak.md#request), it should be included if the tts_mode is set to audio_file. | | __`presigned_url`__ | A URL for uploading an audio file. |
Example ```json { "result": { "speak_resource_id": "63ee55f00000000000000000", "presigned_url": "https://cdn.typecast.ai..." } } ```
### `error_code`s 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 ```json { "message": { "msg": "invalid audio_format", "error_code": "app/invalid/audio_format" } } ```