Skip to main content
Question

Python BOXSDK JWTAuth 404 error when trying to upload file

  • May 22, 2025
  • 1 reply
  • 28 views

Forum|alt.badge.img

I am currently running the following code:

oauth = JWTAuth(
                client_id='xxxxxxx', 
                client_secret='xxxxxxxx', 
                enterprise_id='xxxxxxx',
                jwt_key_id='xxxxxxx',
                rsa_private_key_file_sys_path='xxxxxxx.pem',
               )
access_token = oauth.authenticate_instance()
from boxsdk import Client
client = Client(oauth)
shared_folder = client.folder(folder_id='***number removed for privacy***0')
upload_file = shared_folder.upload('Automated Upload.xlsx')

And I get the following error:

BoxAPIException: 
Message: Not Found
Status: 404
Code: not_found
Request id: a1br79fmepibiced
Headers: {'Date': 'Tue, 12 Dec 2017 21:48:24 GMT', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache, no-store', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Vary': 'Accept-Encoding', 'Content-Length': '322', 'Age': '0', 'Connection': 'keep-alive'}
URL: https://upload.box.com/api/2.0/files/content
Method: POST
Context info: {'errors': [{'reason': 'invalid_parameter', 'name': 'parent', 'message': "Invalid value 'd_1234567890'. 'parent' with value 'd_1234567890' not found"}]}

Does this mean that I don't have access to the folder. When I use just the root folder, i.e. folder_id = '0' it doesn't error out, but it doesn't upload anything either.

1 reply

Forum|alt.badge.img

Fixed the error I was getting by adding myself as a user to the account (since I am not the owner). I used the following code:

oauth = JWTAuth(
                client_id='xxxxxxx', 
                client_secret='xxxxxxx', 
                enterprise_id='xxxxxxxx',
                jwt_key_id='xxxxxx',
                rsa_private_key_file_sys_path='xxxxxxx.pem',
               )
access_token = oauth.authenticate_instance()
from boxsdk import Client
client = Client(oauth)
ev_user = client.user(user_id='***number removed for privacy***')
ev_auth = JWTAuth(
                client_id='xxxxxxxx', 
                client_secret='xxxxxxxx', 
                enterprise_id='xxxxxxxx',
                jwt_key_id='xxxxxxxx',
               
rsa_private_key_file_sys_path='xxxxxx.pem',
               )
ev_auth.authenticate_app_user(ev_user)
ev_client = Client(ev_auth)
shared_folder = ev_client.folder(folder_id='***number removed for privacy***0')