Cannot add call log recording to pipedrive

I cannot add the call log recording to pipedrive via python requests, while I can normally do this via Postman.

what I am trying is

url = ""

payload = {}
headers = {
  'Content-Type': 'multipart/form-data',
  'Accept': 'application/json'

response = requests.request("POST", url, headers=headers, data=payload, files=files)

I have also tried not adding some of the headers, or loading the files in another way (say, without ‘file’ key and/ or only file binary inhold but not the filename).
I do not know how to add the info on the multipart-form file size to the request (or how to calculate it).

I am running into code 400 or this error:

content-type header: multipart missing boundary",“success”:false,“error_info”:“Please check for more information about Pipedrive API.”

the issue is apparently linked to this,

but I am on python and some things should be a little bit simpler here

the chunk itself is taken from Postman which is renowned for being able to generate normal code for runtimes.
I have also tried some suggested by chatgpt4 and on SO.

Pipedrive API Support was unhelpful and directed me to the community (How to add call audio recording with python requests /callLogs/<id>/recordings — Pipedrive Community), whence I got another chatgpt4 response which is incorrect, and now I am here.

So please kindly do not provide one more chatgpt4-generated response.

Thank you in advance for help in any advancement on this matter.

code on PHP. but you have to understand it. WITHOUT BINARY. When i sent with BINARY i receive error

$endpoint = self::API_VERSION_PREFIX . ‘callLogs/’ . $callLogId . ‘/recordings’;
$mimeType = ‘audio/mp3’;
$typeFile = ‘mp3’;

    $curl = curl_init();
    $post_data = ['file'=> new CURLFILE($recordFileUrl, $mimeType, 'callRecord' . $typeFile)];
    $curlOptions = [
        CURLOPT_URL => $this->getApiUrl() . $endpoint,
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_POST => 1,
        CURLOPT_VERBOSE => true,
        CURLOPT_POSTFIELDS => $post_data,
            "Authorization: Bearer " . $this->getAccessToken(),
            'Accept: application/json'

    curl_setopt_array($curl, $curlOptions);
    $response = curl_exec($curl);

Hey, @hylloszeryy and welcome to the community! :wave:

Our engineer took a look at this and they are able to post the recording with the following example:

url = "{call_id}/recordings?api_token={token}"
headers = {}

response = requests.request("POST", url, headers=headers, data=payload, files=files)


Audio files are supported, so the issue shouldn’t be from there.

Let us know if that helps! :slight_smile: