#API rejects files for dubbing with content type error

1 messages · Page 1 of 1 (latest)

grim coral
#

Reproduction:

Trying to upload audio/video files via Python SDK and Node.js client
Also tried through the Playground in docs

Getting errors:

Python/Node.js: "unsupported_content_type" with message "File you provided has unsupported content type application/octet-stream"
Playground: "There was an error parsing the body"

The error occurs:

With different file types (both audio and video)
Through different upload methods (SDK and web interface)
Files are valid and open normally

Python code:

    async def dubbing_video(
            self,
            target_lang: str,
            file: bytes | str | None,
            num_speakers: int,
            name: str,
            source_lang: str,
            url: str | None = None,
            end_time: int | None = None,
            start_time: int | None = None,
            watermark: bool = False,
    ) -> dict | None:

        params = {
            "target_lang": target_lang,
            "num_speakers": num_speakers,
            "source_lang": source_lang,
            "name": name,
            "start_time": start_time,
            "end_time": end_time,
            "watermark": watermark
        }
        if file:
            params["file"] = file
        elif url:
            params["url"] = url

        try:
            response = await self.client.dubbing.dub_a_video_or_an_audio_file(**params)
            return response
        except Exception as e:
            await logger.log_error(error=e)
            return None

Python error log:

raise ApiError(status_code=_response.status_code, body=_response_json)
elevenlabs.core.api_error.ApiError: status_code: 400, body: {'detail': {'status': 'unsupported_content_type', 'message': 'File you provided has unsupported content type application/octet-stream.'}}