my $ua = WWW::Mechanize->new(); $ua->credentials('apikey','that_api_key'); my $r = HTTP::Request->new( 'POST' => 'https://stream-fra.watsonplatform.net/speech-to-text/api/v1/recognize', [ 'Accept' => '*/*', 'Host' => 'stream-fra.watsonplatform.net:443', 'User-Agent' => 'curl/7.55.1', 'Content-Length' => length $file_content, 'Content-Type' => 'audio/flac', ], $file_content ); my $res = $ua->request( $r );