Skip to main content
Question

Uploading file to shared folder

  • May 22, 2025
  • 7 replies
  • 50 views

Forum|alt.badge.img

Hi,

 

I am trying to upload files to a folder that my app has the ability to see a shared folder with get_shared_item(), but when I try to use this line:

 

uploaded_file = client.folder(folder_id=shared_folder.id).upload_stream(test_file, "upload_test.txt")
 

I get a 404. Is this the correct way that I would upload a stream as a file to a shared folder? The 404 says that d_{shared_folder.id} is not found. I am using the JWT auth method with the Python SDK if that matters.

Thanks!

Stephen Stern

7 replies

Forum|alt.badge.img

Hello , 

 

Thanks so much for using our platform and development forum! 

 

Without having more information, I assume you're probably making calls using a token for the service account (AutomationUser) of your JWT application. A 404 like this usually indicates that the service account has not been added as a collaborator on the folder ID you're passing, as the service account can only interact with content it's been given access to. 

 

If this isn't the case, could you please provide the full body response you receive (including the request ID) and a date/time/timezone you receive the error. I'd be happy to take a look at our backend logs for you to see if we can get you some more information! 

 

Best, 

Kourtney 


Forum|alt.badge.img

 When working with shared items, you need to include the shared link in all API calls made to have permissions on the item.  You can use the `client.with_shared_link()` method, like this:

 

shared_item_client = client.with_shared_link(shared_link)
uploaded_file = shared_item_client.folder(shared_folder.id).upload_stream(test_file, "upload_test.txt")

Note that this will only work if the shared link grants you upload permissions; this may not be the case.


Forum|alt.badge.img

Hi ,

I made this folder as a dummy, so I (as the service account) am the owner of the folder. Can I DM you to send the 404 failure? I wouldn't want the id for the shared_folder in a public post.


Forum|alt.badge.img

Hi ,

    Awesome, I'm getting a new error. I am getting an insufficient permission error, which is what I would assume you were talking about. This service account is the owner of the link, so I think I should be able to change its permissions. Where is the option to allow uploading with shared links? I can't seem to be able to find it either in the folder settings or the shared link settings.

 

Thanks!


Forum|alt.badge.img

 I'm not aware of the ability to upload files into a shared folder, and the API docs don't show a way to set that permission.  If the Service Account owns the folder the link points to, why do you need to use the shared link?  You should just have permission to upload into the folder or collaborate whoever needs upload access into the folder directly. 


Forum|alt.badge.img

Hi ,

 

Good to know that uploading to a shared folder isn't a thing. I guess that because it is a service account, the folder space that it has access to is something that only box-admin have access to, not what I can see when I go to the UI file store. Since I can't upload to a shared folder, I will just get access to get the info to as-user write into the folders. Thanks!


Forum|alt.badge.img

 That should work.  Your other option would be to use the Service Account to collaborate yourself (or any other user who needs access) to the folder.