Import bots via python and Control Room API is not working


I am trying to automate the import of bots into the productive control room using python. But I always get the error 'Can\'t read the uploaded file part'. Manually it is working. My code is the following:


headers = { "content-type":"multipart/form-data", "X-Authorization", "token that I generated"}

with open('C:\\...\\', 'rb') as f: 

payload = MultipartEncoder(fields={'upload': ('', f, 'application/zip'),

'actionIfExisting': 'OVERWRITE', 'publicWorkspace': 'False'})

     url = "https://" + control-room-server + "/v2/blm/import"

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


Any suggestions? With Postman this import API is also not working.


Thanks in advance,


3 replies

Userlevel 4
Badge +7

Hi @Henriette Franz​ ,


Here is an article from the Official Website on Bot Lifecycle Management.

I hope you find it resourceful.


Kind Regards,

Ashwin A.K

Hi @Henriette Franz​ , probably you have solved it already, but as I recently had the same issue, I am posting here what I've found:


Apparently, when sending multipart content with requests in Python (i am using requests 2.28.1 with python 3.10), you don't need to specify the 'content-type' header. I had tried everything until I found some post mencioning this, so I deleted the content-type from my header, and as simply as that, my code started working.


#export_name = ''

importFile = open(export_name,'rb')

headers = {

  'Accept': 'application/json',

  'X-Authorization': token



  'actionIfExisting': 'OVERWRITE',

  'publicWorkspace': 'false'






r = + '/v2/blm/import', data=data, files=files,headers=headers, verify=False)



Hope it helps, if not to you, to others like me that could'nt find the solution here.





Badge +5

@gonzalomh91 thankyou very much, I had similar issues but now it's working.