Attaching file in pipedrive

Question asked in StackOverflow
(!/Files/post_files Doesn’t show request example and I can’t send POST request via python.

My error is: “No files provided”

Maybe someone has an example for this request?

My code:

import requests

with open('qwerty.csv', 'rb') as f:
    r ='',
                      params={'api_token': 'MY_TOKEN'}, files={'file': f})
1 Like

Ah, all you need is check request in chrome develop tools and play with it for some time.

import requests

files = {'file': ('FILE_NAME', open('fgsfds.jpg', 'rb'), 'CONTENT_TYPE')}
r ='',
                  params={'api_token': 'TOKEN'}, 
                  data={'file_type':'img', 'deal_id':DEAL_ID}, files=files)


What is the max file size for uploading?

The max should be 50MB.
I’m about 97% sure.

1 Like

Code that works to upload file:

import requests
api_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
headers = {
    'X-Api-Token': str(api_token),
    'User-Agent': "Testing",
    'Cache-Control': "no-cache",
    'Host': ""

id = 1
files = {'file': ('file_name_in_pd.jpg', open('existing_file_name.jpg', 'rb'), 'img')}
r =, headers=headers, data={'deal_id':id}, files=files)


Hi jaan.molder,

Could I please have an example of uploading a file in NodeJS?

Because I am getting an error as Pipedrive API error:Invalid File Create request - data contains invalid keys while adding a file by using the endpoint (pipedrive.Files.add(data, [callback])). I have used the data keys as per the given documentations.

My data to upload the file is shown below.

let dataToAddFile = {
file: pdfToBeUploaded,
deal_id: 1

1 Like

Hi Varinder,

You can use PipeDrive Npm in node Js for attaching a files to a deal

Using Files.add method

Thanks David, very helpful ! Do you also have sample code to do the same file upload in VBA ? I would like to attach an Excel offer to a deal…