I'm using the official Office365-REST-Python-Client which basically is a wrapper to submit HTTP requests. I'm looking at the documentation and have been succesfully able to upload documents to the site, however they are all going straight to the Shared Documents Folder. When I try specifying a subfolder, I get a HTTP 404 client error because the API is creating a bad request.

HTTPError: 404 Client Error: Not Found for url: https://domain.sharepoint.com/sites/site_name/_api/Web/lists/GetByTitle('Documents%2Ftest%2F')/RootFolder/Files/add(overwrite=true,url='runtime_table.csv')

I've been reading the documentation and understand I need to add a subfolder to the REST query, but I'm not sure how to do that within the Python library? Any help would be greatly appreciated, thanks.

2 Answers 2


I suggest to use this endpoint:

http://<site url>/_api/web/GetFolderByServerRelativeUrl('<folder relative url>')/files/add(overwrite=true, url='runtime_table.csv')

This is the endpoint to do that:


Using postman tool quickly you can test this POST upload function before going into the coding implementation.

Similar question is answered here:

Add files to subfolders using rest api in javascript

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.